Skip to content

Commit adda746

Browse files
committed
s390/purgatory: workaround llvm's IAS limitations
llvm's integrated assembler cannot handle immediate values which are calculated with two local labels: arch/s390/purgatory/head.S:139:11: error: invalid operand for instruction aghi %r8,-(.base_crash-purgatory_start) Workaround this by partially rewriting the code. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
1 parent 4c25f0f commit adda746

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

arch/s390/purgatory/head.S

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@
4444
.endm
4545

4646
.macro MEMSWAP dst,src,buf,len
47-
10: cghi \len,bufsz
47+
10: larl %r0,purgatory_end
48+
larl %r1,stack
49+
slgr %r0,%r1
50+
cgr \len,%r0
4851
jh 11f
4952
lgr %r4,\len
5053
j 12f
51-
11: lghi %r4,bufsz
54+
11: lgr %r4,%r0
5255

5356
12: MEMCPY \buf,\dst,%r4
5457
MEMCPY \dst,\src,%r4
@@ -135,12 +138,18 @@ ENTRY(purgatory_start)
135138

136139
.start_crash_kernel:
137140
/* Location of purgatory_start in crash memory */
141+
larl %r0,.base_crash
142+
larl %r1,purgatory_start
143+
slgr %r0,%r1
138144
lgr %r8,%r13
139-
aghi %r8,-(.base_crash-purgatory_start)
145+
sgr %r8,%r0
140146

141147
/* Destination for this code i.e. end of memory to be swapped. */
148+
larl %r0,purgatory_end
149+
larl %r1,purgatory_start
150+
slgr %r0,%r1
142151
lg %r9,crash_size-.base_crash(%r13)
143-
aghi %r9,-(purgatory_end-purgatory_start)
152+
sgr %r9,%r0
144153

145154
/* Destination in crash memory, i.e. same as r9 but in crash memory. */
146155
lg %r10,crash_start-.base_crash(%r13)
@@ -149,15 +158,19 @@ ENTRY(purgatory_start)
149158
/* Buffer location (in crash memory) and size. As the purgatory is
150159
* behind the point of no return it can re-use the stack as buffer.
151160
*/
152-
lghi %r11,bufsz
161+
larl %r11,purgatory_end
153162
larl %r12,stack
163+
slgr %r11,%r12
154164

155165
MEMCPY %r12,%r9,%r11 /* dst -> (crash) buf */
156166
MEMCPY %r9,%r8,%r11 /* self -> dst */
157167

158168
/* Jump to new location. */
159169
lgr %r7,%r9
160-
aghi %r7,.jump_to_dst-purgatory_start
170+
larl %r0,.jump_to_dst
171+
larl %r1,purgatory_start
172+
slgr %r0,%r1
173+
agr %r7,%r0
161174
br %r7
162175

163176
.jump_to_dst:
@@ -169,7 +182,10 @@ ENTRY(purgatory_start)
169182

170183
/* Load new buffer location after jump */
171184
larl %r7,stack
172-
aghi %r10,stack-purgatory_start
185+
lgr %r0,%r7
186+
larl %r1,purgatory_start
187+
slgr %r0,%r1
188+
agr %r10,%r0
173189
MEMCPY %r10,%r7,%r11 /* (new) buf -> (crash) buf */
174190

175191
/* Now the code is set up to run from its designated location. Start

0 commit comments

Comments
 (0)