Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / aarch64 / mte-7.c
bloba981de62d4a2f570d95fed5b1a86ffb5f2a944f8
1 /*
2 * Memory tagging, unaligned access crossing pages.
3 * https://gitlab.com/qemu-project/qemu/-/issues/403
5 * Copyright (c) 2021 Linaro Ltd
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
9 #include "mte.h"
11 int main(int ac, char **av)
13 void *p;
15 enable_mte(PR_MTE_TCF_SYNC);
16 p = alloc_mte_mem(2 * 0x1000);
18 /* Tag the pointer. */
19 p = (void *)((unsigned long)p | (1ul << 56));
21 /* Store tag in sequential granules. */
22 asm("stg %0, [%0]" : : "r"(p + 0x0ff0));
23 asm("stg %0, [%0]" : : "r"(p + 0x1000));
26 * Perform an unaligned store with tag 1 crossing the pages.
27 * Failure dies with SIGSEGV.
29 asm("str %0, [%0]" : : "r"(p + 0x0ffc));
30 return 0;