Skip to content

Commit a1f3ae3

Browse files
chleroympe
authored andcommitted
powerpc/32: Use stmw/lmw for registers save/restore in asm
arch/powerpc/Makefile activates -mmultiple on BE PPC32 configs in order to use multiple word instructions in functions entry/exit. The patch does the same for the asm parts, for consistency. On processors like the 8xx on which insn fetching is pretty slow, this speeds up registers save/restore. Signed-off-by: Christophe Leroy <[email protected]> [mpe: PPC32 is BE only, so drop the endian checks] Signed-off-by: Michael Ellerman <[email protected]>
1 parent 24c7858 commit a1f3ae3

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

arch/powerpc/include/asm/ppc_asm.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
8080
#else
8181
#define SAVE_GPR(n, base) stw n,GPR0+4*(n)(base)
8282
#define REST_GPR(n, base) lwz n,GPR0+4*(n)(base)
83-
#define SAVE_NVGPRS(base) SAVE_GPR(13, base); SAVE_8GPRS(14, base); \
84-
SAVE_10GPRS(22, base)
85-
#define REST_NVGPRS(base) REST_GPR(13, base); REST_8GPRS(14, base); \
86-
REST_10GPRS(22, base)
83+
#define SAVE_NVGPRS(base) stmw 13, GPR0+4*13(base)
84+
#define REST_NVGPRS(base) lmw 13, GPR0+4*13(base)
8785
#endif
8886

8987
#define SAVE_2GPRS(n, base) SAVE_GPR(n, base); SAVE_GPR(n+1, base)

arch/powerpc/kernel/misc.S

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ _GLOBAL(setjmp)
6060
PPC_STL r0,0(r3)
6161
PPC_STL r1,SZL(r3)
6262
PPC_STL r2,2*SZL(r3)
63+
#ifdef CONFIG_PPC32
64+
mfcr r12
65+
stmw r12, 3*SZL(r3)
66+
#else
6367
mfcr r0
6468
PPC_STL r0,3*SZL(r3)
6569
PPC_STL r13,4*SZL(r3)
@@ -81,10 +85,15 @@ _GLOBAL(setjmp)
8185
PPC_STL r29,20*SZL(r3)
8286
PPC_STL r30,21*SZL(r3)
8387
PPC_STL r31,22*SZL(r3)
88+
#endif
8489
li r3,0
8590
blr
8691

8792
_GLOBAL(longjmp)
93+
#ifdef CONFIG_PPC32
94+
lmw r12, 3*SZL(r3)
95+
mtcrf 0x38, r12
96+
#else
8897
PPC_LL r13,4*SZL(r3)
8998
PPC_LL r14,5*SZL(r3)
9099
PPC_LL r15,6*SZL(r3)
@@ -106,6 +115,7 @@ _GLOBAL(longjmp)
106115
PPC_LL r31,22*SZL(r3)
107116
PPC_LL r0,3*SZL(r3)
108117
mtcrf 0x38,r0
118+
#endif
109119
PPC_LL r0,0(r3)
110120
PPC_LL r1,SZL(r3)
111121
PPC_LL r2,2*SZL(r3)

arch/powerpc/kernel/ppc_save_regs.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
*/
2626
_GLOBAL(ppc_save_regs)
2727
PPC_STL r0,0*SZL(r3)
28+
#ifdef CONFIG_PPC32
29+
stmw r2, 2*SZL(r3)
30+
#else
2831
PPC_STL r2,2*SZL(r3)
2932
PPC_STL r3,3*SZL(r3)
3033
PPC_STL r4,4*SZL(r3)
@@ -55,6 +58,7 @@ _GLOBAL(ppc_save_regs)
5558
PPC_STL r29,29*SZL(r3)
5659
PPC_STL r30,30*SZL(r3)
5760
PPC_STL r31,31*SZL(r3)
61+
#endif
5862
/* go up one stack frame for SP */
5963
PPC_LL r4,0(r1)
6064
PPC_STL r4,1*SZL(r3)

0 commit comments

Comments
 (0)