Re: [kvm-unit-tests PATCH] s390x/snippets: Fix compilation with Clang 15

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue,  4 Apr 2023 12:14:34 +0200
Thomas Huth <thuth@xxxxxxxxxx> wrote:

> Clang complains:
> 
>  s390x/snippets/c/cstart.S:22:13: error: invalid operand for instruction
>   lghi %r15, stackptr
>              ^
> Let's load the address with "larl" instead, like we already do
> it in s390x/cstart64.S. For this we should also switch to 64-bit
> mode first, then we also don't have to clear r15 right in front
> of this anymore.
> 
> Changing the code here triggered another problem: initial_cr0
> must be aligned on a double-word boundary, otherwise the lctlg
> instruction will fail with an specification exception. This was
> just working by accident so far - add an ".align 8" now to avoid
> the problem.
> 
> Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>

Reviewed-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>

> ---
>  s390x/snippets/c/cstart.S | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/s390x/snippets/c/cstart.S b/s390x/snippets/c/cstart.S
> index a7d4cd42..c80ccfed 100644
> --- a/s390x/snippets/c/cstart.S
> +++ b/s390x/snippets/c/cstart.S
> @@ -15,12 +15,12 @@ start:
>  	larl	%r1, initial_cr0
>  	lctlg	%c0, %c0, 0(%r1)
>  	/* XOR all registers with themselves to clear them fully. */
> -	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
> +	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
>  	xgr \i,\i
>  	.endr
> -	/* 0x3000 is the stack page for now */
> -	lghi	%r15, stackptr
>  	sam64
> +	/* 0x3000 is the stack page for now */
> +	larl	%r15, stackptr
>  	brasl	%r14, main
>  	/*
>  	 * If main() returns, we stop the CPU with the code below. We also
> @@ -37,6 +37,7 @@ exit:
>  	xgr	%r0, %r0
>  	sigp    %r2, %r0, SIGP_STOP
>  
> +	.align 8
>  initial_cr0:
>  	/* enable AFP-register control, so FP regs (+BFP instr) can be used */
>  	.quad	0x0000000000040000




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux