s390x/selftest: Fix constraint of inline assembly
PATCH 1/1 s390x/selftest: Fix constraint of inline assembly
Clang on s390x compains:
/home/thuth/devel/kvm-unit-tests/s390x/selftest.c:39:15: error:
%r0 used in an address
asm volatile(" stg %0,0(%0)\n" : : "r"(-1L));
^
<inline asm>:1:13: note: instantiated into assembly here
stg %r0,0(%r0)
^Right it is. We should not use address register 0 for STG. Thus let's use the "a" constraint to avoid register 0 here.
Signed-off-by Thomas Huth <[email protected]>
--- s390x/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/selftest.c +1 -1
@@ -36,7 +36,7 @@ static void test_pgm_int(void)check_pgm_int_code (PGM_INT_CODE_OPERATION );expect_pgm_int (); - asmvolatile (" stg %0,0(%0)\n" : :"r" (-1L )); + asmvolatile (" stg %0,0(%0)\n" : :"a" (-1L ));check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); }
Signature · 1 line
2.18.2
Quoted 24 lines · Thomas Huth
Clang on s390x compains:
/home/thuth/devel/kvm-unit-tests/s390x/selftest.c:39:15: error:
%r0 used in an addressasm volatile(" stg %0,0(%0)\n" : : "r"(-1L)); ^ <inline asm>:1:13: note: instantiated into assembly here stg %r0,0(%r0) ^Right it is. We should not use address register 0 for STG. Thus let's use the "a" constraint to avoid register 0 here.
Signed-off-by Thomas Huth <[email protected]>--- s390x/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)s390x/selftest.c +0
-0
s390x/selftest.c static void test_pgm_int(void) · line 42
Quoted 8 lines
s390x/selftest.c +1
-1@@ -36,7 +36,7 @@ static void test_pgm_int(void)check_pgm_int_code (PGM_INT_CODE_OPERATION );expect_pgm_int (); - asmvolatile (" stg %0,0(%0)\n" : :"r" (-1L )); + asmvolatile (" stg %0,0(%0)\n" : :"a" (-1L ));check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); }
Reviewed-by David Hildenbrand <[email protected]>
Signature · 3 lines
Thanks, David / dhildenb