Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / aarch64 / test-826.c
blobf59740a8c508a400474eaf6bcaa62f8c71ff3045
1 #include <sys/mman.h>
2 #include <unistd.h>
3 #include <signal.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <assert.h>
8 static void *expected;
10 void sigsegv(int sig, siginfo_t *info, void *vuc)
12 ucontext_t *uc = vuc;
14 assert(info->si_addr == expected);
15 uc->uc_mcontext.pc += 4;
18 int main()
20 struct sigaction sa = {
21 .sa_sigaction = sigsegv,
22 .sa_flags = SA_SIGINFO
25 void *page;
26 long ofs;
28 if (sigaction(SIGSEGV, &sa, NULL) < 0) {
29 perror("sigaction");
30 return EXIT_FAILURE;
33 page = mmap(0, getpagesize(), PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
34 if (page == MAP_FAILED) {
35 perror("mmap");
36 return EXIT_FAILURE;
39 ofs = 0x124;
40 expected = page + ofs;
42 asm("ptrue p0.d, vl1\n\t"
43 "dup z0.d, %0\n\t"
44 "ldnt1h {z1.d}, p0/z, [z0.d, %1]\n\t"
45 "dup z1.d, %1\n\t"
46 "ldnt1h {z0.d}, p0/z, [z1.d, %0]"
47 : : "r"(page), "r"(ofs) : "v0", "v1");
49 return EXIT_SUCCESS;