xref: /haiku/headers/private/kernel/arch/riscv64/arch_kernel.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
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 #include <arch/cpu.h>
9 
10 #warning Review arch_kernel.h
11 
12 // memory layout
13 #define KERNEL_LOAD_BASE        0x80000000
14 #define KERNEL_LOAD_BASE_64_BIT 0xffffffff80000000ll
15 
16 
17 #if defined(__riscv64__)
18 
19 // Base of the kernel address space.
20 #define KERNEL_BASE             0xffffff0000000000
21 #define KERNEL_SIZE             0x10000000000
22 #define KERNEL_TOP              (KERNEL_BASE + (KERNEL_SIZE - 1))
23 
24 // Kernel physical memory map area.
25 #define KERNEL_PMAP_BASE        0xffffff0000000000
26 #define KERNEL_PMAP_SIZE        0x8000000000
27 
28 // Userspace address space layout.
29 // There is a 2MB hole just before the end of the bottom half of the address
30 // space. This means that if userland passes in a buffer that crosses into the
31 // uncanonical address region, it will be caught through a page fault.
32 #define USER_BASE               0x100000
33 #define USER_BASE_ANY           USER_BASE
34 #define USER_SIZE               (0x800000000000 - (0x200000 + USER_BASE))
35 #define USER_TOP                (USER_BASE + (USER_SIZE - 1))
36 
37 #define KERNEL_USER_DATA_BASE   0x7f0000000000
38 #define USER_STACK_REGION       0x7f0000000000
39 #define USER_STACK_REGION_SIZE  ((USER_TOP - USER_STACK_REGION) + 1)
40 
41 #else /* ! __riscv64__ */
42 	#warning Unknown RISC-V Architecture!
43 #endif
44 
45 #endif	/* _KERNEL_ARCH_RISCV64_KERNEL_H */
46