8dd7df6d41e1fb60834851c0d4f57ef04aa9fcd3
[lunaix-os.git] / lunaix-os / arch / i386 / includes / sys / mm / mm_defs.h
1 #ifndef __LUNAIX_MM_DEFS_H
2 #define __LUNAIX_MM_DEFS_H
3
4 #include "mempart.h"
5 #include "pagetable.h"
6
7 #define KSTACK_PAGES            3
8 #define KSTACK_SIZE             (KSTACK_PAGES * MEM_PAGE)
9
10 /*
11     Regardless architecture we need to draw the line very carefully, and must 
12     take the size of VM into account. In general, we aims to achieve 
13     "sufficiently large" of memory for kernel
14
15     In terms of x86_32:
16         * #768~1022 PTEs of PD      (0x00000000c0000000, ~1GiB)
17     
18     In light of upcomming x86_64 support (for Level 4&5 Paging):
19         * #510 entry of PML4        (0x0000ff0000000000, ~512GiB)
20         * #510 entry of PML5        (0x01fe000000000000, ~256TiB)
21 */
22 // Where the kernel getting re-mapped.
23 #define KERNEL_RESIDENT         0xc0000000UL
24
25 // Pages reserved for kernel image
26 #define KEXEC_RSVD              16
27
28 #define kernel_addr(addr)       ((addr) >= KERNEL_RESIDENT || (addr) < USR_EXEC)
29
30 #define to_kphysical(k_va)      ((ptr_t)(k_va) - KERNEL_RESIDENT)
31 #define to_kvirtual(k_pa)       ((ptr_t)(k_pa) - KERNEL_RESIDENT)
32
33 #endif /* __LUNAIX_MM_DEFS_H */