/** * @file * http://www.brokenthorn.com/Resources/OSDev18.html * https://wiki.osdev.org/Memory_Map_(x86) * * Paging * ====== * * The Smallest Managable Unit is a Page containing 4096 (0x1000) bytes. * * A Page Directory holds 1024 tables each mapping 1024 pages, totaling * in 0x100000000 bytes of addressable space (4gigs). * * The first 32megs will get ALWAYS identity mapped (hold kernel code/kernel stack etc) * This are the first 8 page-tables * * Layout * ====== * * We are aiming for the following layout: * TODO: update, this is not true anumore! * 0xFFFFFFFF * 0xC0000000 RESERVED * * 0xB0000000 User Stack TOP (Grows down) | * env, argc, argv ... | * | alltogether ~2.5gigs * .......... User Heap (brk()) | * 0x08000000 User Code | * | * | almost 100 megs (in kernel alloc/free private-cpu and shared) * | * 0x02000000 FoolOS TSS Stack TOP (max ~8mb) GROWS DOWN * leave few empty pages under stack as guard. * * 0x01800000 FoolOS Stack TOP (max ~8mb) GROWS DOWN * leave few empty pages under stack as guard. * * 0x01000000 * 0x00EFFFFF RESERVED * 0x00100000 FoolOS Kernel (max ~14mb) * 0x00007BFF RESERVED * 0x00007000 16-bit SMP entry (max ~3kb) * 0x00006fff smp entry stacks (growing down) * 0x00000500 * 0x00000000 RESERVED * */ #include #include "multiboot.h" #include "acpi.h" struct pdirectory_struct; void vmem_init(multiboot_information *cfg_multiboot, acpi_information *cfg_acpi,uint32_t e1000_addr); void vmem_free_dir(struct pdirectory_struct *dir); struct pdirectory_struct* vmem_new_space_dir(struct pdirectory_struct *copy_dir,bool stack_only); void vmem_free_space_dir(struct pdirectory_struct *dir,bool stack_only); void vmem_add_framebuffer(struct pdirectory_struct *dir); struct pdirectory_struct* vmem_kernel_dir();