problem in multitasking theory

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.
Post Reply
User avatar
Jef
Member
Member
Posts: 112
Joined: Tue Jan 08, 2008 7:25 am
Location: Greece
Contact:

problem in multitasking theory

Post 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
Keep coding...
...the sky is the limit

AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
User avatar
Jef
Member
Member
Posts: 112
Joined: Tue Jan 08, 2008 7:25 am
Location: Greece
Contact:

Re: problem in multitasking theory

Post 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?
Keep coding...
...the sky is the limit

AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post 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
User avatar
Jef
Member
Member
Posts: 112
Joined: Tue Jan 08, 2008 7:25 am
Location: Greece
Contact:

Post 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.
Keep coding...
...the sky is the limit

AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post 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
User avatar
Jef
Member
Member
Posts: 112
Joined: Tue Jan 08, 2008 7:25 am
Location: Greece
Contact:

Post 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
Keep coding...
...the sky is the limit

AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
Post Reply