10 static void *(*volatile pmemset)(void *, int, size_t);
12 static char *aligned(void *p)
14 return (char*)(((uintptr_t)p + 63) & -64);
17 static void test_align(int align, int len)
19 char *s = aligned(buf+64) + align;
20 char *want = aligned(buf2+64) + align;
24 if (len + 64 > buf + N - s || len + 64 > buf2 + N - want)
26 for (i = 0; i < N; i++)
27 buf[i] = buf2[i] = ' ';
28 for (i = 0; i < len; i++)
30 p = pmemset(s, '#', len);
32 t_error("memset(%p,...) returned %p\n", s, p);
33 for (i = -64; i < len+64; i++)
34 if (s[i] != want[i]) {
35 t_error("memset(align %d, '#', %d) failed at pos %d\n", align, len, i);
36 t_printf("got : '%.*s'\n", len+128, s-64);
37 t_printf("want: '%.*s'\n", len+128, want-64);
42 static void test_value(int c)
47 for (i = 0; i < 10; i++)
48 if ((unsigned char)buf[i] != (unsigned char)c) {
49 t_error("memset(%d) failed: got %d\n", c, buf[i]);
60 for (i = 0; i < 16; i++)
61 for (j = 0; j < 200; j++)