[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen: arm: handle traps from 64-bit guests



commit b068e6a63c116889197dd6d7409fd8f5bec6d110
Author:     Ian Campbell <ian.campbell@xxxxxxxxxx>
AuthorDate: Mon Jul 29 13:21:01 2013 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Mon Jul 29 16:54:50 2013 +0100

    xen: arm: handle traps from 64-bit guests
    
    While there observe that we weren't ever restoring the outer stack frame, 
even
    for 32-bit guests when running a 64-bit hypervisor! The outer stack frame
    "only" contains most of the SPSR registers for 32-bit...
    
    Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Acked-by: Tim Deegan <tim@xxxxxxx>
---
 xen/arch/arm/arm64/entry.S |   43 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index 390a11d..9cda8f1 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -56,6 +56,38 @@ lr      .req    x30             // link register
 
         .endm
 
+        .macro  exit_guest, compat
+
+        add     x21, sp, #UREGS_SPSR_el1
+        ldr     x23, [x21]
+        msr     SPSR_el1, x23
+
+        .if \compat == 0 /* Aarch64 mode */
+
+        add     x21, sp, #UREGS_SP_el0
+        ldr     x22, [x21]
+        msr     SP_el0, x22
+
+        add     x21, sp, #UREGS_SP_el1
+        ldp     x22, x23, [x21]
+        msr     SP_el1, x22
+        msr     ELR_el1, x23
+
+        .else            /* Aarch32 mode */
+
+        add     x21, sp, #UREGS_SPSR_fiq
+        ldp     w22, w23, [x21]
+        msr     SPSR_fiq, x22
+        msr     SPSR_irq, x23
+
+        add     x21, sp, #UREGS_SPSR_und
+        ldp     w22, w23, [x21]
+        msr     SPSR_und, x22
+        msr     SPSR_abt, x23
+
+        .endif
+
+        .endm
 /*
  * Save state on entry to hypervisor, restore on exit
  */
@@ -102,6 +134,8 @@ lr      .req    x30             // link register
 
         bl      leave_hypervisor_tail /* Disables interrupts on return */
 
+        exit_guest \compat
+
         .endif
 
         b       return_from_trap
@@ -155,11 +189,16 @@ hyp_irq:
 
 guest_sync:
         entry   hyp=0, compat=0
-        invalid BAD_SYNC /* No AArch64 guest support yet */
+        msr     daifclr, #2
+        mov     x0, sp
+        bl      do_trap_hypervisor
+        exit    hyp=0, compat=0
 
 guest_irq:
         entry   hyp=0, compat=0
-        invalid BAD_IRQ /* No AArch64 guest support yet */
+        mov     x0, sp
+        bl      do_trap_irq
+        exit    hyp=0, compat=0
 
 guest_fiq_invalid:
         entry   hyp=0, compat=0
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.