Page 1 of 1
problem in multitasking theory
Posted: Sun Jan 13, 2008 1:50 am
by Jef
My multitasking theory works like this:
Is this correct?
Have I set/change TSS offset (looking in new task) in gdt?
If i am doing like this, i take an 0Dh exception once
EDIT: when i restore the GS register
while booting...
setups os_loop task
setups Clock_loop task
finally: jmp $
os_loop:
checks mouse, keyboard events
updates vga
jmp os_loop
clock_loop:
prints clock
jmp clock_loop
irq0:
saves old registers
load new registers
iretd
Re: problem in multitasking theory
Posted: Sun Jan 13, 2008 7:34 am
by Jef
Jef wrote:If i am doing like this, i take an 0Dh exception once
EDIT: when i restore the GS register
My mistake. I forgot to init GS on creating tasks. fixed.
Now working ok.
But i don't use TSS descriptor (and LTR command).
Is this used only when you use hardware multitasking?
Posted: Sun Jan 13, 2008 8:44 am
by AJ
Hi,
Yes - you will need to use LTR at least once per processor core if you want to be able to switch privilege level in the future. If you have your ring 0 stacks at the same location in virtual RAM, you can then forget about the TSS.
Cheers,
Adam
Posted: Sun Jan 13, 2008 4:30 pm
by Jef
AJ wrote:Hi,
Yes - you will need to use LTR at least once per processor core if you want to be able to switch privilege level in the future. If you have your ring 0 stacks at the same location in virtual RAM, you can then forget about the TSS.
Cheers,
Adam
right now i have only ring 0, and i am not using paging yet.
I want to put paging in my memory manager soon.
But i will keep all in ring 0 for now.
Posted: Mon Jan 14, 2008 3:04 am
by AJ
Fine - most people just get happy with ring 0 first. Once you need ring 3, it's really easy to add to your existing code. Simply:
1. Initialise the TSS and do an LTR in your run-once multitasking initialisation routine. You can load ESP0 here if you like.
2. If applicable, set ESP0 each time you switch task. Skip this step if you are using the paging method.
Good luck with the paging.
Cheers,
Adam
Posted: Mon Jan 14, 2008 3:58 am
by Jef
AJ wrote:Fine - most people just get happy with ring 0 first. Once you need ring 3, it's really easy to add to your existing code. Simply:
1. Initialise the TSS and do an LTR in your run-once multitasking initialisation routine. You can load ESP0 here if you like.
2. If applicable, set ESP0 each time you switch task. Skip this step if you are using the paging method.
Good luck with the paging.
Cheers,
Adam
thanx