Skip to content

Commit 9ee2100

Browse files
author
tthomps
committed
Ensure the kernel's page directory is set before the first possible call to KPageAllocator(). This fixes a bug that was only preventing itself in VirtualBox.
VirtualBox is now working again, although the Window Names in the GUI shell appear corrupted.
1 parent 62a824c commit 9ee2100

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

MyOS_1/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ void KeStartup()
9494
JumpToUpperHalf();
9595
//kprintf("eipVal: 0x%lX\n", eipVal);
9696

97+
// Make sure KPageAllocator can find the kernel page directory
98+
tasks[0].cr3 = (uint32_t)pageDir;
99+
97100
// Initialize graphical mode if Grub set one for us
98101
GraphicsInitFromGrub(multibootInfo);
99102

@@ -118,7 +121,6 @@ void KeStartupPhase2(multiboot_info *multibootInfo)
118121
tasks[0].inUse = true;
119122
strncpy(tasks[0].imageName, "KERNEL PROCESS", sizeof("KERNEL PROCESS"));
120123
tasks[0].PID = nextPID - 1;
121-
tasks[0].cr3 = (uint32_t)pageDir;
122124

123125
// Initialize interrupts
124126
Interrupts_Init();

0 commit comments

Comments
 (0)