xref: /haiku/headers/private/kernel/arch/riscv64/arch_kernel.h (revision abba71575e34f84c3d75be9d29d6e6caa6c033db)
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        0x80000000
18 #define KERNEL_LOAD_BASE_64_BIT 0xffffffff80000000ll
19 
20 
21 #if defined(__riscv64__)
22 
23 // Base of the kernel address space.
24 #define KERNEL_BASE            (0x0000000000000000 + 0x1000)
25 #define KERNEL_TOP             (0x0000004000000000 - 1)
26 #define KERNEL_SIZE            ((KERNEL_TOP - KERNEL_BASE) + 1)
27 
28 // Kernel physical memory map area.
29 #define KERNEL_PMAP_BASE        0x0000003000000000
30 #define KERNEL_PMAP_SIZE        0x1000000000
31 
32 // Userspace address space layout.
33 #define USER_BASE               0xffffffc000000000
34 #define USER_BASE_ANY           USER_BASE
35 #define USER_SIZE               0x0000004000000000
36 #define USER_TOP                (USER_BASE + (USER_SIZE - 1))
37 
38 #define KERNEL_USER_DATA_BASE   (USER_BASE + 0x3000000000)
39 #define USER_STACK_REGION       (USER_BASE + 0x3000000000)
40 #define USER_STACK_REGION_SIZE  ((USER_TOP - USER_STACK_REGION) + 1)
41 
42 #else /* ! __riscv64__ */
43 	#warning Unknown RISC-V Architecture!
44 #endif
45 
46 #endif	/* _KERNEL_ARCH_RISCV64_KERNEL_H */
47