From: "Jan Beulich" Subject: Re: Stack switching in a PV guest Date: Fri, 20 Dec 2013 15:48:53 +0000 Message-ID: <52B474F5020000780010FA1E@nat28.tlf.novell.com> References: <52B46677020000780010F9BC@nat28.tlf.novell.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 16:10, "Simon Martin" wrote: >>I'm afraid I'm missing some context here. What is a "hypercall stack"? > Hmm. When I look at the stack frame it's not what I expected, so I > assumed that the hypervisor was assigning a stack. Means I've got > another bug. > >>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. > Probably a knock on from the problem I am seeing above then. I've > searched around for examples of HYPERVISOR_stack_switch usage, but I > can't find anything. I can find the declaration and handler in the Xen > source and however no example of making it work. Is there anything you > can point me to to see how it was intended to be used? As to the implementation - look for do_stack_switch() in xen/arch/x86/x86_64/mm.c. As for usage examples, see current Linux'es {HYPERVISOR,MULTI}_stack_switch() in arch/x86/include/asm/xen/hypercall.h or __switch_to() in linux-2.6.18-xen.hg's arch/x86_64/kernel/process-xen.c. Jan