Code: Select all
>>PANIC<< fetch_raw_descriptor: LDTR.valid=0
The thing is I don't actually have an LDT, so this makes me think somehow the stack is getting messed up somehow.
This is the c code:
Code: Select all
void start_tests();
void call_test(); /*Function in the asm file*/
void ring0();
void ring3();
void start_tests()
{
gdt_add_gate( (unsigned long int)&ring0, /*Pointer to our funtion*/
_DESCRIPTOR_CALL_GATE | _DPL_0, /*Make our gate a call gate, with DPL 0 (ring0)*/
0x08, /*Our currect code segment*/
9); /*Put it in the 9th GDT entry*/
call_test(); /*Call our asm test function*/
}
void ring0()
{
_print("In ring0",0x0C,3);
asm("lret"); /*The AT&T 'long return' instruction. For ret'ing to a different segment*/
}
void ring3()
{
_print("In ring3",0x0B,4);
for(;;)
asm("nop");
}
Code: Select all
[bits 32]
[global _call_test]
_call_test:
CALL 0x48:0x00 ; The call gate's place in the gdt
_loopage: ; This loop is to make sure any errors caused
NOP ;can only be the fault of the code we are
JMP _loopage ;trying to test.
RET
Me