GDT problem
Posted: Sun Jan 19, 2003 5:53 am
here's my gdt code :
[pre]gdt:
db 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
db 0xFF,0xFF,0x0,0x0,0x0,0x9A,0xCF,0x0
db 0xFF,0xFF,0x0,0x0,0x0,0x92,0xCF,0x0
gdtend:
gdtptr:
dw 0
dd 0
mov ax,gdtend
mov bx,gdt
sub ax,bx
mov [gtdptr],ax
mov ax,ds
movzx ecx,ax
shl ecx,4
mov ebx,gdt
add ecx,ebx
mov [gdtptr+2],ecx
lgdt [gdtptr]
mov eax,cr0
or eax,0x1
mov cr0,eax
jmp next
next:
mov ax,0x10
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
mov esp,0x8000
jmp dword 0x8:KERNEL_ADDRESS[/pre]
And I get a sequence of messages like this with bochs :
[pre]selector->index*8+7 = 5583
gdtr.limit=40
fetch_raw_descriptor: GDT: index > limit[/pre]
and bochs pushes 16 bytes on the stack until ESP reaches the bottom of the memory.
What is the problem ?
[pre]gdt:
db 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
db 0xFF,0xFF,0x0,0x0,0x0,0x9A,0xCF,0x0
db 0xFF,0xFF,0x0,0x0,0x0,0x92,0xCF,0x0
gdtend:
gdtptr:
dw 0
dd 0
mov ax,gdtend
mov bx,gdt
sub ax,bx
mov [gtdptr],ax
mov ax,ds
movzx ecx,ax
shl ecx,4
mov ebx,gdt
add ecx,ebx
mov [gdtptr+2],ecx
lgdt [gdtptr]
mov eax,cr0
or eax,0x1
mov cr0,eax
jmp next
next:
mov ax,0x10
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
mov esp,0x8000
jmp dword 0x8:KERNEL_ADDRESS[/pre]
And I get a sequence of messages like this with bochs :
[pre]selector->index*8+7 = 5583
gdtr.limit=40
fetch_raw_descriptor: GDT: index > limit[/pre]
and bochs pushes 16 bytes on the stack until ESP reaches the bottom of the memory.
What is the problem ?