On 10.01.2018 22:53, David Hildenbrand wrote: > Let's test if basic allocation works and we get virtual addresses. > > Signed-off-by: David Hildenbrand <david@xxxxxxxxxx> > --- > s390x/selftest.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/s390x/selftest.c b/s390x/selftest.c > index 76ed4bf..bf72d32 100644 > --- a/s390x/selftest.c > +++ b/s390x/selftest.c > @@ -10,6 +10,7 @@ > */ > #include <libcflat.h> > #include <util.h> > +#include <alloc.h> > #include <asm/interrupt.h> > > static void test_fp(void) > @@ -37,6 +38,21 @@ static void test_pgm_int(void) > check_pgm_int_code(PGM_INT_CODE_ADDRESSING); > } > > +static void test_malloc(void) > +{ > + int *tmp = malloc(sizeof(int)); > + int *tmp2 = malloc(sizeof(int)); > + > + report("malloc: got vaddr", (uintptr_t)tmp & 0xffffffff00000000ul); > + report("malloc: access works", (*tmp = 123456789)); Using the *tmp = 123456789 as condition for report() here looks somewhat weird. What about: *tmp = 123456789; mb(); report("malloc: access works", (*tmp == 123456789)); ? > + report("malloc: got 2nd vaddr", (uintptr_t)tmp2 & 0xffffffff00000000ul); > + report("malloc: access works", (*tmp2 = 123456789)); > + report("malloc: addresses differ", tmp != tmp2); Would it make sense to use the LOAD REAL ADDRESS instruction here to check that the VA != PA ? Thomas