Multitasking stack switching problems
Posted: Sat Feb 17, 2024 8:40 pm
I'm having a problem with multitasking in my monolithic kernel. I have implemented pre-emptive multitasking using stack switching
where an IRQ 0 handler saves the registers onto the stack, calls switch_task and then restores the registers.
However, when switching from a second user-mode process back to the first, the stack values are not the saved values that
were saved when switching from the first to the second process.
It's been tested using two kernel-mode processes, and it works fine using the test code.
I would appreciate any input.
https://github.com/darkavengr/CCP/blob/ ... 86/pic.asm
https://github.com/darkavengr/CCP/blob/ ... /sched.asm
https://github.com/darkavengr/CCP/blob/ ... testcode.c
where an IRQ 0 handler saves the registers onto the stack, calls switch_task and then restores the registers.
However, when switching from a second user-mode process back to the first, the stack values are not the saved values that
were saved when switching from the first to the second process.
It's been tested using two kernel-mode processes, and it works fine using the test code.
I would appreciate any input.
https://github.com/darkavengr/CCP/blob/ ... 86/pic.asm
https://github.com/darkavengr/CCP/blob/ ... /sched.asm
https://github.com/darkavengr/CCP/blob/ ... testcode.c