From 5618dd683432272b42ed224f82d079a358e5edc4 Mon Sep 17 00:00:00 2001 From: pjht Date: Sun, 24 Mar 2019 13:42:00 -0500 Subject: [PATCH] Fixed reboot problem STACK GROWS DOWN, NOT UP! --- cpu/i386/paging.c | 3 +++ cpu/i386/tasking.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cpu/i386/paging.c b/cpu/i386/paging.c index 782add0..1f0bd86 100644 --- a/cpu/i386/paging.c +++ b/cpu/i386/paging.c @@ -109,6 +109,9 @@ void* new_address_space() { smap[i+1022]=(entry_virt-0xC0000000)|0x3; } smap_page_tables[0]=(((uint32_t)&(page_directory))-0xC0000000)|0x3; + for (uint32_t i=1;i<2048;i++) { + smap_page_tables[i]=0; + } return dir; } diff --git a/cpu/i386/tasking.c b/cpu/i386/tasking.c index 3b1c861..8d10f57 100644 --- a/cpu/i386/tasking.c +++ b/cpu/i386/tasking.c @@ -42,7 +42,7 @@ static Task* createTaskKmode(void* eip,char kmode) { uint32_t cr3; asm volatile("movl %%cr3, %%eax; movl %%eax, %0;":"=m"(cr3)::"%eax"); load_address_space(task->regs.cr3); - task->regs.esp=(uint32_t)alloc_memory(1); + task->regs.esp=((uint32_t)alloc_memory(1))+0xfff; load_address_space(cr3); task->regs.ebp=0; task->msg_store=NULL;