[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [RFC PATCH 10/17] PowerPC: booke64: Refactor exception prolog
From: |
Mihai Caraman |
Subject: |
[Qemu-ppc] [RFC PATCH 10/17] PowerPC: booke64: Refactor exception prolog for save/restore regs |
Date: |
Mon, 25 Jun 2012 15:26:28 +0300 |
Refactor exception prolog to allow save/restore register parameters. Add
addition none definition for exception prolog usage.
This is needed for exceptions like Guest Doorbell that use GSRRx regsiters
which do not map on exception type.
Signed-off-by: Mihai Caraman <address@hidden>
---
arch/powerpc/kernel/exceptions-64e.S | 23 ++++++++---------------
1 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/kernel/exceptions-64e.S
b/arch/powerpc/kernel/exceptions-64e.S
index 7215cc2..52aa96b 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -35,7 +35,7 @@
#define SPECIAL_EXC_FRAME_SIZE INT_FRAME_SIZE
/* Exception prolog code for all exceptions */
-#define EXCEPTION_PROLOG(n, type, addition) \
+#define EXCEPTION_PROLOG(n, type, srr0, srr1, addition)
\
mtspr SPRN_SPRG_##type##_SCRATCH,r13; /* get spare registers */ \
mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \
std r10,PACA_EX##type+EX_R10(r13); \
@@ -44,54 +44,47 @@
addition; /* additional code for that exc. */ \
std r1,PACA_EX##type+EX_R1(r13); /* save old r1 in the PACA */ \
stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \
- mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \
+ mfspr r11,srr1;/* what are we coming from */ \
type##_SET_KSTACK; /* get special stack if necessary */\
andi. r10,r11,MSR_PR; /* save stack pointer */ \
beq 1f; /* branch around if supervisor */ \
ld r1,PACAKSAVE(r13); /* get kernel stack coming from usr */\
1: cmpdi cr1,r1,0; /* check if SP makes sense */ \
bge- cr1,exc_##n##_bad_stack;/* bad stack (TODO: out of line) */ \
- mfspr r10,SPRN_##type##_SRR0; /* read SRR0 before touching stack */
+ mfspr r10,srr0; /* read SRR0 before touching stack */
/* Exception type-specific macros */
#define GEN_SET_KSTACK
\
subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */
-#define SPRN_GEN_SRR0 SPRN_SRR0
-#define SPRN_GEN_SRR1 SPRN_SRR1
#define CRIT_SET_KSTACK
\
ld r1,PACA_CRIT_STACK(r13); \
subi r1,r1,SPECIAL_EXC_FRAME_SIZE;
-#define SPRN_CRIT_SRR0 SPRN_CSRR0
-#define SPRN_CRIT_SRR1 SPRN_CSRR1
#define DBG_SET_KSTACK \
ld r1,PACA_DBG_STACK(r13); \
subi r1,r1,SPECIAL_EXC_FRAME_SIZE;
-#define SPRN_DBG_SRR0 SPRN_DSRR0
-#define SPRN_DBG_SRR1 SPRN_DSRR1
#define MC_SET_KSTACK \
ld r1,PACA_MC_STACK(r13); \
subi r1,r1,SPECIAL_EXC_FRAME_SIZE;
-#define SPRN_MC_SRR0 SPRN_MCSRR0
-#define SPRN_MC_SRR1 SPRN_MCSRR1
#define NORMAL_EXCEPTION_PROLOG(n, addition) \
- EXCEPTION_PROLOG(n, GEN, addition##_GEN(n))
+ EXCEPTION_PROLOG(n, GEN, SPRN_SRR0, SPRN_SRR1, addition##_GEN(n))
#define CRIT_EXCEPTION_PROLOG(n, addition) \
- EXCEPTION_PROLOG(n, CRIT, addition##_CRIT(n))
+ EXCEPTION_PROLOG(n, CRIT, SPRN_CSRR0, SPRN_CSRR1, addition##_CRIT(n))
#define DBG_EXCEPTION_PROLOG(n, addition) \
- EXCEPTION_PROLOG(n, DBG, addition##_DBG(n))
+ EXCEPTION_PROLOG(n, DBG, SPRN_DSRR0, SPRN_DSRR1, addition##_DBG(n))
#define MC_EXCEPTION_PROLOG(n, addition) \
- EXCEPTION_PROLOG(n, MC, addition##_MC(n))
+ EXCEPTION_PROLOG(n, MC, SPRN_MCSRR0, SPRN_MCSRR1, addition##_MC(n))
/* Variants of the "addition" argument for the prolog
*/
+#define PROLOG_ADDITION_NONE
#define PROLOG_ADDITION_NONE_GEN(n)
#define PROLOG_ADDITION_NONE_CRIT(n)
#define PROLOG_ADDITION_NONE_DBG(n)
--
1.7.4.1
- [Qemu-ppc] [RFC PATCH 00/17] KVM: PPC: 64-bit Book3E support, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 16/17] KVM: PPC: e500: Silence bogus GCC warning in tlb code, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 01/17] KVM: PPC64: booke: Set interrupt computation mode for 64-bit host, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 17/17] KVM: PPC: booke: Fix get_tb() compile error on 64-bit, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 15/17] KVM: PPC64: bookehv: Add support for interrupt handling, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 14/17] KVM: PPC32: bookehv: Remove GET_VCPU macro from exception handler, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 06/17] KVM: PPC: e500: Add emulation helper for getting instruction ea, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 10/17] PowerPC: booke64: Refactor exception prolog for save/restore regs,
Mihai Caraman <=
- [Qemu-ppc] [RFC PATCH 13/17] PowerPC: booke64: Use SPRG0/3 scratch for bolted TLB miss & crit int, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 11/17] PowerPC: booke64: Fix machine check handler to use the right prolog, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 02/17] KVM: PPC64: booke: Add EPCR support in mtspr/mfspr emulation, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 08/17] KVM: PPC: e500mc: Fix tlbilx emulation for 64-bit guests, Mihai Caraman, 2012/06/25
- [Qemu-ppc] [RFC PATCH 05/17] KVM: PPC: booke: Extend MAS2 EPN mask for 64-bit, Mihai Caraman, 2012/06/25