When do I first need a 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
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

When do I first need a TSS?

Post by linguofreak »

From what I'm reading on the Wiki, it looks like I don't need a TSS until I transition to user mode, and thus kernel-mode-only code, such as boot code, should be fine without one.

However, I picked this up by reading between the lines (the Wiki says I need a TSS for interrupts in user mode, but doesn't say anything about whether I need one for interrupts in kernel mode, and I'm assuming that the fact that nothing is said about kernel mode means a TSS isn't needed there), so I'm uncertain that I haven't overlooked something.

So have I interpreted things correctly, or is there something waiting to bite me in the rear if I enable interrupts without a TSS in ring 0?
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: When do I first need a TSS?

Post by bluemoon »

Let me put it another way, without a proper TSS the CPU will fault (#TS) when:
- switch between ring
- perform hardware task switch (jmp, trap, etc)

So it should be fine without TSS for a ring0 only system.
However, my advise is to setup a dummy TSS anyway, it's only a few line of code.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: When do I first need a TSS?

Post by Gigasoft »

You need a TSS for the Double Fault handler, if you have one. Therefore, you also need a default TSS.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: When do I first need a TSS?

Post by Combuster »

You don't need a TSS there. In case of the doublefault, it only gives you more time to crash.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
fifo
Posts: 7
Joined: Wed May 30, 2012 4:37 pm

Re: When do I first need a TSS?

Post by fifo »

Even if you stay with RING0, there are times where you need a known good stack. Of course it can be double fault.

I have implemented the equivalent of try { } catch {} in RING0. If I get a stack fault in one RING0 thread, I can just kill this thread and then trigger an orderly shutdown.

I guess there are also issues with using SSE instructions without TSS but I am not too sure.
Post Reply