CristiV wrote:
Ethin wrote:
What vector are you sending?
0x08 is the value of the vector
rdos wrote:
I can see several problems in the code. First, a far jmp is done to segment 8040, which is linear address 804000. Next, GDT is loaded based on the code being at 80xx, and finally, none of the selectors in the GDT are actually loaded, and so there is no use in loading the GDT in the first place. This results in 32-bit code being entered with real mode selectors still loaded, which is sure to tripple fault.
I just used the example provided on the wiki, to see if it would work. Someone said here that the lack of a GDT when switching to the protected mode leads to a triple fault.
I'm yet to fully understand how GDT, IDT and the real mode work
I think that is more or less a prerequisite for writing code like this. Real mode has 64k limits on all segments, and the linear address is formed by shifting the segment value four bits left and adding the offset. For protected mode, you load selectors from the GDT and the base & limit in the GDT determines how the linear address is calculated. To load a new CS selector, you must do a far jmp (or far call, ret, iret) to the selector. So, it's not enough to define flat selectors in the GDT, you also must load them. Of note is also that the default operand size is determined by the CS selector bitness, and real mode and 32-bit flat mode have different default operand sizes, and so if you do a far jmp through your flat selector, the code it jumps to needs to have 32-bit default bitness.