Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
if (descriptor.valid==0 || descriptor.segment ||
(descriptor.type!=BX_SYS_SEGMENT_AVAIL_286_TSS &&
descriptor.type!=BX_SYS_SEGMENT_AVAIL_386_TSS))
{
BX_ERROR(("LTR: doesn't point to an available TSS descriptor!"));
exception(BX_GP_EXCEPTION, raw_selector & 0xfffc, 0);
}
my descriptor.type is equal to 0x9 in the GDT
I've tried to see where is defined descriptor.segment and .valid.
In the function parse_descriptor in cpu/segment_ctrl_pro.cc is checked if the descriptor is a segment (if the bit4 in the access byte is set). If not it starts to see wath the descriptor is. In this checks is included also the 386 TSS descriptor, and descriptor.valid is set to 1. So why does bochs give me this error?[/code]
You can set breakpoint (int 3 maybe) in Bochs and see real descriptors loaded into gdt with command "info gdt" to check that Bochs realy loaded what you assume to load.
I need not the INT 3. When bochs give me that message, a General Protection Fault is fired, and my kernel enter in an infinite loop. So I press CTRL+C to enter the debugger and my gdt contains:
According to GP error code (raw_selector & 0xfffc) you are trying to switch to BUSY TSS (index 3) --
/* #GP(selector) if object is not a TSS or is already busy */
Yes!!!
I've two TSSs. When the PIT fires, I've to load the new TR. If I make an infinite loop after the first LTR is loaded... there isn't any GP fault!!! Now the problem is to understand why it tryes to loads the same TR again...