Skip to content

Commit 4603fba

Browse files
danglin44hdeller
authored andcommitted
parisc: Avoid clobbering the C/B bits in the PSW with tophys and tovirt macros
Use add,l to avoid clobbering the C/B bits in the PSW. Signed-off-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de> Cc: stable@vger.kernel.org # v5.10+
1 parent e5db6a7 commit 4603fba

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

arch/parisc/include/asm/assembly.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,28 @@
9797
* version takes two arguments: a src and destination register.
9898
* However, the source and destination registers can not be
9999
* the same register.
100+
*
101+
* We use add,l to avoid clobbering the C/B bits in the PSW.
100102
*/
101103

102104
.macro tophys grvirt, grphys
103-
ldil L%(__PAGE_OFFSET), \grphys
104-
sub \grvirt, \grphys, \grphys
105+
ldil L%(-__PAGE_OFFSET), \grphys
106+
addl \grvirt, \grphys, \grphys
105107
.endm
106-
108+
107109
.macro tovirt grphys, grvirt
108110
ldil L%(__PAGE_OFFSET), \grvirt
109-
add \grphys, \grvirt, \grvirt
111+
addl \grphys, \grvirt, \grvirt
110112
.endm
111113

112114
.macro tophys_r1 gr
113-
ldil L%(__PAGE_OFFSET), %r1
114-
sub \gr, %r1, \gr
115+
ldil L%(-__PAGE_OFFSET), %r1
116+
addl \gr, %r1, \gr
115117
.endm
116-
118+
117119
.macro tovirt_r1 gr
118120
ldil L%(__PAGE_OFFSET), %r1
119-
add \gr, %r1, \gr
121+
addl \gr, %r1, \gr
120122
.endm
121123

122124
.macro delay value

0 commit comments

Comments
 (0)