problems with rtc interrupt in long mode.
Posted: Tue Feb 20, 2007 5:14 am
Hi all, i hope you can help me with the following problem.
I've managed to get interupts up and running under 64-bit long mode which works with the keyboard and de pit timer but at the moment i turn on the rtc interrupt i get a General Protection Exception on a real PC while bochs and qemu work perfectly. The GP is allways raised when the iretq instruction is executed. This is giving me some headaches the last few hours.
my GDT is as follows:
i am aware of the fact that the data64 selector ring 3 is redundant because long mode does not check the privilege of data sectors.
the stack is:
100000-110000: stack for privilege level 0
110000-120000: stack for privilege level 1
120000-130000: stack for privilege level 2
130000-140000: stack for privilege level 3
when the GP occurs the status of the registers is:
ss = 0x0;
rsp = 0x10FFD8;
rflags = 0x210006;
cs = 8;
rip = 0x9146; // iretq statement
errorcode = 0x18;
any idea how to solve this or where to start looking?
<<edit: never mind the problem was a racing condition that occurred only when the rtc interrupt was enabled>>
I've managed to get interupts up and running under 64-bit long mode which works with the keyboard and de pit timer but at the moment i turn on the rtc interrupt i get a General Protection Exception on a real PC while bochs and qemu work perfectly. The GP is allways raised when the iretq instruction is executed. This is giving me some headaches the last few hours.
my GDT is as follows:
Code: Select all
gdt[0].raw[0] = 0x0000000000000000ull; //- null selector.
gdt[1].raw[0] = 0x0020980000000000ull; //- code64 selector ring 0.
gdt[2].raw[0] = 0x0000920000000000ull; //- data64 selector ring 0.
gdt[3].raw[0] = 0x0000F20000000000ull; //- data64 selector ring 3.
gdt[4].raw[0] = 0x0020F80000000000ull; //- code64 selector ring 3.
gdt[5].raw[0] = 0x0000000000000000ull; //- null selector.
gdt[6].raw[0] = 0x000089000000006Full | (((vintp)tss) << 16); //- tss selector.
gdt[7].raw[0] = 0x0000000000000000ull; //- null selector.
the stack is:
100000-110000: stack for privilege level 0
110000-120000: stack for privilege level 1
120000-130000: stack for privilege level 2
130000-140000: stack for privilege level 3
when the GP occurs the status of the registers is:
ss = 0x0;
rsp = 0x10FFD8;
rflags = 0x210006;
cs = 8;
rip = 0x9146; // iretq statement
errorcode = 0x18;
any idea how to solve this or where to start looking?
<<edit: never mind the problem was a racing condition that occurred only when the rtc interrupt was enabled>>