Hello!
I'm near to start coding my software multitasking code.
For the scheduler I'll use the simple Round-robin algorithm, and in each Timer call (10ms), I'll save the actual registers and I'll load the registers from next task. (no tss)
But I think I have a problem.
AFAIK VM86 mode runs always in ring 3, so if I set up a V86 monitor that will execute the Vesa mode-switching code, how do I switch to different rings task with software multitasking?
To set a ring 3 task, Will I need a TSS per task?
Also, does anyone knows what happened to SANiK and its idea to convert 16 to 32 bits code on the fly? (http://www.osdev.org/phpBB2/viewtopic.php?t=10321 )
Thanks,
Gonzalo
Some questions about multitasking and VM86
Re: Some questions about multitasking and VM86
Hi,
The only difference is the IRQ handler's stack frame (if the IRQ interrupts V86 code you get segment registers pushed on the stack), but this is irrelevant because sometimes you'll want to switch tasks without waiting for the IRQ handler first (e.g. when a task decides to "sleep()"), so you can't rely on the IRQ handler's stack frame within the task switching code.
Cheers,
Brendan
The timer IRQ will cause the CPU to switch to CPL=0 regardless of which mode and which privilege it was running at before the IRQ. Your task switching code will always be running CPL=0 kernel code before the task switch and will be running CPL=0 kernel code after the task switch.gzaloprgm wrote:AFAIK VM86 mode runs always in ring 3, so if I set up a V86 monitor that will execute the Vesa mode-switching code, how do I switch to different rings task with software multitasking?
The only difference is the IRQ handler's stack frame (if the IRQ interrupts V86 code you get segment registers pushed on the stack), but this is irrelevant because sometimes you'll want to switch tasks without waiting for the IRQ handler first (e.g. when a task decides to "sleep()"), so you can't rely on the IRQ handler's stack frame within the task switching code.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
-
- Member
- Posts: 391
- Joined: Wed Jul 25, 2007 8:45 am
- Libera.chat IRC: aejsmith
- Location: London, UK
- Contact:
Re: Some questions about multitasking and VM86
You just need one TSS. Set esp0 and ss0 in it to a kernel stack pointer and kernel stack segment.gzaloprgm wrote:To set a ring 3 task, Will I need a TSS per task?