OSDev.org

The Place to Start for Operating System Developers
It is currently Sat May 18, 2024 8:56 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: problem in multitasking theory
PostPosted: Sun Jan 13, 2008 1:50 am 
Offline
Member
Member
User avatar

Joined: Tue Jan 08, 2008 7:25 am
Posts: 112
Location: Greece
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


Top
 Profile  
 
 Post subject: Re: problem in multitasking theory
PostPosted: Sun Jan 13, 2008 7:34 am 
Offline
Member
Member
User avatar

Joined: Tue Jan 08, 2008 7:25 am
Posts: 112
Location: Greece
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 13, 2008 8:44 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 13, 2008 4:30 pm 
Offline
Member
Member
User avatar

Joined: Tue Jan 08, 2008 7:25 am
Posts: 112
Location: Greece
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 14, 2008 3:04 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 14, 2008 3:58 am 
Offline
Member
Member
User avatar

Joined: Tue Jan 08, 2008 7:25 am
Posts: 112
Location: Greece
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], wishedtobe and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group