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

[Xen-changelog] [xen master] xen: arm: pcpu context switch



commit 2ab89f356c513761ec077f4f302e3493393192ed
Author:     Ian Campbell <ian.campbell@xxxxxxxxxx>
AuthorDate: Fri Feb 22 08:58:07 2013 +0000
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Fri Feb 22 12:14:54 2013 +0000

    xen: arm: pcpu context switch
    
    Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Acked-by: Tim Deegan <tim@xxxxxxx>
---
 xen/arch/arm/arm64/entry.S   |   30 ++++++++++++++++++++++++++++++
 xen/arch/arm/domain.c        |    4 ++--
 xen/include/asm-arm/domain.h |   33 +++++++++++++++++++++++----------
 3 files changed, 55 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index e35b6ea..9d38088 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -247,6 +247,36 @@ ENTRY(hyp_traps_vector)
         ventry  guest_error_invalid_compat      // Error 32-bit EL0/EL1
 
 /*
+ * struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next)
+ *
+ * x0 - prev
+ * x1 - next
+ *
+ * Returns prev in x0
+ */
+ENTRY(__context_switch)
+        add     x8, x0, #VCPU_arch_saved_context
+        mov     x9, sp
+        stp     x19, x20, [x8], #16             // store callee-saved registers
+        stp     x21, x22, [x8], #16
+        stp     x23, x24, [x8], #16
+        stp     x25, x26, [x8], #16
+        stp     x27, x28, [x8], #16
+        stp     x29, x9, [x8], #16
+        str     lr, [x8]
+
+        add     x8, x1, #VCPU_arch_saved_context
+        ldp     x19, x20, [x8], #16             // restore callee-saved 
registers
+        ldp     x21, x22, [x8], #16
+        ldp     x23, x24, [x8], #16
+        ldp     x25, x26, [x8], #16
+        ldp     x27, x28, [x8], #16
+        ldp     x29, x9, [x8], #16
+        ldr     lr, [x8]
+        mov     sp, x9
+        ret
+
+/*
  * Local variables:
  * mode: ASM
  * indent-tabs-mode: nil
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 3d21f0e..883a681 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -387,8 +387,8 @@ int vcpu_initialise(struct vcpu *v)
                                            - sizeof(struct cpu_info));
 
     memset(&v->arch.saved_context, 0, sizeof(v->arch.saved_context));
-    v->arch.saved_context.sp = (uint32_t)v->arch.cpu_info;
-    v->arch.saved_context.pc = (uint32_t)continue_new_vcpu;
+    v->arch.saved_context.sp = (register_t)v->arch.cpu_info;
+    v->arch.saved_context.pc = (register_t)continue_new_vcpu;
 
     /* Idle VCPUs don't need the rest of this setup */
     if ( is_idle_vcpu(v) )
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 4e9d38d..f691c26 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -99,16 +99,29 @@ struct vtimer {
 struct arch_vcpu
 {
     struct {
-        uint32_t    r4;
-        uint32_t    r5;
-        uint32_t    r6;
-        uint32_t    r7;
-        uint32_t    r8;
-        uint32_t    r9;
-        uint32_t    sl;
-        uint32_t    fp;
-        uint32_t    sp;
-        uint32_t    pc;
+#ifdef CONFIG_ARM_32
+        register_t r4;
+        register_t r5;
+        register_t r6;
+        register_t r7;
+        register_t r8;
+        register_t r9;
+        register_t sl;
+#else
+        register_t x19;
+        register_t x20;
+        register_t x21;
+        register_t x22;
+        register_t x23;
+        register_t x24;
+        register_t x25;
+        register_t x26;
+        register_t x27;
+        register_t x28;
+#endif
+        register_t fp;
+        register_t sp;
+        register_t pc;
     } saved_context;
 
     void *stack;
--
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®.