Reset in protected mode
Posted: Wed Jun 27, 2012 11:01 am
hello guys, i too got similar error. i don't know why. i have done
and for setting gdt
in my kernel code itself i made such that it should halt when exception (in this case general protection fault) occurs. so what i could see is that it didn't occur as son as idt was set up and i did asm("sti"::); but a little while later gpf occurs. from many days i am stuck with this.
one last thing, in bochs how to know that contents of stack. i have a doubt that i might have some stack problem or so because i felt that the values i gave for gdt descriptors was proper.
Code: Select all
isr_h:
pusha ; push edi,esi,ebp,esp,ebx,edx,ecx,eax
mov ax, ds ; Lower 16-bits of eax = ds.
push eax
mov ax, 0x10 ;kernel data segment descriptor
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
call isr_handler
pop eax ;original data segment descriptor
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
popa
add esp, 8
sti
iret
Code: Select all
gdt_set_2:
mov eax,[esp+4]
lgdt [eax]
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:.flush
.flush:
ret
Code: Select all
00044166318e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00044166318e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00044166318e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00044166318e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00097560109e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x20)
00097779809e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x20)
one last thing, in bochs how to know that contents of stack. i have a doubt that i might have some stack problem or so because i felt that the values i gave for gdt descriptors was proper.