Page 2 of 2
Re: Page Fault after enabling interrupt using sti
Posted: Sun Nov 10, 2013 1:09 pm
by kemosparc
If I don't the timer runs one time only and will not continue to fire every time interval.
Also JamesM's tutorial (Protected Mode) that I am following and trying to make it work in 64-bit does the same thing.
What I don't understand is why is it working on Bochs and not Qemu.
Also, why those instructions create access to a memory location post that mapped size with exactly 0xf01 bytes consistently even when I change the size mapped as I stated before.
I will have access to a machine with virtual box and I am going to try it out on it as well.
Thanks
Karim.
Re: Page Fault after enabling interrupt using sti
Posted: Sun Nov 10, 2013 1:41 pm
by kemosparc
Surprisingly, Virtual Box worked fine with no problems.
I think that the problem is very much related to qemu.
I will try to avail a VMWare environment and try on it as well.
If anyone passed through this before, please let me know.
Thanks
Karim.
Re: Page Fault after enabling interrupt using sti
Posted: Sun Nov 10, 2013 1:52 pm
by kemosparc
Okay, Finally,
When I added -enable-kvm to the Qemu command line, everything worked as expected on Qemu.
BUT I DO NOT UNDERSTAND WHY THIS IS HAPPENING.
Please if any one has any explanation for that, please let me know.
I want to know if this means that my code is okay?? Or there is still a problem that is masked by the different emulators and was unmasked by qemu without kvm support ??
Thanks
Karim.
Re: Page Fault after enabling interrupt using sti
Posted: Mon Nov 11, 2013 4:51 am
by Combuster
bwat wrote:Do you really want to execute a "sti" before you initialise the timer?
Depending on the remainder of the design, yes. At least if you follow a future-proofed design the most appropriate routine is roughly as follows:
- configure IDT
- configure PIC and mask all IRQs
- enable interrupts
- configure device X (point in case: the PIT)
- unmask the IRQ line in question.
BUT I DO NOT UNDERSTAND WHY THIS IS HAPPENING.
If hardware virtualisation - or running directly on the processor - fixes things then it could mean your qemu software core doesn't provide features that are present on your actual processor. For instance, is your qemu actually called qemu-system-x86_64?
Re: Page Fault after enabling interrupt using sti
Posted: Mon Nov 11, 2013 6:05 am
by brighteningeyes
i have a recommendation:
don't initialize keyboard handler IRQ in the Timer Handler!
after the timer has been initialized, initialize the keyboard
this make's your code standard