Why does my PC reboot when I enable PAGE??
Posted: Fri Apr 25, 2003 7:57 pm
hi,everybody:
I make a OS kernel image,when I load it(loaded at 0x100000 in the RAM) and execute it,an exception will occur:the PC will reboot when execute the following instructions:
...
movl ???$0x101000,%eax
/*Set the page directory table pointer.. */
??? movl ???%eax,%cr3???
movl ???%cr0,%eax
/*Set PG=1 */
??? orl ???$0x80000000,%eax
??? movl ???%eax,%cr0
??? /*Flush the prefetch-queue*/???
??? jmp ???1f?????????
1:
/*Make sure eip is relocated*/
??? movl ???$1f,%eax
??? jmp ???*%eax??????
1:???/*Display a char in the screen*/
??? movl???$0x0B8F96,%eax
??? movb???$67,%bl
??? movb???$0x07,%bh
??? movw???%bx,(%eax)
...
.org 0x1000
.globl page_dir
page_dir:
...
.org 0x2000
.globl page_tb0
page_tb0:
...
...
I am sure I have make the PE=1 in the CR0 register before enable PAGING,and map the 1st 4MB of RAM correctly in the page directory and page table 0.
But once executes the instructons above,the PC will reboot,why???pls help me,thanks very much!!!!
BTW:I make the kernel image whith the following Makefile:
kernel.img:kernel.o
ld $< -o $@ -s --oformat binary -Ttext 0x100000
kernel.o:kernel.S
as $< -o $@
I make a OS kernel image,when I load it(loaded at 0x100000 in the RAM) and execute it,an exception will occur:the PC will reboot when execute the following instructions:
...
movl ???$0x101000,%eax
/*Set the page directory table pointer.. */
??? movl ???%eax,%cr3???
movl ???%cr0,%eax
/*Set PG=1 */
??? orl ???$0x80000000,%eax
??? movl ???%eax,%cr0
??? /*Flush the prefetch-queue*/???
??? jmp ???1f?????????
1:
/*Make sure eip is relocated*/
??? movl ???$1f,%eax
??? jmp ???*%eax??????
1:???/*Display a char in the screen*/
??? movl???$0x0B8F96,%eax
??? movb???$67,%bl
??? movb???$0x07,%bh
??? movw???%bx,(%eax)
...
.org 0x1000
.globl page_dir
page_dir:
...
.org 0x2000
.globl page_tb0
page_tb0:
...
...
I am sure I have make the PE=1 in the CR0 register before enable PAGING,and map the 1st 4MB of RAM correctly in the page directory and page table 0.
But once executes the instructons above,the PC will reboot,why???pls help me,thanks very much!!!!
BTW:I make the kernel image whith the following Makefile:
kernel.img:kernel.o
ld $< -o $@ -s --oformat binary -Ttext 0x100000
kernel.o:kernel.S
as $< -o $@