diff options
Diffstat (limited to 'arch/x86_64')
| -rw-r--r-- | arch/x86_64/boot/limine/framebuffer.c | 49 | ||||
| -rw-r--r-- | arch/x86_64/hal/paging.c | 158 | ||||
| -rw-r--r-- | arch/x86_64/hal/paging.h | 4 | ||||
| -rw-r--r-- | arch/x86_64/hal/serial_com.c | 2 | ||||
| -rw-r--r-- | arch/x86_64/hal/smp.c | 14 | ||||
| -rw-r--r-- | arch/x86_64/hal/uacpi.c | 15 | ||||
| -rw-r--r-- | arch/x86_64/main.c | 6 | ||||
| -rw-r--r-- | arch/x86_64/sys/init.c | 91 |
8 files changed, 207 insertions, 132 deletions
diff --git a/arch/x86_64/boot/limine/framebuffer.c b/arch/x86_64/boot/limine/framebuffer.c index 85c3f43..637a7fc 100644 --- a/arch/x86_64/boot/limine/framebuffer.c +++ b/arch/x86_64/boot/limine/framebuffer.c @@ -14,47 +14,38 @@ #define FRAMEBUFFER_MAX_HUGEPAGES ((FRAMEBUFFER_MAX_PAGES + 511) / 512) #define FRAMEBUFFER_MAX_GIANTPAGES ((FRAMEBUFFER_MAX_HUGEPAGES + 511) / 512) -PAGEALIGN static page_t fb_pml2[FRAMEBUFFER_MAX_GIANTPAGES][512]; -PAGEALIGN static page_t fb_pml1[FRAMEBUFFER_MAX_HUGEPAGES][512]; +PAGEALIGN static page_t fb_pages[FRAMEBUFFER_MAX_GIANTPAGES + FRAMEBUFFER_MAX_HUGEPAGES][512]; -extern page_t _kernel_pml3[512]; +extern page_t _kernel_pml4[512]; void* fb_remap(uintptr_t fb_address, size_t fb_bytes) { - memset(fb_pml2, 0, 0x1000 * FRAMEBUFFER_MAX_GIANTPAGES); - memset(fb_pml1, 0, 0x1000 * FRAMEBUFFER_MAX_HUGEPAGES); - fb_address &= ~IDENT_VIRT_BASE; - size_t fb_pages = (fb_bytes + 4095) >> 12; - size_t fb_hugepages = (fb_pages + 511) >> 9; - size_t fb_giantpages = (fb_hugepages + 511) >> 9; + size_t fb_numpages = (fb_bytes + 4095) >> 12; - if(fb_pages > FRAMEBUFFER_MAX_PAGES) { + if(fb_numpages > FRAMEBUFFER_MAX_PAGES) { kprintf("Framebuffer is too big! Please recompile the kernel with a bigger framebuffer allowance!"); return NULL; } - for(size_t pml2 = 0; pml2 < fb_giantpages; pml2++) { - uintptr_t fb_pml2_pptr = KPTR_TOPHYS(&fb_pml2[pml2]); - _kernel_pml3[pml2].value = fb_pml2_pptr | PAGE_PRESENT | PAGE_GLOBAL | PAGE_WRITEABLE; - } - - for(size_t pml1 = 0; pml1 < fb_hugepages; pml1++) { - size_t pml2 = pml1 >> 9; - size_t pml1_mod = pml1 % 512; - uintptr_t pml1_pptr = KPTR_TOPHYS(&fb_pml1[pml1]); - fb_pml2[pml2][pml1_mod].value = pml1_pptr | PAGE_PRESENT | PAGE_GLOBAL | PAGE_WRITEABLE; - } - - for(size_t pml0 = 0; pml0 < fb_pages; pml0++) { - size_t pml1 = pml0 >> 9; - size_t pml0_mod = pml0 % 512; - uintptr_t pml0_pptr = fb_address + (pml0 << 12); - fb_pml1[pml1][pml0_mod].value = pml0_pptr | PAGE_PRESENT | PAGE_GLOBAL | PAGE_WRITEABLE | PAGE_WRITETHROUGH | PAGE_XD; + uintptr_t vptr = IDENT_VIRT_BASE | (511ULL << PMLI_SHL(3)); + size_t last_table = 0; + for(size_t page = 0; page < fb_numpages; page++) { + uintptr_t frame = fb_address + (page << 12); + uintptr_t frame_virt = vptr + (page << 12); + + int tblres = 0; + do { + uintptr_t tbl_frame = KPTR_TOPHYS(&fb_pages[last_table++]); + tblres = pagedir_map_table(_kernel_pml4, tbl_frame, frame_virt); + if(tblres == EHASMAP) last_table--; + } while(tblres == 0); + + pagedir_map_frame(_kernel_pml4, frame, frame_virt, + PAGE_GLOBAL | PAGE_WRITEABLE | PAGE_XD); } - uintptr_t fb_virt = IDENT_VIRT_BASE | (511ULL << PMLI_SHL(3)); - return (void*)fb_virt; + return (void*)vptr; } diff --git a/arch/x86_64/hal/paging.c b/arch/x86_64/hal/paging.c index 7b45005..47c79f3 100644 --- a/arch/x86_64/hal/paging.c +++ b/arch/x86_64/hal/paging.c @@ -1,5 +1,6 @@ #include "paging.h" #include "arch/x86_64/x86_64.h" +#include "hal/memory.h" #include "jove.h" #include "init.h" #include "config.h" @@ -73,45 +74,91 @@ s_int_handle_pf_early(struct int_stackframe *frame) hcf(); } -int pagedir_map_frame( - jove_owned_obj_t *tgt, jove_owned_obj_t *untyped_obj, - uintptr_t vptr, struct syscall_pagedir_flags flg) +static page_t* +s_pagedir_get_pml1(page_t *pml4, uintptr_t vptr) { - page_t *pml4 = obj_deref(tgt); - uintptr_t frame = obj_getvalue(untyped_obj); - + errno = 0; size_t pml4i = PML4I(vptr); - if(!pml4[pml4i].p) return ENOMAP; + if(!pml4[pml4i].p) { + errno = ENOMAP; + return 0; + } page_t *pml3 = (page_t*)(((uintptr_t)pml4[pml4i].paddr << 12) | IDENT_VIRT_BASE); size_t pml3i = PML3I(vptr); - if(!pml3[pml3i].p) return ENOMAP; + if(!pml3[pml3i].p) { + errno = ENOMAP; + return 0; + } page_t *pml2 = (page_t*)(((uintptr_t)pml3[pml3i].paddr << 12) | IDENT_VIRT_BASE); size_t pml2i = PML2I(vptr); - if(!pml2[pml2i].p) return ENOMAP; + if(!pml2[pml2i].p) { + errno = ENOMAP; + return 0; + } + + return (page_t*)(((uintptr_t)pml2[pml2i].paddr << 12) | IDENT_VIRT_BASE); +} + +int pagedir_map_frame(page_t *pml4, + uintptr_t pptr, uintptr_t vptr, + uintmax_t flg) +{ + page_t *pml1 = s_pagedir_get_pml1(pml4, vptr); + if(!pml1) + return errno; - page_t *pml1 = (page_t*)(((uintptr_t)pml2[pml2i].paddr << 12) | IDENT_VIRT_BASE); size_t pml1i = PML1I(vptr); if(pml1[pml1i].p) return EEXIST; - pml1[pml1i].value = frame | - PAGE_PRESENT | - PAGE_USER | - (flg.writeable ? PAGE_WRITETHROUGH : 0) | - (flg.executable ? 0 : PAGE_XD); + pml1[pml1i].value = pptr | PAGE_PRESENT | flg; + __asm__ volatile("invlpg (%0)":: "r"(vptr): "memory"); return 0; } -int pagedir_map_table( +int pagedir_map_untyped_frame( jove_owned_obj_t *tgt, jove_owned_obj_t *untyped_obj, uintptr_t vptr, struct syscall_pagedir_flags flg) { - page_t *target_table = NULL; page_t *pml4 = obj_deref(tgt); uintptr_t frame = obj_getvalue(untyped_obj); - void *frame_ident = obj_deref(untyped_obj); + return pagedir_map_frame(pml4, frame, vptr, + (flg.writeable ? PAGE_WRITEABLE : 0) | + (flg.executable ? PAGE_XD : 0)); +} + +int pagedir_unmap_untyped_frame( + jove_owned_obj_t *tgt, jove_owned_obj_t *dst, uintptr_t vptr) +{ + page_t *pml4 = obj_deref(tgt); + + size_t pml4i = PML4I(vptr); + if(!pml4[pml4i].p) return ENOMAP; + + page_t *pml1 = s_pagedir_get_pml1(pml4, vptr); + size_t pml1i = PML1I(vptr); + if(!pml1[pml1i].p) return ENOMAP; + + uintptr_t untyped_pptr = (pml1[pml1i].paddr << 12); + + obj_settype(dst, JOVE_OBJ_UNTYPED); + obj_setvalue(dst, untyped_pptr); + + jove_untyped_t *untyped_data = obj_deref(dst); + untyped_data->limit = 0x1000; + __asm__ volatile("invlpg (%0)":: "r"(vptr): "memory"); + + return 0; +} + +int pagedir_map_table(page_t *pml4, + uintptr_t pptr, uintptr_t vptr) +{ + page_t *target_table = NULL; + + void *frame_ident = (void*)(pptr | IDENT_VIRT_BASE); memset(frame_ident, 0, 0x1000); size_t pml4i = PML4I(vptr); @@ -136,14 +183,77 @@ int pagedir_map_table( return EHASMAP; map_table: - target_table->value = frame | + target_table->value = pptr | PAGE_PRESENT | - PAGE_USER | - (flg.writeable ? PAGE_WRITETHROUGH : 0) | - (flg.executable ? 0 : PAGE_XD); + (pptr > IDENT_VIRT_BASE ? 0 : PAGE_USER) | + PAGE_WRITEABLE; + __asm__ volatile("invlpg (%0)":: "r"(vptr): "memory"); return 0; } +int pagedir_map_untyped_table( + jove_owned_obj_t *tgt, jove_owned_obj_t *untyped_obj, + uintptr_t vptr, struct syscall_pagedir_flags flg) +{ + page_t *pml4 = obj_deref(tgt); + uintptr_t frame = obj_getvalue(untyped_obj); + + return pagedir_map_table(pml4, frame, vptr); +} + +int pagedir_unmap_untyped_table( + jove_owned_obj_t *tgt, jove_owned_obj_t *dst, uintptr_t vptr) +{ + page_t *target_table = NULL; + page_t *pml4 = obj_deref(tgt); + + //If the PML4 entry does not exist at this virtual ptr, the user may be + //trying to unmap the entire address space. We don't support this. + size_t pml4i = PML4I(vptr); + if(!pml4[pml4i].p) { + return ENOMAP; + } + target_table = &pml4[pml4i]; + + //Try to unmap the pml4 entry if the pml3 entry does not exist. + page_t *pml3 = (page_t*)(((uintptr_t)pml4[pml4i].paddr << 12) | IDENT_VIRT_BASE); + size_t pml3i = PML3I(vptr); + if(!pml3[pml3i].p) { + goto unmap_table; + } + target_table = &pml3[pml3i]; + + //Try to unmap the pml3 entry if the pml2 entry does not exist. + page_t *pml2 = (page_t*)(((uintptr_t)pml3[pml3i].paddr << 12) | IDENT_VIRT_BASE); + size_t pml2i = PML2I(vptr); + if(!pml2[pml2i].p) { + goto unmap_table; + } + //We are unmapping a pml2 entry. + target_table = &pml2[pml2i]; + +unmap_table: +{ + uintptr_t frame = target_table->paddr << 12; + page_t *target_vals = (page_t*)(frame | IDENT_VIRT_BASE); + + //Check that the page table at our target entry is empty. + //If it's not, we return an error saying that the entry contains a map. + for(size_t i = 0; i < 512; i++) { + if(target_vals[i].p) return EHASMAP; + } + + //Populate the none object with an untyped object at the free'd page frame. + obj_settype(dst, JOVE_OBJ_UNTYPED); + obj_setvalue(dst, frame); + + jove_untyped_t *untyped = obj_deref(dst); + untyped->limit = 0x1000; + + __asm__ volatile("invlpg (%0)":: "r"(vptr): "memory"); + return 0; +} +} void paging_pml4_init(void) @@ -196,7 +306,7 @@ paging_pml4_init(void) uintptr_t kernel_rodata_off = kernel_text_off + kernel_text_pages; for(size_t i = 0; i < kernel_rodata_pages; i++) { size_t off = i + kernel_rodata_off; - uintptr_t page_off = kernel_text_start_pptr + (off << 12); + uintptr_t page_off = kernel_rodata_start_pptr + (i << 12); _kernel_pml1[off].value = page_off | PAGE_PRESENT | PAGE_GLOBAL | PAGE_XD; } @@ -210,7 +320,7 @@ paging_pml4_init(void) uintptr_t kernel_data_off = kernel_rodata_off + kernel_rodata_pages; for(size_t i = 0; i < kernel_data_pages; i++) { size_t off = i + kernel_data_off; - uintptr_t page_off = kernel_text_start_pptr + (off << 12); + uintptr_t page_off = kernel_data_start_pptr + (i << 12); _kernel_pml1[off].value = page_off | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_GLOBAL | PAGE_XD; } diff --git a/arch/x86_64/hal/paging.h b/arch/x86_64/hal/paging.h index 754ac99..3e16003 100644 --- a/arch/x86_64/hal/paging.h +++ b/arch/x86_64/hal/paging.h @@ -1,3 +1,4 @@ +#include "api/syscall.h" #ifndef _JOVE_x86_64_HAL_PAGING_H #define _JOVE_x86_64_HAL_PAGING_H 1 @@ -51,6 +52,9 @@ extern void *_kernel_physptr; #define KERNEL_VIRT_BASE 0xFFFFFFFF80000000ULL #define KPTR_TOPHYS(v) (((uintptr_t)v) - KERNEL_VIRT_BASE + (uintptr_t)_kernel_physptr) +int pagedir_map_frame(page_t *pml4, uintptr_t pptr, uintptr_t vptr, uintmax_t flags); +int pagedir_map_table(page_t *pml4, uintptr_t pptr, uintptr_t vptr); + uintptr_t paging_get_pml4(void); void paging_pml4_init(void); diff --git a/arch/x86_64/hal/serial_com.c b/arch/x86_64/hal/serial_com.c index 5d7de24..8454c8a 100644 --- a/arch/x86_64/hal/serial_com.c +++ b/arch/x86_64/hal/serial_com.c @@ -64,7 +64,7 @@ void serial_com_init(void) { if(serial_com_init_port(SERIAL_COM1, 3)) { - hcf(); + return; } { diff --git a/arch/x86_64/hal/smp.c b/arch/x86_64/hal/smp.c index 85ba4ec..682c6e6 100644 --- a/arch/x86_64/hal/smp.c +++ b/arch/x86_64/hal/smp.c @@ -5,13 +5,13 @@ #include "config.h" #include "jove.h" #include "lib/printf.h" +#include "lib/string.h" #include "paging.h" #include "msr.h" -processor_t s_processors[SMP_PROCESSORS_MAX] = { 0 }; +processor_t s_processors[SMP_PROCESSORS_MAX]; -PAGEALIGN -jove_objdir_t s_processor_objdir = { 0 }; +PAGEALIGN jove_objdir_t s_processor_objdir; extern void gdt_setup(processor_t *processor); @@ -38,10 +38,9 @@ init_processor(processor_t *processor, jove_owned_obj_t *obj) void smp_init_bsp(void) { - idt_init(); - paging_pml4_init(); + memset(s_processors, 0, sizeof(s_processors)); + memset(&s_processor_objdir, 0, 0x1000); - kprintf("%p\n", _rootdir_obj); processor_t *bsp = &s_processors[0]; { jove_owned_obj_t *processor_objdir_obj = objdir_getlocal(_rootdir_obj, ROOTDIR_PROCESSORS_I); @@ -54,6 +53,9 @@ smp_init_bsp(void) obj_release(bsp_obj); obj_release(processor_objdir_obj); } + + paging_pml4_init(); + idt_init(); } processor_t *processor_current(void) diff --git a/arch/x86_64/hal/uacpi.c b/arch/x86_64/hal/uacpi.c deleted file mode 100644 index 052f849..0000000 --- a/arch/x86_64/hal/uacpi.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "lib/printf.h" -#include "uacpi/kernel_api.h" -#include "paging.h" - -void *uacpi_kernel_map(uacpi_phys_addr addr, uacpi_size len) -{ - //kprintf("UACPI kernel map %p -> %p\n", addr, (uintptr_t)addr | IDENT_VIRT_BASE); - return (void*)(addr | IDENT_VIRT_BASE); -} - -void uacpi_kernel_unmap(void *addr, uacpi_size len) -{ - (void)addr; - (void)len; -} diff --git a/arch/x86_64/main.c b/arch/x86_64/main.c index a35a465..7467843 100644 --- a/arch/x86_64/main.c +++ b/arch/x86_64/main.c @@ -12,16 +12,16 @@ #include "hal/memory.h" #include "hal/framebuffer.h" #include "hal/process.h" -#include "hal/uacpi.h" #include "boot/initrd.h" #include "boot/cmdline.h" -#include "uacpi/uacpi.h" int errno = 0; PAGEALIGN jove_objdir_t _rootdir; void *_rootdir_obj = &_rootdir.entries[ROOTDIR_DIR_I]; +struct init_payload _init_payload; + static void kernel_process_entry(void); void @@ -56,8 +56,6 @@ kernel_entry(void) static void kernel_process_entry(void) { - uacpi_kernel_init(); - init_setup(); kpanic("Reached the end of kernel main!\n"); } diff --git a/arch/x86_64/sys/init.c b/arch/x86_64/sys/init.c index c55eabe..40c3240 100644 --- a/arch/x86_64/sys/init.c +++ b/arch/x86_64/sys/init.c @@ -12,15 +12,9 @@ #include "boot/cmdline.h" #include "boot/initrd.h" -PAGEALIGN static page_t s_init_program_pml3[512]; -PAGEALIGN static page_t s_init_program_pml2[512]; -PAGEALIGN static page_t s_init_program_pml1[512]; -PAGEALIGN static uint8_t s_init_program_pages[INIT_PROGRAM_PAGES_MAX][0x1000]; - -PAGEALIGN static page_t s_init_stack_pml3[512]; -PAGEALIGN static page_t s_init_stack_pml2[512]; -PAGEALIGN static page_t s_init_stack_pml1[512]; -PAGEALIGN static uint8_t s_init_stack_pages[INIT_STACK_PAGES][0x1000]; +PAGEALIGN static uint8_t s_init_program_pages[INIT_PROGRAM_PAGES_MAX + 3][0x1000]; +PAGEALIGN static uint8_t s_init_stack_pages[INIT_STACK_PAGES + 3][0x1000]; +PAGEALIGN static uint8_t s_init_message_page[0x1000]; static int elf_is_valid(struct elf_header *ehdr) @@ -54,24 +48,6 @@ elf_is_valid(struct elf_header *ehdr) void init_setup(void) { - memset(s_init_program_pml3, 0, 0x1000); - memset(s_init_program_pml2, 0, 0x1000); - memset(s_init_program_pml1, 0, 0x1000); - - memset(s_init_stack_pml3, 0, 0x1000); - memset(s_init_stack_pml2, 0, 0x1000); - memset(s_init_stack_pml1, 0, 0x1000); - - uintptr_t init_program_pml3_pptr = KPTR_TOPHYS(&s_init_program_pml3); - uintptr_t init_program_pml2_pptr = KPTR_TOPHYS(&s_init_program_pml2); - uintptr_t init_program_pml1_pptr = KPTR_TOPHYS(&s_init_program_pml1); - uintptr_t init_program_pml0_pptr = KPTR_TOPHYS(&s_init_program_pages); - - uintptr_t init_stack_pml3_pptr = KPTR_TOPHYS(&s_init_stack_pml3); - uintptr_t init_stack_pml2_pptr = KPTR_TOPHYS(&s_init_stack_pml2); - uintptr_t init_stack_pml1_pptr = KPTR_TOPHYS(&s_init_stack_pml1); - uintptr_t init_stack_pml0_pptr = KPTR_TOPHYS(&s_init_stack_pages); - //Get the init file data from the initrd. const char *init_path = cmdline_getarg("init"); if(init_path == NULL) { @@ -102,6 +78,7 @@ init_setup(void) size_t last_base = 0; //Load the init ELF + size_t last_page = 0; for(size_t i = 0; i < init_ehdr->e_phnum; i++) { struct elf_phdr *phdr = init_data + init_ehdr->e_phoff + i * init_ehdr->e_phentsize; if(phdr->p_type != PT_LOAD) continue; @@ -109,28 +86,26 @@ init_setup(void) uintptr_t base = phdr->p_vaddr; size_t limit = phdr->p_memsz; + if(last_base < base + limit) last_base = base + limit; uintptr_t page_base = base & ~0xFFFULL; - size_t pml3i = (page_base >> PMLI_SHL(3)) & 0x1FF; - size_t pml2i = (page_base >> PMLI_SHL(2)) & 0x1FF; - size_t pml1i = (page_base >> PMLI_SHL(1)) & 0x1FF; - size_t base_pml0i = (page_base >> PMLI_SHL(0)) & 0x1FF; - - pml4[pml3i].value = init_program_pml3_pptr | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_USER; - s_init_program_pml3[pml2i].value = init_program_pml2_pptr | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_USER; - s_init_program_pml2[pml1i].value = init_program_pml1_pptr | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_USER; - size_t pages = (limit + 4095) / 4096; - for(size_t pmlo = 0; pmlo < pages; pmlo++) { - size_t pml0i = base_pml0i + pmlo; - if(pml0i > INIT_PROGRAM_PAGES_MAX) { + for(size_t i = 0; i < pages; i++) { + uintptr_t page_virt = page_base + (i << 12); + if(last_page > INIT_PROGRAM_PAGES_MAX) { kpanic("init: Program exceeds maximum program pages in the same hugepage frame!\n"); } - if(last_base < base + limit) last_base = base + limit; - uintptr_t pml0_pptr = init_program_pml0_pptr + (pml0i << 12); - s_init_program_pml1[pml0i].value = pml0_pptr | PAGE_PRESENT | PAGE_USER | PAGE_WRITEABLE; + int tblres = 0; + do { + uintptr_t tbl_frame = KPTR_TOPHYS(&s_init_program_pages[last_page++]); + tblres = pagedir_map_table(pml4, tbl_frame, page_virt); + if(tblres == EHASMAP) last_page--; + }while(!tblres); + + pagedir_map_frame(pml4, KPTR_TOPHYS(&s_init_program_pages[last_page++]), page_virt, + PAGE_WRITEABLE | PAGE_USER); } //Copy data from section if SHT_PROGBITS @@ -138,22 +113,32 @@ init_setup(void) } //Map the stack - pml4[255].value = init_stack_pml3_pptr | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_USER | PAGE_XD; - s_init_stack_pml3[511].value = init_stack_pml2_pptr | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_USER | PAGE_XD; - s_init_stack_pml2[511].value = init_stack_pml1_pptr | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_USER | PAGE_XD; - for(size_t pmlo = 0; pmlo < INIT_STACK_PAGES; pmlo++) { - size_t pml0i = 511 - pmlo; - uintptr_t page_pptr = init_stack_pml0_pptr + (pmlo << 12); - - s_init_stack_pml1[pml0i].value = page_pptr | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_USER | PAGE_XD; + size_t stack_base = 0x00007FFFFFFFF000; + int stack_mapres = 0; + + last_page = 0; + for(size_t i = 0; i < INIT_STACK_PAGES; i++) { + uintptr_t page_virt = stack_base - (i << 12); + int tblres = 0; + + do { + uintptr_t tbl_frame = KPTR_TOPHYS(&s_init_stack_pages[last_page++]); + tblres = pagedir_map_table(pml4, tbl_frame, page_virt); + if(tblres == EHASMAP) last_page--; + }while(!tblres); + + pagedir_map_frame(pml4, KPTR_TOPHYS(&s_init_stack_pages[last_page++]), page_virt, + PAGE_WRITEABLE | PAGE_USER | PAGE_XD); } //Map the syscall message. last_base = (last_base + 0xFFF) & ~0xFFF; - size_t last_page = (last_base >> 12) & 0x1FF; - uintptr_t message_pptr = init_program_pml0_pptr + (last_page << 12); - s_init_program_pml1[last_page].value = message_pptr | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_USER | PAGE_XD; + uintptr_t message_pptr = KPTR_TOPHYS(s_init_message_page); + pagedir_map_frame(pml4, message_pptr, last_base, + PAGE_WRITEABLE | PAGE_USER | PAGE_XD); + extern struct init_payload _init_payload; + memcpy((void*)last_base, &_init_payload, sizeof(struct init_payload)); jove_owned_obj_t *message_obj = objdir_getlocal(_rootdir_obj, ROOTDIR_MESSAGE_I); obj_settype(message_obj, JOVE_OBJ_MESSAGE); |
