xref: /haiku/headers/private/kernel/arch/riscv64/arch_kernel.h (revision 9e25244c5e9051f6cd333820d6332397361abd6c)
1 /*
2  * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
3  * Distributed under the terms of the NewOS License.
4  */
5 #ifndef _KERNEL_ARCH_RISCV64_KERNEL_H
6 #define _KERNEL_ARCH_RISCV64_KERNEL_H
7 
8 
9 #ifndef _ASSEMBLER
10 #ifdef __cplusplus
11 #	include <arch/cpu.h>
12 #endif
13 #endif
14 
15 
16 // memory layout
17 #define KERNEL_LOAD_BASE          0xffffffc000000000
18 
19 
20 #if (defined(__riscv) && __riscv_xlen == 64)
21 
22 // Base of the kernel address space.
23 #define KERNEL_BASE               0xffffffc000000000
24 #define KERNEL_SIZE               0x0000004000000000
25 #define KERNEL_TOP                (KERNEL_BASE + (KERNEL_SIZE - 1))
26 
27 // Userspace address space layout.
28 #define USER_BASE            (0x0000000000000000 + 0x1000)
29 #define USER_BASE_ANY         USER_BASE
30 #define USER_TOP             (0x0000004000000000 - 1)
31 #define USER_SIZE            (USER_TOP - USER_BASE + 1)
32 
33 #define KERNEL_USER_DATA_BASE   (USER_BASE + 0x3000000000)
34 #define USER_STACK_REGION       (USER_BASE + 0x3000000000)
35 #define USER_STACK_REGION_SIZE  ((USER_TOP - USER_STACK_REGION) + 1)
36 
37 #else /* ! riscv64 */
38 	#warning Unknown RISC-V Architecture!
39 #endif
40 
41 #endif	/* _KERNEL_ARCH_RISCV64_KERNEL_H */
42