* [PATCH 3/3] xen: arm: handle thumb mode guest in continuations
@ 2015-03-25 15:34 Ian Campbell
2015-03-25 23:33 ` Julien Grall
0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2015-03-25 15:34 UTC (permalink / raw)
To: xen-devel; +Cc: julien.grall, tim, Ian Campbell, stefano.stabellini
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 <ian.campbell@citrix.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 3/3] xen: arm: handle thumb mode guest in continuations
2015-03-25 15:34 [PATCH 3/3] xen: arm: handle thumb mode guest in continuations Ian Campbell
@ 2015-03-25 23:33 ` Julien Grall
2015-03-26 10:06 ` Ian Campbell
0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2015-03-25 23:33 UTC (permalink / raw)
To: Ian Campbell, xen-devel; +Cc: tim, stefano.stabellini
Hi Ian,
On 25/03/2015 15:34, Ian Campbell wrote:
> PC only needs adjusting by 2, otherwise we rerun the instruction prior
> to the hvc as well.
I don't understand why you have to adjust PC by 2 for thumb.
The spec encodes the HVC thumb instruction on 32 bits (i.e 4 bytes).
Regards,
--
Julien Grall
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/3] xen: arm: handle thumb mode guest in continuations
2015-03-25 23:33 ` Julien Grall
@ 2015-03-26 10:06 ` Ian Campbell
0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2015-03-26 10:06 UTC (permalink / raw)
To: Julien Grall; +Cc: stefano.stabellini, tim, xen-devel
On Wed, 2015-03-25 at 23:33 +0000, Julien Grall wrote:
> Hi Ian,
>
> On 25/03/2015 15:34, Ian Campbell wrote:
> > PC only needs adjusting by 2, otherwise we rerun the instruction prior
> > to the hvc as well.
>
> I don't understand why you have to adjust PC by 2 for thumb.
> The spec encodes the HVC thumb instruction on 32 bits (i.e 4 bytes).
I was confused by Encoding T1 in the ARMv7 ARM B9.3.4 which has a 15 at
the left most column, but actually it is 15..0,15..0, doh!
So we are fine here. I'll drop this patch and pull the regs->pc frobbing
in the previous patch back out of the if into the common bit.
Ian.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-26 10:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-25 15:34 [PATCH 3/3] xen: arm: handle thumb mode guest in continuations Ian Campbell
2015-03-25 23:33 ` Julien Grall
2015-03-26 10:06 ` Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.