Page Fault after enabling interrupt using sti

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.
kemosparc
Member
Member
Posts: 207
Joined: Tue Oct 29, 2013 1:13 pm

Re: Page Fault after enabling interrupt using sti

Post 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.
kemosparc
Member
Member
Posts: 207
Joined: Tue Oct 29, 2013 1:13 pm

Re: Page Fault after enabling interrupt using sti

Post 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.
kemosparc
Member
Member
Posts: 207
Joined: Tue Oct 29, 2013 1:13 pm

Re: Page Fault after enabling interrupt using sti

Post 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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Page Fault after enabling interrupt using sti

Post 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?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
brighteningeyes
Member
Member
Posts: 45
Joined: Sat Sep 07, 2013 8:26 am
Contact:

Re: Page Fault after enabling interrupt using sti

Post 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
testing the operating system is very hard when your eyes can't see well
like me and many others
Post Reply