Message ID | 20170626161509.18873-3-david@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 26.06.2017 18:15, David Hildenbrand wrote: > GCC is free to generate multiple stores instead of just one (e.g. > observed by switching to -O0), making the test fail. > > Make sure we really only have one store. > > Signed-off-by: David Hildenbrand <david@redhat.com> > --- > s390x/selftest.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/s390x/selftest.c b/s390x/selftest.c > index 87eb934..1c8d16a 100644 > --- a/s390x/selftest.c > +++ b/s390x/selftest.c > @@ -33,7 +33,7 @@ static void test_pgm_int(void) > check_pgm_int_code(PGM_INT_CODE_OPERATION); > > expect_pgm_int(); > - *((unsigned int*)-1) = 1; > + asm volatile(" stg %0,0(%0)\n" : : "r"(-1)); > check_pgm_int_code(PGM_INT_CODE_ADDRESSING); > } I guess using a volatile pointer would work, too? Anyway, the inline assembly looks certainly also fine here, so: Reviewed-by: Thomas Huth <thuth@redhat.com>
On 27/06/2017 05:45, Thomas Huth wrote:
> Reviewed-by: Thomas Huth <thuth@redhat.com>
Thanks David and Thomas, queued.
diff --git a/s390x/selftest.c b/s390x/selftest.c index 87eb934..1c8d16a 100644 --- a/s390x/selftest.c +++ b/s390x/selftest.c @@ -33,7 +33,7 @@ static void test_pgm_int(void) check_pgm_int_code(PGM_INT_CODE_OPERATION); expect_pgm_int(); - *((unsigned int*)-1) = 1; + asm volatile(" stg %0,0(%0)\n" : : "r"(-1)); check_pgm_int_code(PGM_INT_CODE_ADDRESSING); }
GCC is free to generate multiple stores instead of just one (e.g. observed by switching to -O0), making the test fail. Make sure we really only have one store. Signed-off-by: David Hildenbrand <david@redhat.com> --- s390x/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)