What is the purpose of the RSPn in a 64-bit 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
madanra
Member
Member
Posts: 149
Joined: Mon Sep 07, 2009 12:01 pm

What is the purpose of the RSPn in a 64-bit TSS?

Post by madanra »

The AMD manual says:
RSPn—Bytes 1Bh–04h. The full 64-bit canonical forms of the stack pointers (RSP) for privilege levels 0 through 2.
but I haven't (yet) found anywhere that these values are actually used for anything. What are the RSPn for?
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: What is the purpose of the RSPn in a 64-bit TSS?

Post by Combuster »

The SPx values in the TSS hold the stack pointer for when a higher privilege is entered. (userspace should not be able to dictate where the kernel stack 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 ]
madanra
Member
Member
Posts: 149
Joined: Mon Sep 07, 2009 12:01 pm

Re: What is the purpose of the RSPn in a 64-bit TSS?

Post by madanra »

Aaaah, I have found my misunderstanding of the AMD manual: I had only read the information about 64-bit interrupt stack switching, not the 32-bit, and when it said legacy stack switching mechanism was used for IST=0, I assumed that was 'leave stack as it is' for some reason...looking now at the 32-bit interrupt stack switching it *does* explain how the ESPn are used in 32-bit mode, and hence RSPn in 64-bit mode! Thanks!
Post Reply