X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/b60166b327a9108b07e3069fa6568a451529ffd9..32b9a6d76790c73d3d2d36d9081a2581cc65d184:/lunaix-os/arch/i386/includes/sys/mm/mm_defs.h diff --git a/lunaix-os/arch/i386/includes/sys/mm/mm_defs.h b/lunaix-os/arch/i386/includes/sys/mm/mm_defs.h index 8f51352..5c098d3 100644 --- a/lunaix-os/arch/i386/includes/sys/mm/mm_defs.h +++ b/lunaix-os/arch/i386/includes/sys/mm/mm_defs.h @@ -1,13 +1,34 @@ #ifndef __LUNAIX_MM_DEFS_H #define __LUNAIX_MM_DEFS_H + #include "mempart.h" +#include "pagetable.h" + +#define KSTACK_PAGES 3 +#define KSTACK_SIZE (KSTACK_PAGES * MEM_PAGE) + +/* + Regardless architecture we need to draw the line very carefully, and must + take the size of VM into account. In general, we aims to achieve + "sufficiently large" of memory for kernel + + In terms of x86_32: + * #768~1022 PTEs of PD (0x00000000c0000000, ~1GiB) + + In light of upcomming x86_64 support (for Level 4&5 Paging): + * #510 entry of PML4 (0x0000ff0000000000, ~512GiB) + * #510 entry of PML5 (0x01fe000000000000, ~256TiB) +*/ +// Where the kernel getting re-mapped. +#define KERNEL_RESIDENT 0xc0000000UL -#define KSTACK_SIZE (3 * MEM_PAGE) +// Pages reserved for kernel image +#define KEXEC_RSVD 16 -#define MEMGUARD 0xdeadc0deUL +#define kernel_addr(addr) ((addr) >= KERNEL_RESIDENT || (addr) < USR_EXEC) -#define kernel_addr(addr) ((addr) >= KERNEL_EXEC) -#define guardian_page(pte) ((pte) == MEMGUARD) +#define to_kphysical(k_va) ((ptr_t)(k_va) - KERNEL_RESIDENT) +#define to_kvirtual(k_pa) ((ptr_t)(k_pa) - KERNEL_RESIDENT) #endif /* __LUNAIX_MM_DEFS_H */