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