From: Tim Deegan Date: Fri, 1 Jun 2012 09:20:38 +0000 (+0100) Subject: arm: avoid memory write in switch to Hyp mode X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~8361 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a5d4640b92ce673773dcdb102b4d35be6f58b129;p=xen.git arm: avoid memory write in switch to Hyp mode 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 Acked-by: Ian Campbell Committed-by: Ian Campbell --- diff --git a/xen/arch/arm/mode_switch.S b/xen/arch/arm/mode_switch.S index 71a21e71e6..3a70b9cad4 100644 --- a/xen/arch/arm/mode_switch.S +++ b/xen/arch/arm/mode_switch.S @@ -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 */