OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Nov 21, 2017 11:29 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Use TSS only for stack switching
PostPosted: Sun Oct 15, 2017 9:30 am 
Offline
Member
Member
User avatar

Joined: Sat May 20, 2017 1:25 am
Posts: 50
Location: On your computer!
I now that TSS is using for task switching but can I use it only for stack switching? If yes Do I need to set anything else except from "ss0" and "esp0" values to it? Which of the other values will change the processor behavior? Alos which of them are sitting by the processor and when (on task switching)? I am asking because I thought because my kernel functions will not push more than 8 bytes at the same time can that use the "eax","ebx",... positions as the stack, can I?

_________________
The human mind works like a multicore cpu but because it never upgrades to a newer os than the common logic, that run right now and that does not support multicore execustion, it will never find the absolute concentration!


Top
 Profile  
 
 Post subject: Re: Use TSS only for stack switching
PostPosted: Sun Oct 15, 2017 10:52 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 373
Yes, just set the ESP and SS values.

There is a single cases where you need to use hardware context switching, even when your OS performs software context switching during normal operation, and that is the NMI and MCE handlers (when using the syscall instruction). The reason for that is that hardware switching can atomically change the stack even when there is no ring transition. syscall requires you to manually switch to the user mode stack while you're still in supervisor mode. After you did that, NMIs and MCEs will run on this user mode stack if they are not handled by a task gate.


Top
 Profile  
 
 Post subject: Re: Use TSS only for stack switching
PostPosted: Sun Oct 15, 2017 11:58 am 
Offline
Member
Member
User avatar

Joined: Sat May 20, 2017 1:25 am
Posts: 50
Location: On your computer!
Korona wrote:
Yes, just set the ESP and SS values.

There is a single cases where you need to use hardware context switching, even when your OS performs software context switching during normal operation, and that is the NMI and MCE handlers (when using the syscall instruction). The reason for that is that hardware switching can atomically change the stack even when there is no ring transition. syscall requires you to manually switch to the user mode stack while you're still in supervisor mode. After you did that, NMIs and MCEs will run on this user mode stack if they are not handled by a task gate.


I will not use the syscall instruction, I will have not any problem, will I have (maybe something that I didn't understand)?

_________________
The human mind works like a multicore cpu but because it never upgrades to a newer os than the common logic, that run right now and that does not support multicore execustion, it will never find the absolute concentration!


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 7 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