exception-64s.h (de021bb79c7636df24864fa2dbb958121303663b) exception-64s.h (bc2e6c6ac21183a6102a926f83186d9cac6713f8)
1#ifndef _ASM_POWERPC_EXCEPTION_H
2#define _ASM_POWERPC_EXCEPTION_H
3/*
4 * Extracted from head_64.S
5 *
6 * PowerPC version
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 *

--- 34 unchanged lines hidden (view full) ---

43#define EX_SRR0 40
44#define EX_DAR 48
45#define EX_DSISR 56
46#define EX_CCR 60
47#define EX_R3 64
48#define EX_LR 72
49#define EX_CFAR 80
50#define EX_PPR 88 /* SMT thread status register (priority) */
1#ifndef _ASM_POWERPC_EXCEPTION_H
2#define _ASM_POWERPC_EXCEPTION_H
3/*
4 * Extracted from head_64.S
5 *
6 * PowerPC version
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 *

--- 34 unchanged lines hidden (view full) ---

43#define EX_SRR0 40
44#define EX_DAR 48
45#define EX_DSISR 56
46#define EX_CCR 60
47#define EX_R3 64
48#define EX_LR 72
49#define EX_CFAR 80
50#define EX_PPR 88 /* SMT thread status register (priority) */
51#define EX_CTR 96
51
52#ifdef CONFIG_RELOCATABLE
53#define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \
54 ld r12,PACAKBASE(r13); /* get high part of &label */ \
55 mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
56 LOAD_HANDLER(r12,label); \
52
53#ifdef CONFIG_RELOCATABLE
54#define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \
55 ld r12,PACAKBASE(r13); /* get high part of &label */ \
56 mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
57 LOAD_HANDLER(r12,label); \
57 mtlr r12; \
58 mtctr r12; \
58 mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
59 li r10,MSR_RI; \
60 mtmsrd r10,1; /* Set RI (EE=0) */ \
59 mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
60 li r10,MSR_RI; \
61 mtmsrd r10,1; /* Set RI (EE=0) */ \
61 blr;
62 bctr;
62#else
63/* If not relocatable, we can jump directly -- and save messing with LR */
64#define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \
65 mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
66 mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
67 li r10,MSR_RI; \
68 mtmsrd r10,1; /* Set RI (EE=0) */ \
69 b label;

--- 22 unchanged lines hidden (view full) ---

92 ori reg,reg,(label)-_stext; /* virt addr of handler ... */
93
94/* Exception register prefixes */
95#define EXC_HV H
96#define EXC_STD
97
98#if defined(CONFIG_RELOCATABLE)
99/*
63#else
64/* If not relocatable, we can jump directly -- and save messing with LR */
65#define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \
66 mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
67 mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
68 li r10,MSR_RI; \
69 mtmsrd r10,1; /* Set RI (EE=0) */ \
70 b label;

--- 22 unchanged lines hidden (view full) ---

93 ori reg,reg,(label)-_stext; /* virt addr of handler ... */
94
95/* Exception register prefixes */
96#define EXC_HV H
97#define EXC_STD
98
99#if defined(CONFIG_RELOCATABLE)
100/*
100 * If we support interrupts with relocation on AND we're a relocatable
101 * kernel, we need to use LR to get to the 2nd level handler. So, save/restore
102 * it when required.
101 * If we support interrupts with relocation on AND we're a relocatable kernel,
102 * we need to use CTR to get to the 2nd level handler. So, save/restore it
103 * when required.
103 */
104 */
104#define SAVE_LR(reg, area) mflr reg ; std reg,area+EX_LR(r13)
105#define GET_LR(reg, area) ld reg,area+EX_LR(r13)
106#define RESTORE_LR(reg, area) ld reg,area+EX_LR(r13) ; mtlr reg
105#define SAVE_CTR(reg, area) mfctr reg ; std reg,area+EX_CTR(r13)
106#define GET_CTR(reg, area) ld reg,area+EX_CTR(r13)
107#define RESTORE_CTR(reg, area) ld reg,area+EX_CTR(r13) ; mtctr reg
107#else
108#else
108/* ...else LR is unused and in register. */
109#define SAVE_LR(reg, area)
110#define GET_LR(reg, area) mflr reg
111#define RESTORE_LR(reg, area)
109/* ...else CTR is unused and in register. */
110#define SAVE_CTR(reg, area)
111#define GET_CTR(reg, area) mfctr reg
112#define RESTORE_CTR(reg, area)
112#endif
113
114/*
115 * PPR save/restore macros used in exceptions_64s.S
116 * Used for P7 or later processors
117 */
118#define SAVE_PPR(area, ra, rb) \
119BEGIN_FTR_SECTION_NESTED(940) \

--- 39 unchanged lines hidden (view full) ---

159 OPT_GET_SPR(r9, SPRN_PPR, CPU_FTR_HAS_PPR); \
160 HMT_MEDIUM; \
161 std r10,area+EX_R10(r13); /* save r10 - r12 */ \
162 OPT_GET_SPR(r10, SPRN_CFAR, CPU_FTR_CFAR)
163
164#define __EXCEPTION_PROLOG_1(area, extra, vec) \
165 OPT_SAVE_REG_TO_PACA(area+EX_PPR, r9, CPU_FTR_HAS_PPR); \
166 OPT_SAVE_REG_TO_PACA(area+EX_CFAR, r10, CPU_FTR_CFAR); \
113#endif
114
115/*
116 * PPR save/restore macros used in exceptions_64s.S
117 * Used for P7 or later processors
118 */
119#define SAVE_PPR(area, ra, rb) \
120BEGIN_FTR_SECTION_NESTED(940) \

