interrupts in a monotasking kernel only OS

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.
GhostedGaming
Member
Member
Posts: 35
Joined: Wed Jul 02, 2025 11:46 pm
Libera.chat IRC: GhostedGaming

interrupts in a monotasking kernel only OS

Post 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.
GhostedGaming
Member
Member
Posts: 35
Joined: Wed Jul 02, 2025 11:46 pm
Libera.chat IRC: GhostedGaming

Re: interrupts in a monotasking kernel only OS

Post by GhostedGaming »

please review the code as well if you dont mind so you can understand what im saying
Octocontrabass
Member
Member
Posts: 6245
Joined: Mon Mar 25, 2013 7:01 pm

Re: interrupts in a monotasking kernel only OS

Post 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?
GhostedGaming
Member
Member
Posts: 35
Joined: Wed Jul 02, 2025 11:46 pm
Libera.chat IRC: GhostedGaming

Re: interrupts in a monotasking kernel only OS

Post by GhostedGaming »

It seems there's a pending keyboard interrupt in the pic but interrupts dont continue until the app returns
Octocontrabass
Member
Member
Posts: 6245
Joined: Mon Mar 25, 2013 7:01 pm

Re: interrupts in a monotasking kernel only OS

Post 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?
GhostedGaming
Member
Member
Posts: 35
Joined: Wed Jul 02, 2025 11:46 pm
Libera.chat IRC: GhostedGaming

Re: interrupts in a monotasking kernel only OS

Post by GhostedGaming »

The rflags show that interrupts are disabled but I dont understand why
Octocontrabass
Member
Member
Posts: 6245
Joined: Mon Mar 25, 2013 7:01 pm

Re: interrupts in a monotasking kernel only OS

Post by Octocontrabass »

Set a breakpoint before calling the app. Are interrupts enabled there?
GhostedGaming
Member
Member
Posts: 35
Joined: Wed Jul 02, 2025 11:46 pm
Libera.chat IRC: GhostedGaming

Re: interrupts in a monotasking kernel only OS

Post 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
Octocontrabass
Member
Member
Posts: 6245
Joined: Mon Mar 25, 2013 7:01 pm

Re: interrupts in a monotasking kernel only OS

Post by Octocontrabass »

Set a breakpoint right after the STI instruction. Are interrupts enabled there?
GhostedGaming
Member
Member
Posts: 35
Joined: Wed Jul 02, 2025 11:46 pm
Libera.chat IRC: GhostedGaming

Re: interrupts in a monotasking kernel only OS

Post by GhostedGaming »

Yes interrupts are enabled it seems that jumping to the entry of the application is causing interrupts to be disabled but how?
Octocontrabass
Member
Member
Posts: 6245
Joined: Mon Mar 25, 2013 7:01 pm

Re: interrupts in a monotasking kernel only OS

Post by Octocontrabass »

Have you tried stepping through the instructions that execute at the entry point?
GhostedGaming
Member
Member
Posts: 35
Joined: Wed Jul 02, 2025 11:46 pm
Libera.chat IRC: GhostedGaming

Re: interrupts in a monotasking kernel only OS

Post 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
User avatar
bellezzasolo
Member
Member
Posts: 163
Joined: Sun Feb 20, 2011 2:01 pm

Re: interrupts in a monotasking kernel only OS

Post 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.
Whoever said you can't do OS development on Windows?
https://github.com/ChaiSoft/ChaiOS
GhostedGaming
Member
Member
Posts: 35
Joined: Wed Jul 02, 2025 11:46 pm
Libera.chat IRC: GhostedGaming

Re: interrupts in a monotasking kernel only OS

Post by GhostedGaming »

I removed the sti instruction in the 128
GhostedGaming
Member
Member
Posts: 35
Joined: Wed Jul 02, 2025 11:46 pm
Libera.chat IRC: GhostedGaming

Re: interrupts in a monotasking kernel only OS

Post 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
Post Reply