Skip to content

Commit 6c17199

Browse files
committed
powerpc/of: Remove useless register save/restore when calling OF back
enter_prom() used to save and restore registers such as CTR, XER etc.. which are volatile, or SRR0,1... which we don't care about. This removes a bunch of useless code and while at it turns an mtmsrd into an MTMSRD macro which will be useful to Book3E. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent 7d60b02 commit 6c17199

1 file changed

Lines changed: 6 additions & 32 deletions

File tree

‎arch/powerpc/kernel/entry_64.S‎

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -823,30 +823,17 @@ _GLOBAL(enter_prom)
823823
* of all registers that it saves. We therefore save those registers
824824
* PROM might touch to the stack. (r0, r3-r13 are caller saved)
825825
*/
826-
SAVE_8GPRS(2, r1)
826+
SAVE_GPR(2, r1)
827827
SAVE_GPR(13, r1)
828828
SAVE_8GPRS(14, r1)
829829
SAVE_10GPRS(22, r1)
830-
mfcr r4
831-
std r4,_CCR(r1)
832-
mfctr r5
833-
std r5,_CTR(r1)
834-
mfspr r6,SPRN_XER
835-
std r6,_XER(r1)
836-
mfdar r7
837-
std r7,_DAR(r1)
838-
mfdsisr r8
839-
std r8,_DSISR(r1)
840-
mfsrr0 r9
841-
std r9,_SRR0(r1)
842-
mfsrr1 r10
843-
std r10,_SRR1(r1)
830+
mfcr r10
844831
mfmsr r11
832+
std r10,_CCR(r1)
845833
std r11,_MSR(r1)
846834

847835
/* Get the PROM entrypoint */
848-
ld r0,GPR4(r1)
849-
mtlr r0
836+
mtlr r4
850837

851838
/* Switch MSR to 32 bits mode
852839
*/
@@ -860,8 +847,7 @@ _GLOBAL(enter_prom)
860847
mtmsrd r11
861848
isync
862849

863-
/* Restore arguments & enter PROM here... */
864-
ld r3,GPR3(r1)
850+
/* Enter PROM here... */
865851
blrl
866852

867853
/* Just make sure that r1 top 32 bits didn't get
@@ -871,7 +857,7 @@ _GLOBAL(enter_prom)
871857

872858
/* Restore the MSR (back to 64 bits) */
873859
ld r0,_MSR(r1)
874-
mtmsrd r0
860+
MTMSRD(r0)
875861
isync
876862

877863
/* Restore other registers */
@@ -881,18 +867,6 @@ _GLOBAL(enter_prom)
881867
REST_10GPRS(22, r1)
882868
ld r4,_CCR(r1)
883869
mtcr r4
884-
ld r5,_CTR(r1)
885-
mtctr r5
886-
ld r6,_XER(r1)
887-
mtspr SPRN_XER,r6
888-
ld r7,_DAR(r1)
889-
mtdar r7
890-
ld r8,_DSISR(r1)
891-
mtdsisr r8
892-
ld r9,_SRR0(r1)
893-
mtsrr0 r9
894-
ld r10,_SRR1(r1)
895-
mtsrr1 r10
896870

897871
addi r1,r1,PROM_FRAME_SIZE
898872
ld r0,16(r1)

0 commit comments

Comments
 (0)