--- 39 unchanged lines hidden (view full) ---

160 OPT_GET_SPR(r9, SPRN_PPR, CPU_FTR_HAS_PPR); \
161 HMT_MEDIUM; \
162 std r10,area+EX_R10(r13); /* save r10 - r12 */ \
163 OPT_GET_SPR(r10, SPRN_CFAR, CPU_FTR_CFAR)
164
165#define __EXCEPTION_PROLOG_1(area, extra, vec) \
166 OPT_SAVE_REG_TO_PACA(area+EX_PPR, r9, CPU_FTR_HAS_PPR); \
167 OPT_SAVE_REG_TO_PACA(area+EX_CFAR, r10, CPU_FTR_CFAR); \
167 SAVE_LR(r10, area); \
168 SAVE_CTR(r10, area); \
168 mfcr r9; \
169 extra(vec); \
170 std r11,area+EX_R11(r13); \
171 std r12,area+EX_R12(r13); \
172 GET_SCRATCH0(r10); \
173 std r10,area+EX_R13(r13)
174#define EXCEPTION_PROLOG_1(area, extra, vec) \
175 __EXCEPTION_PROLOG_1(area, extra, vec)

--- 89 unchanged lines hidden (view full) ---

265 beq- 1f; \
266 ld r1,PACAKSAVE(r13); /* kernel stack to use */ \
2671: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \
268 blt+ cr1,3f; /* abort if it is */ \
269 li r1,(n); /* will be reloaded later */ \
270 sth r1,PACA_TRAP_SAVE(r13); \
271 std r3,area+EX_R3(r13); \
272 addi r3,r13,area; /* r3 -> where regs are saved*/ \
169 mfcr r9; \
170 extra(vec); \
171 std r11,area+EX_R11(r13); \
172 std r12,area+EX_R12(r13); \
173 GET_SCRATCH0(r10); \
174 std r10,area+EX_R13(r13)
175#define EXCEPTION_PROLOG_1(area, extra, vec) \
176 __EXCEPTION_PROLOG_1(area, extra, vec)

--- 89 unchanged lines hidden (view full) ---

266 beq- 1f; \
267 ld r1,PACAKSAVE(r13); /* kernel stack to use */ \
2681: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \
269 blt+ cr1,3f; /* abort if it is */ \
270 li r1,(n); /* will be reloaded later */ \
271 sth r1,PACA_TRAP_SAVE(r13); \
272 std r3,area+EX_R3(r13); \
273 addi r3,r13,area; /* r3 -> where regs are saved*/ \
273 RESTORE_LR(r1, area); \
274 RESTORE_CTR(r1, area); \
274 b bad_stack; \
2753: std r9,_CCR(r1); /* save CR in stackframe */ \
276 std r11,_NIP(r1); /* save SRR0 in stackframe */ \
277 std r12,_MSR(r1); /* save SRR1 in stackframe */ \
278 std r10,0(r1); /* make stack chain pointer */ \
279 std r0,GPR0(r1); /* save r0 in stackframe */ \
280 std r10,GPR1(r1); /* save r1 in stackframe */ \
281 beq 4f; /* if from kernel mode */ \

--- 11 unchanged lines hidden (view full) ---

293 ld r11,area+EX_R13(r13); \
294 std r9,GPR11(r1); \
295 std r10,GPR12(r1); \
296 std r11,GPR13(r1); \
297 BEGIN_FTR_SECTION_NESTED(66); \
298 ld r10,area+EX_CFAR(r13); \
299 std r10,ORIG_GPR3(r1); \
300 END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66); \
275 b bad_stack; \
2763: std r9,_CCR(r1); /* save CR in stackframe */ \
277 std r11,_NIP(r1); /* save SRR0 in stackframe */ \
278 std r12,_MSR(r1); /* save SRR1 in stackframe */ \
279 std r10,0(r1); /* make stack chain pointer */ \
280 std r0,GPR0(r1); /* save r0 in stackframe */ \
281 std r10,GPR1(r1); /* save r1 in stackframe */ \
282 beq 4f; /* if from kernel mode */ \

--- 11 unchanged lines hidden (view full) ---

294 ld r11,area+EX_R13(r13); \
295 std r9,GPR11(r1); \
296 std r10,GPR12(r1); \
297 std r11,GPR13(r1); \
298 BEGIN_FTR_SECTION_NESTED(66); \
299 ld r10,area+EX_CFAR(r13); \
300 std r10,ORIG_GPR3(r1); \
301 END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66); \
301 GET_LR(r9,area); /* Get LR, later save to stack */ \
302 mflr r9; /* Get LR, later save to stack */ \
302 ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \
303 std r9,_LINK(r1); \
303 ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \
304 std r9,_LINK(r1); \
304 mfctr r10; /* save CTR in stackframe */ \
305 GET_CTR(r10, area); \
305 std r10,_CTR(r1); \
306 lbz r10,PACASOFTIRQEN(r13); \
307 mfspr r11,SPRN_XER; /* save XER in stackframe */ \
308 std r10,SOFTE(r1); \
309 std r11,_XER(r1); \
310 li r9,(n)+1; \
311 std r9,_TRAP(r1); /* set trap number */ \
312 li r10,0; \

--- 225 unchanged lines hidden ---
306 std r10,_CTR(r1); \
307 lbz r10,PACASOFTIRQEN(r13); \
308 mfspr r11,SPRN_XER; /* save XER in stackframe */ \
309 std r10,SOFTE(r1); \
310 std r11,_XER(r1); \
311 li r9,(n)+1; \
312 std r9,_TRAP(r1); /* set trap number */ \
313 li r10,0; \

--- 225 unchanged lines hidden ---