really need help--about protected mode
Posted: Wed Nov 28, 2001 1:10 am
This piece code is within my boot loader.
(CS=7c00,DS=0,ES=0,SS=0)
cli
lgdt qword ptr gdtr
mov eax,cr0
or al,1
mov cr0,eax
db 0eah |Reset when reach here,jmp 0010:xxxx,now CPU should found
dw do_pm |out the 'gdt1',and the base address from gdt1 is 0,
dw gdt1 |plus xxxx,then I got 0000xxxx, this should be right,but it seems not. ?
do_pm:
jmp $
Follow is the definition for GDT(I think the bug is hides here):
gdtr:
dw gdtend-gdt-1
dd gdt ;base
gdt:
dq 0 ;NULL descriptor
gdt0 equ $-gdt
dw 0ffffh ;limit 4G
dw 0 ;base addr L16
db 0 ;base addr M8
db 92h ;(ds)data descriptor
db 0cfh ;G/D
db 0 ;base addr H8
gdt1 equ $-gdt
dw 0ffffh
dw 0 ;the address is wrong?
db 0
db 9ah ;(cs)code descriptor
db 0cfh
db 0
gdtend:
Thanks for any infomation.
I have studied Christopher Giese's example for a long time,but he's code is base on DOS,so I can't get any headway now:-(
user4
(CS=7c00,DS=0,ES=0,SS=0)
cli
lgdt qword ptr gdtr
mov eax,cr0
or al,1
mov cr0,eax
db 0eah |Reset when reach here,jmp 0010:xxxx,now CPU should found
dw do_pm |out the 'gdt1',and the base address from gdt1 is 0,
dw gdt1 |plus xxxx,then I got 0000xxxx, this should be right,but it seems not. ?
do_pm:
jmp $
Follow is the definition for GDT(I think the bug is hides here):
gdtr:
dw gdtend-gdt-1
dd gdt ;base
gdt:
dq 0 ;NULL descriptor
gdt0 equ $-gdt
dw 0ffffh ;limit 4G
dw 0 ;base addr L16
db 0 ;base addr M8
db 92h ;(ds)data descriptor
db 0cfh ;G/D
db 0 ;base addr H8
gdt1 equ $-gdt
dw 0ffffh
dw 0 ;the address is wrong?
db 0
db 9ah ;(cs)code descriptor
db 0cfh
db 0
gdtend:
Thanks for any infomation.
I have studied Christopher Giese's example for a long time,but he's code is base on DOS,so I can't get any headway now:-(
user4