none/tests/fdleak_cmsg_supp.supp: Add suppressions for older glibc
[valgrind.git] / none / tests / arm64 / dc_cvax.c
blob768f7592e379613a2bacdbdd7a1c560ae957c9f6
1 #include <assert.h>
2 #include <string.h>
3 #include <stdlib.h>
4 #include <stdio.h>
6 int main(void)
8 char buf[64] __attribute__((aligned(64)));
9 unsigned long check_dc_zva;
10 unsigned long check_dc_cvap;
11 memset(buf, 0xAA, 64);
12 asm volatile("mrs %0, dczid_el0" : "=r" (check_dc_zva));
13 asm volatile("dc cvac, %0" :: "r" (buf));
14 asm volatile("dc cvau, %0" :: "r" (buf));
15 asm volatile("mrs %0, id_aa64isar1_el1" : "=r" (check_dc_cvap));
16 if (check_dc_cvap & 0x3) {
17 asm volatile("add x8, sp, #0x40\n"
18 ".inst 0xd50b7c28\n");
20 if (check_dc_cvap & 0x2) {
21 asm volatile("add x8, sp, #0x40\n"
22 ".inst 0xd50b7c28");
24 asm volatile("dc civac, %0" :: "r" (buf));
25 if (!(check_dc_zva & 0x10)) {
26 size_t buf_size = (1U << ((check_dc_zva & 0xf) + 2));
27 //printf("lg 2 word count %lu byte count %zu\n", check_dc_zva & 0xfUL, buf_size);
28 char* var_buf;
29 if (posix_memalign((void**)&var_buf, buf_size, buf_size) == 0) {
30 asm volatile("dc zva, %0" :: "r" (var_buf));
31 assert(var_buf[0] == 0);
32 assert(var_buf[buf_size - 1] == 0);
33 free(var_buf);
34 } else {
35 perror("posix_memalign failed:");
36 exit(1);