From: Ian Campbell Subject: [PATCH 3/3] xen: arm: handle thumb mode guest in continuations Date: Wed, 25 Mar 2015 15:34:20 +0000 Message-ID: <1427297660-26447-3-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org PC only needs adjusting by 2, otherwise we rerun the instruction prior to the hvc as well. hvc is unpredictable if used within a Thumb IT (conditional execution) block, so we don't need to worry about rewinding any of that state. Signed-off-by: Ian Campbell --- Should be backported --- xen/arch/arm/domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 10f13e4..2d2197e 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -387,10 +387,11 @@ unsigned long hypercall_create_continuation( else #endif { + int is_thumb = (regs->cpsr & PSR_THUMB); regs->r12 = op; /* Ensure the hypercall trap instruction is re-executed. */ - regs->pc -= 4; /* re-execute 'hvc #XEN_HYPERCALL_TAG' */ + regs->pc -= is_thumb?2:4; /* re-execute 'hvc #XEN_HYPERCALL_TAG' */ for ( i = 0; *p != '\0'; i++ ) { -- 1.7.10.4