|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 29/45] xen: arm: pcpu context switch
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
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 c8f801e..064b332 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -238,6 +238,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 a1b86d4..077521e 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -383,8 +383,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 4e6d4bb..cf75f25 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -100,16 +100,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;
--
1.7.2.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |