]> xenbits.xensource.com Git - people/vhanquez/xen-unstable.git/commitdiff
arm: avoid memory write in switch to Hyp mode
authorTim Deegan <tim@xen.org>
Fri, 1 Jun 2012 09:20:38 +0000 (10:20 +0100)
committerTim Deegan <tim@xen.org>
Fri, 1 Jun 2012 09:20:38 +0000 (10:20 +0100)
Assemble the new CPSR in registers instead.  It's slightly cleaner,
And makes it possible to have a read-only text section.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/mode_switch.S

index 71a21e71e6b79f5667550435b96a6ae8eabd5db6..3a70b9cad45040483637a8e9c1e7e6e2fc08ca89 100644 (file)
@@ -66,11 +66,7 @@ enter_hyp_mode:
        mcr   CP32(r0, FCSEIDR)
        mcr   CP32(r0, CONTEXTIDR)
        /* FIXME: ought to reset some other NS control regs here */
-       adr   r1, 1f                 /* Store return address */
-       str   r3, [r1]               /* where we can use it for RFE */
-       isb                          /* Ensure we see the stored address */
-       rfeia r1                     /* Enter Hyp mode */
-
-1:     .word 0                      /* PC to enter Hyp mode at */
-       .word 0x000001da             /* CPSR: LE, Abort/IRQ/FIQ off, Hyp */
-
+       mrs   r0, cpsr               /* Copy the CPSR */
+       add   r0, r0, #0x4           /* 0x16 (Monitor) -> 0x1a (Hyp) */
+       msr   spsr_cxsf, r0          /* into the SPSR */
+       movs  pc, r3                 /* Exception-return into Hyp mode */