0

I've been working on code to test the speed of the APIC using the PIT. There are several problems I can't figure out. First, when testing my ISRs for the two timers, I get general protection faults on the iretq instructions. Second, neither timer actually fires any interrupts. Any help on this would be much appreciated.

Link to the relevant file.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • Probably not what your problem is, but this looks suspicious: `pop rdx` `pop rax` `mov rax, ckpoint` `call print` `iretq` . You seem to restore RAX and RDX but then you clobber RAX with `ckpoint` and then call `printf`. Seems like at a minimum you have trashed RAX, not sure what `printf` trashes before returning with `iretq` . Is that what you intended? – Michael Petch Feb 19 '19 at 17:07
  • It's code that tests to see where it gets. The #GP occurs regardless of whether the checkpointing is there or not. ckpoint is printed however, which is how I know that it faults on the iretq. – Jenifer De Jager Feb 19 '19 at 17:18
  • 1
    I would help if you commented your code more: I don't remember all the APIC registers by offsets and it's not clear to me what are you timing. – Margaret Bloom Feb 19 '19 at 19:40

1 Answers1

1

The general protection faults were caused by having an invalid CS register due to not reloading the CS register after loading the GDT. It's not in the code I linked to at all.