2 * Memory tagging, re-reading tag checks.
4 * Copyright (c) 2021 Linaro Ltd
5 * SPDX-License-Identifier: GPL-2.0-or-later
10 void __attribute__((noinline
)) tagset(void *p
, size_t size
)
13 for (i
= 0; i
< size
; i
+= 16) {
14 asm("stg %0, [%0]" : : "r"(p
+ i
));
18 void __attribute__((noinline
)) tagcheck(void *p
, size_t size
)
23 for (i
= 0; i
< size
; i
+= 16) {
24 asm("ldg %0, [%1]" : "=r"(c
) : "r"(p
+ i
), "0"(p
));
29 int main(int ac
, char **av
)
31 size_t size
= getpagesize() * 4;
35 enable_mte(PR_MTE_TCF_ASYNC
);
36 p0
= alloc_mte_mem(size
);
38 /* Tag the pointer. */
39 asm("irg %0,%1,%2" : "=r"(p1
) : "r"(p0
), "r"(excl
));