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
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

TSS

Post by yemista »

Do you need to setup a dummy TSS to make sure everything in pmode works properly? I never bothered with one and I am experiencing strange problems, and dont know if maybe this could be contributing.
giszo
Member
Member
Posts: 124
Joined: Tue Nov 06, 2007 2:37 pm
Location: Hungary

Re: TSS

Post by giszo »

You only need a TSS if you switch between different privilege levels.
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: TSS

Post by JohnnyTheDon »

You also need one if you ever want to use interrupts (and you will want to use interrupts for keyboard and other drivers).
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: TSS

Post by yemista »

What would happen if an interrupt occured and you had everything setup except a TSS? Would you get a segmentation fault?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: TSS

Post by AJ »

Hi,

You would only have a problem if the interrupt happens in ring 3. Whether you would get an invalid TSS or GPF exception, I can't be bothered to look up at the moment, but you can find all this info in the Intel Manuals.

Cheers,
Adam
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: TSS

Post by Combuster »

If you're in ring 3 without a TSS, you'll get a triple fault the moment the processor tries to get out of ring 3. (on practically all usable setups, that is)
"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 ]
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: TSS

Post by jal »

yemista wrote:Do you need to setup a dummy TSS to make sure everything in pmode works properly? I never bothered with one and I am experiencing strange problems, and dont know if maybe this could be contributing.
To sum up what everyone says above:

- you do not need a TSS when you are not switching between rings
- you do need a TSS when you are switching between rings
- you will be switching rings when you are in ring 3, and an interrupt occurs

The CPU needs the TSS to set the SS:ESP registers for the ring 0 (or other non-ring 3) stack.


JAL
User avatar
qw
Member
Member
Posts: 792
Joined: Mon Jan 26, 2009 2:48 am

Re: TSS

Post by qw »

jal wrote:you will be switching rings when you are in ring 3, and an interrupt occurs
Not necessarily. The interrupt service routine could be in ring 3 too, couldn't it?

Roel
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: TSS

Post by Combuster »

An argument which boils down to "Not if we have this hypothetical and impractical setup nobody sane would dare to use".

Yes you are right.
"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 ]
User avatar
qw
Member
Member
Posts: 792
Joined: Mon Jan 26, 2009 2:48 am

Re: TSS

Post by qw »

Combuster wrote:An argument which boils down to "Not if we have this hypothetical and impractical setup nobody sane would dare to use".

Yes you are right.
Point taken!

It's nice to be right every now and then...

Roel
Post Reply