Fixed reboot problem

STACK GROWS DOWN, NOT UP!
This commit is contained in:
pjht 2019-03-24 13:42:00 -05:00
parent e1579b5f2a
commit 5618dd6834
2 changed files with 4 additions and 1 deletions

View File

@ -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;
}

View File

@ -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;