Skip to content

Commit 840b66c

Browse files
committed
openrisc: Cleanup switch code and comments
The saving of the r12 register was there for a compiler bug referring to a port that was never upstreamed. It should be safe to use this as the new compiler is what we use and the old deprecated. Also, clean up some typos and references to old names in the switch comments. Signed-off-by: Stafford Horne <[email protected]>
1 parent d58071a commit 840b66c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

arch/openrisc/kernel/entry.S

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,11 +1001,10 @@ ENTRY(ret_from_fork)
10011001
l.lwz r11,PT_GPR11(r1)
10021002

10031003
/* The syscall fast path return expects call-saved registers
1004-
* r12-r28 to be untouched, so we restore them here as they
1004+
* r14-r28 to be untouched, so we restore them here as they
10051005
* will have been effectively clobbered when arriving here
10061006
* via the call to switch()
10071007
*/
1008-
l.lwz r12,PT_GPR12(r1)
10091008
l.lwz r14,PT_GPR14(r1)
10101009
l.lwz r16,PT_GPR16(r1)
10111010
l.lwz r18,PT_GPR18(r1)
@@ -1037,10 +1036,10 @@ ENTRY(ret_from_fork)
10371036

10381037
/* _switch MUST never lay on page boundry, cause it runs from
10391038
* effective addresses and beeing interrupted by iTLB miss would kill it.
1040-
* dTLB miss seams to never accour in the bad place since data accesses
1039+
* dTLB miss seems to never accour in the bad place since data accesses
10411040
* are from task structures which are always page aligned.
10421041
*
1043-
* The problem happens in RESTORE_ALL_NO_R11 where we first set the EPCR
1042+
* The problem happens in RESTORE_ALL where we first set the EPCR
10441043
* register, then load the previous register values and only at the end call
10451044
* the l.rfe instruction. If get TLB miss in beetwen the EPCR register gets
10461045
* garbled and we end up calling l.rfe with the wrong EPCR. (same probably
@@ -1068,9 +1067,8 @@ ENTRY(_switch)
10681067
/* No need to store r1/PT_SP as it goes into KSP below */
10691068
l.sw PT_GPR2(r1),r2
10701069
l.sw PT_GPR9(r1),r9
1071-
/* This is wrong, r12 shouldn't be here... but GCC is broken for the time being
1072-
* and expects r12 to be callee-saved... */
1073-
l.sw PT_GPR12(r1),r12
1070+
1071+
/* Save callee-saved registers to the new pt_regs */
10741072
l.sw PT_GPR14(r1),r14
10751073
l.sw PT_GPR16(r1),r16
10761074
l.sw PT_GPR18(r1),r18
@@ -1111,9 +1109,7 @@ ENTRY(_switch)
11111109
/* No need to restore r10 */
11121110
/* ...and do not restore r11 */
11131111

1114-
/* This is wrong, r12 shouldn't be here... but GCC is broken for the time being
1115-
* and expects r12 to be callee-saved... */
1116-
l.lwz r12,PT_GPR12(r1)
1112+
/* Restore callee-saved registers */
11171113
l.lwz r14,PT_GPR14(r1)
11181114
l.lwz r16,PT_GPR16(r1)
11191115
l.lwz r18,PT_GPR18(r1)

0 commit comments

Comments
 (0)