lkml.org 
[lkml]   [2022]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 5/8] s390/purgatory: workaround llvm's IAS limitations
On Wed, May 11, 2022 at 5:05 AM Heiko Carstens <hca@linux.ibm.com> wrote:
>
> 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)

I thought this was fixed in
https://github.com/ClangBuiltLinux/linux/issues/1420
https://reviews.llvm.org/D113341
(clang-14)
?

>
> Workaround this by partially rewriting the code.
>
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
> arch/s390/purgatory/head.S | 29 ++++++++++++++++++++++-------
> 1 file changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/arch/s390/purgatory/head.S b/arch/s390/purgatory/head.S
> index 3d1c31e0cf3d..ac1a27a20b66 100644
> --- a/arch/s390/purgatory/head.S
> +++ b/arch/s390/purgatory/head.S
> @@ -44,11 +44,14 @@
> .endm
>
> .macro MEMSWAP dst,src,buf,len
> -10: cghi \len,bufsz
> +10: larl %r0,purgatory_end
> + larl %r1,stack
> + slgr %r0,%r1
> + cgr \len,%r0
> jh 11f
> lgr %r4,\len
> j 12f
> -11: lghi %r4,bufsz
> +11: lgr %r4,%r0
>
> 12: MEMCPY \buf,\dst,%r4
> MEMCPY \dst,\src,%r4
> @@ -135,12 +138,18 @@ ENTRY(purgatory_start)
>
> .start_crash_kernel:
> /* Location of purgatory_start in crash memory */
> + larl %r0,.base_crash
> + larl %r1,purgatory_start
> + slgr %r0,%r1
> lgr %r8,%r13
> - aghi %r8,-(.base_crash-purgatory_start)
> + sgr %r8,%r0
>
> /* Destination for this code i.e. end of memory to be swapped. */
> + larl %r0,purgatory_end
> + larl %r1,purgatory_start
> + slgr %r0,%r1
> lg %r9,crash_size-.base_crash(%r13)
> - aghi %r9,-(purgatory_end-purgatory_start)
> + sgr %r9,%r0
>
> /* Destination in crash memory, i.e. same as r9 but in crash memory. */
> lg %r10,crash_start-.base_crash(%r13)
> @@ -149,15 +158,19 @@ ENTRY(purgatory_start)
> /* Buffer location (in crash memory) and size. As the purgatory is
> * behind the point of no return it can re-use the stack as buffer.
> */
> - lghi %r11,bufsz
> + larl %r11,purgatory_end
> larl %r12,stack
> + slgr %r11,%r12
>
> MEMCPY %r12,%r9,%r11 /* dst -> (crash) buf */
> MEMCPY %r9,%r8,%r11 /* self -> dst */
>
> /* Jump to new location. */
> lgr %r7,%r9
> - aghi %r7,.jump_to_dst-purgatory_start
> + larl %r0,.jump_to_dst
> + larl %r1,purgatory_start
> + slgr %r0,%r1
> + agr %r7,%r0
> br %r7
>
> .jump_to_dst:
> @@ -169,7 +182,9 @@ ENTRY(purgatory_start)
>
> /* Load new buffer location after jump */
> larl %r7,stack
> - aghi %r10,stack-purgatory_start
> + larl %r0,purgatory_start
> + slgrk %r0,%r7,%r0
> + agr %r10,%r0
> MEMCPY %r10,%r7,%r11 /* (new) buf -> (crash) buf */
>
> /* Now the code is set up to run from its designated location. Start
> --
> 2.32.0
>


--
Thanks,
~Nick Desaulniers

\
 
 \ /
  Last update: 2022-05-11 21:56    [W:0.183 / U:0.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site