Page 1 of 2

interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 8:18 pm
by GhostedGaming
https://github.com/Eucalyptus-OS/Eucalypt-Kernel
so i plan on making a dos and i dont understand how i can keep interrupts going when switched to a program
since they take over the whole cpu i dont know how to get the interrupts to keep going it would be nice for the breakout game to work but i cant get interrupts going only the timer but thats because of another reason and just because the timer still ticks doesnt mean the other interrupts continue.

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 8:18 pm
by GhostedGaming
please review the code as well if you dont mind so you can understand what im saying

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 9:03 pm
by Octocontrabass
GhostedGaming wrote: Tue Jan 06, 2026 8:18 pmi dont understand how i can keep interrupts going when switched to a program since they take over the whole cpu
If you don't want programs to take over the whole CPU, don't allow programs to take over the whole CPU.
GhostedGaming wrote: Tue Jan 06, 2026 8:18 pmi cant get interrupts going
Have you tried running "info pic" in QEMU's monitor to see if there's something wrong with the interrupt controllers?

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 9:29 pm
by GhostedGaming
It seems there's a pending keyboard interrupt in the pic but interrupts dont continue until the app returns

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 10:04 pm
by Octocontrabass
GhostedGaming wrote: Tue Jan 06, 2026 9:29 pmIt seems there's a pending keyboard interrupt in the pic
Where in the "info pic" output do you see that?
GhostedGaming wrote: Tue Jan 06, 2026 9:29 pmbut interrupts dont continue until the app returns
Is the interrupt pending while the app is running? Have you used your debugger to check the interrupt flag in RFLAGS?

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 10:27 pm
by GhostedGaming
The rflags show that interrupts are disabled but I dont understand why

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 10:44 pm
by Octocontrabass
Set a breakpoint before calling the app. Are interrupts enabled there?

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 11:14 pm
by GhostedGaming
Adding a breakpoints and checking the rflags show that interrupts are disabeld but even after I put the sti instruction before the application call interrupts are still disabled

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 11:18 pm
by Octocontrabass
Set a breakpoint right after the STI instruction. Are interrupts enabled there?

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 11:27 pm
by GhostedGaming
Yes interrupts are enabled it seems that jumping to the entry of the application is causing interrupts to be disabled but how?

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 11:30 pm
by Octocontrabass
Have you tried stepping through the instructions that execute at the entry point?

Re: interrupts in a monotasking kernel only OS

Posted: Tue Jan 06, 2026 11:35 pm
by GhostedGaming
I've actually never had to do that so im gonna have to figure it out I may do it tomorrow but if it helps im executing 64bit elf

Re: interrupts in a monotasking kernel only OS

Posted: Wed Jan 07, 2026 3:11 am
by bellezzasolo
GhostedGaming wrote: Tue Jan 06, 2026 11:35 pm I've actually never had to do that so im gonna have to figure it out I may do it tomorrow but if it helps im executing 64bit elf
I can't look too deep right now, but regarding 128_handler, your STI instruction will enable interrupts, you call into syscall_handler, and then when that returns, you IRETQ.

IRETQ will restore the flags, including IF, from the stack. That's all that comes to mind right now.

Re: interrupts in a monotasking kernel only OS

Posted: Wed Jan 07, 2026 5:16 am
by GhostedGaming
I removed the sti instruction in the 128

Re: interrupts in a monotasking kernel only OS

Posted: Wed Jan 07, 2026 8:27 am
by GhostedGaming
bellezzasolo wrote: Wed Jan 07, 2026 3:11 am
GhostedGaming wrote: Tue Jan 06, 2026 11:35 pm I've actually never had to do that so im gonna have to figure it out I may do it tomorrow but if it helps im executing 64bit elf
I can't look too deep right now, but regarding 128_handler, your STI instruction will enable interrupts, you call into syscall_handler, and then when that returns, you IRETQ.

IRETQ will restore the flags, including IF, from the stack. That's all that comes to mind right now.
the sti instruction works in the isr128 but it only works when sleep is called and that goes to the timer interrupts I also need my keyboard to work so when ever I press a key I can use it in the application