Interrupts from usermode problem
Posted: Sat Oct 27, 2012 5:08 am
Hello fellow OS-devers,
For the past couple of months i've been working on my own OS.
I've been following JamesM's tutorial to understand how to get to usermode and do interrupts from there.
Now, I've run into a problem which I just can't seem to figure out.
I downloaded the complete tutorial code from the last tutorial page (usermode) and modified some things:
- removed the cli from the switch_to_usermode function
- added a function to timer.c to get the tick count
- added this function as a syscall
- added a Sleep() function (works in kernel mode!)
- added that as a syscall
Sleep function:
Now, the problem is that when I use Sleep() from usermode it never exits.
When I add a monitor_write to the interrupt handler for the timer it stops writing the tick count to screen (see screenshot), leading me to beleive that interrupts somehow are not fired.
Strange thing is, syscalls are working, which suggests interrupts are working fine.
Also ISRs work fine, when I do a ASM sti from usermode it GPFs as expected.
Any suggestions are very much appreciated.
For the past couple of months i've been working on my own OS.
I've been following JamesM's tutorial to understand how to get to usermode and do interrupts from there.
Now, I've run into a problem which I just can't seem to figure out.
I downloaded the complete tutorial code from the last tutorial page (usermode) and modified some things:
- removed the cli from the switch_to_usermode function
- added a function to timer.c to get the tick count
- added this function as a syscall
- added a Sleep() function (works in kernel mode!)
- added that as a syscall
Sleep function:
Code: Select all
void Sleep(int Ticks)
{
int ETicks = 0;
ETicks = Ticks + get_tick_count();
do {} while(ETicks > get_tick_count());
}
When I add a monitor_write to the interrupt handler for the timer it stops writing the tick count to screen (see screenshot), leading me to beleive that interrupts somehow are not fired.
Strange thing is, syscalls are working, which suggests interrupts are working fine.
Also ISRs work fine, when I do a ASM sti from usermode it GPFs as expected.
Any suggestions are very much appreciated.