Skip to contentSkip to conversation

rsp in case of interrupt/exception in ring0

help Mukesh Rathor 2 participants 3 messages Feb 24, 2010 – Feb 25, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

can someone help me understand this.

When a cpu is in hyp code and int/exception comes in, how/where is rsp saved? According to intel manual if there's no ring transition, then the cpu doesn't save ss/rsp.

Following trail from entry.S to show_registers(), I don't see where regs->rsp is loaded, yet show_registers() displays it happily. show_stack() uses it.

This also means that regs->rsp is actually going to prev frame where orig hyp function was executing.

thanks,
Mukesh

#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Mukesh Rathor <[email protected]> 24.02.10 04:39 >>>

When a cpu is in hyp code and int/exception comes in, how/where is rsp saved? According to intel manual if there's no ring transition, then the cpu doesn't save ss/rsp.

As you're apparently talking about x86-64, you probably simply read the wrong (32-bit) part of the manual. On 64-bits, ss:rsp are always getting saved, no matter whether there's a ring transition.

Jan

#2 lore raw
Quoted 9 lines · On Wed, 24 Feb 2010 08:35:31 +0000 "Jan Beulich" <[email protected]> wrote:
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Mukesh Rathor <[email protected]> 24.02.10 04:39 >>>

When a cpu is in hyp code and int/exception comes in, how/where is rsp saved? According to intel manual if there's no ring transition, then the cpu doesn't save ss/rsp.

As you're apparently talking about x86-64, you probably simply read the wrong (32-bit) part of the manual. On 64-bits, ss:rsp are always getting saved, no matter whether there's a ring transition.

You are right, few pages later, it talks about 64. Usually, they'll say something about things being different on 64bit. Anyways. I'll email intel docs to fix it...

thanks,
Mukesh