Switching out TSS

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
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Switching out TSS

Post by NickJohnson »

In the current design of my OS, processes (or the kernel) are able to send "signals" to other processes - simple, synchronous, one way messages that preempt the receiver's current state. It is possible to have a signal preempt another signal's currently running signal handler.

The issue is that I can't get stuff to preempt, because the TSS's esp0 value is static, and the same, for all processes. The address of the TSS's esp0 points to a small stack used to save the process image, which I need to act as a stack of process images.

Regardless of if you understand what is happening, the point is that I want to be able to change the TSS's esp0 value on a process-by-process basis. This involves setting the TSS entry in the GDT to some area of memory that is switched out with each process. However, I do not and do not want to use the x86's hardware task switching. Is this possible, or do I have to come up with some other method?
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Re: Switching out TSS

Post by frank »

My interrupt routine just patches the esp0 in the TSS for each task switch. That way there is always a valid esp0 in the TSS when a user thread is running.
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Switching out TSS

Post by xenos »

My (software based) task switcher does the same stuff that frank's task switcher does. The esp0 value is stored in the process structure and entered into the TSS on every task switch.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
Post Reply