From: "Jan Beulich" Subject: Re: Stack switching in a PV guest Date: Fri, 20 Dec 2013 14:47:02 +0000 Message-ID: <52B46677020000780010F9BC@nat28.tlf.novell.com> References: <1351251014.20131216115608@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Simon Martin Cc: Ian Campbell , xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 20.12.13 at 15:12, "Simon Martin" wrote: > However, I now have a different problem. I am running my context switch > off of a single shot timer. When the timer fires Xen transfers control > to my PV guest via the hypercall_callback. > > The hypercall_callback handler stores the current CPU register file, > however the stored rsp always points to the hypercall stack, not the > stack that was active in my PV at the moment the timer event fired. I'm afraid I'm missing some context here. What is a "hypercall stack"? > I need to store the PV stack pointer so I can recover it later when my > scheduler activates it. I have looked back up the stack and I don't > really see where my active stack pointer is. Any idea where I can get > it? The callback gets invoked much like other exceptions would be, with a normal exception entry stack frame. The stack pointer would be there (RCX, R11, RIP, CS, EFLAGS, RSP, SS) just as normal. Jan