aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2012-11-02 02:16:01 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-11-14 23:08:04 -0500
commit742415d6b66bf09e3e73280178ef7ec85c90b7ee (patch)
treecf0065c6665688a4148cd9a02186223b3bb05b46 /arch/powerpc/kernel
parent61e2390ede3cea186cc01f5f3d0c9eb570c42c40 (diff)
powerpc: Turn syscall handler into macros
This turns the syscall handler into macros as we are going to want to reuse them again later. Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S63
1 files changed, 40 insertions, 23 deletions
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 0969b7ff0f87..85b3c7e9dd6d 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -25,6 +25,43 @@
25 * 0x7000 - 0x7fff : FWNMI data area 25 * 0x7000 - 0x7fff : FWNMI data area
26 * 0x8000 - : Early init and support code 26 * 0x8000 - : Early init and support code
27 */ 27 */
28 /* Syscall routine is used twice, in reloc-off and reloc-on paths */
29#define SYSCALL_PSERIES_1 \
30BEGIN_FTR_SECTION \
31 cmpdi r0,0x1ebe ; \
32 beq- 1f ; \
33END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
34 mr r9,r13 ; \
35 GET_PACA(r13) ; \
36 mfspr r11,SPRN_SRR0 ; \
370:
38
39#define SYSCALL_PSERIES_2_RFID \
40 mfspr r12,SPRN_SRR1 ; \
41 ld r10,PACAKBASE(r13) ; \
42 LOAD_HANDLER(r10, system_call_entry) ; \
43 mtspr SPRN_SRR0,r10 ; \
44 ld r10,PACAKMSR(r13) ; \
45 mtspr SPRN_SRR1,r10 ; \
46 rfid ; \
47 b . ; /* prevent speculative execution */
48
49#define SYSCALL_PSERIES_3 \
50 /* Fast LE/BE switch system call */ \
511: mfspr r12,SPRN_SRR1 ; \
52 xori r12,r12,MSR_LE ; \
53 mtspr SPRN_SRR1,r12 ; \
54 rfid ; /* return to userspace */ \
55 b . ; \
562: mfspr r12,SPRN_SRR1 ; \
57 andi. r12,r12,MSR_PR ; \
58 bne 0b ; \
59 mtspr SPRN_SRR0,r3 ; \
60 mtspr SPRN_SRR1,r4 ; \
61 mtspr SPRN_SDR1,r5 ; \
62 rfid ; \
63 b . ; /* prevent speculative execution */
64
28 65
29/* 66/*
30 * This is the start of the interrupt handlers for pSeries 67 * This is the start of the interrupt handlers for pSeries
@@ -207,31 +244,11 @@ system_call_pSeries:
207 KVMTEST(0xc00) 244 KVMTEST(0xc00)
208 GET_SCRATCH0(r13) 245 GET_SCRATCH0(r13)
209#endif 246#endif
210BEGIN_FTR_SECTION 247 SYSCALL_PSERIES_1
211 cmpdi r0,0x1ebe 248 SYSCALL_PSERIES_2_RFID
212 beq- 1f 249 SYSCALL_PSERIES_3
213END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
214 mr r9,r13
215 GET_PACA(r13)
216 mfspr r11,SPRN_SRR0
217 mfspr r12,SPRN_SRR1
218 ld r10,PACAKBASE(r13)
219 LOAD_HANDLER(r10, system_call_entry)
220 mtspr SPRN_SRR0,r10
221 ld r10,PACAKMSR(r13)
222 mtspr SPRN_SRR1,r10
223 rfid
224 b . /* prevent speculative execution */
225
226 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00) 250 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00)
227 251
228/* Fast LE/BE switch system call */
2291: mfspr r12,SPRN_SRR1
230 xori r12,r12,MSR_LE
231 mtspr SPRN_SRR1,r12
232 rfid /* return to userspace */
233 b .
234
235 STD_EXCEPTION_PSERIES(0xd00, 0xd00, single_step) 252 STD_EXCEPTION_PSERIES(0xd00, 0xd00, single_step)
236 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xd00) 253 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xd00)
237 254