* [kvm-unit-tests PATCH] s390x/snippets: Fix compilation with Clang 15
@ 2023-04-04 10:14 Thomas Huth
2023-04-04 10:31 ` Claudio Imbrenda
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thomas Huth @ 2023-04-04 10:14 UTC (permalink / raw)
To: kvm, Janosch Frank
Cc: linux-s390, Claudio Imbrenda, David Hildenbrand, Nico Boehr
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>
---
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
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [kvm-unit-tests PATCH] s390x/snippets: Fix compilation with Clang 15
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
2023-04-04 11:21 ` Janosch Frank
2023-04-04 11:40 ` Nico Boehr
2 siblings, 0 replies; 4+ messages in thread
From: Claudio Imbrenda @ 2023-04-04 10:31 UTC (permalink / raw)
To: Thomas Huth; +Cc: kvm, Janosch Frank, linux-s390, David Hildenbrand, Nico Boehr
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [kvm-unit-tests PATCH] s390x/snippets: Fix compilation with Clang 15
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
@ 2023-04-04 11:21 ` Janosch Frank
2023-04-04 11:40 ` Nico Boehr
2 siblings, 0 replies; 4+ messages in thread
From: Janosch Frank @ 2023-04-04 11:21 UTC (permalink / raw)
To: Thomas Huth, kvm
Cc: linux-s390, Claudio Imbrenda, David Hildenbrand, Nico Boehr
On 4/4/23 12:14, Thomas Huth 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>
> ---
> 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
Eh, I would have left that in, it doesn't hurt us after all.
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [kvm-unit-tests PATCH] s390x/snippets: Fix compilation with Clang 15
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
2023-04-04 11:21 ` Janosch Frank
@ 2023-04-04 11:40 ` Nico Boehr
2 siblings, 0 replies; 4+ messages in thread
From: Nico Boehr @ 2023-04-04 11:40 UTC (permalink / raw)
To: Janosch Frank, Thomas Huth, kvm
Cc: linux-s390, Claudio Imbrenda, David Hildenbrand
Quoting Thomas Huth (2023-04-04 12:14:34)
> 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: Nico Boehr <nrb@linux.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-04 11:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-04-04 11:21 ` Janosch Frank
2023-04-04 11:40 ` Nico Boehr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox