public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>
Cc: kvm@vger.kernel.org, Janosch Frank <frankja@linux.ibm.com>,
	linux-s390@vger.kernel.org, David Hildenbrand <david@redhat.com>,
	Nico Boehr <nrb@linux.ibm.com>
Subject: Re: [kvm-unit-tests PATCH] s390x/snippets: Fix compilation with Clang 15
Date: Tue, 4 Apr 2023 12:31:55 +0200	[thread overview]
Message-ID: <20230404123155.728e3f2e@p-imbrenda> (raw)
In-Reply-To: <20230404101434.172721-1-thuth@redhat.com>

On Tue,  4 Apr 2023 12:14:34 +0200
Thomas Huth <thuth@redhat.com> 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@redhat.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  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


  reply	other threads:[~2023-04-04 10:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 10:14 [kvm-unit-tests PATCH] s390x/snippets: Fix compilation with Clang 15 Thomas Huth
2023-04-04 10:31 ` Claudio Imbrenda [this message]
2023-04-04 11:21 ` Janosch Frank
2023-04-04 11:40 ` Nico Boehr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230404123155.728e3f2e@p-imbrenda \
    --to=imbrenda@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox