]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/tcg/aarch64/pauth-4.c
14 int pac_feature
= get_pac_feature();
17 * Exit if no PAuth or FEAT_FPAC, which will SIGILL on AUTIA failure
18 * rather than return an error for us to check below.
20 if (pac_feature
== 0 || pac_feature
>= 4) {
24 for (i
= 0; i
< TESTS
; i
++) {
27 in
= i
+ (uintptr_t) base
;
29 asm("mov %0, %[in]\n\t"
31 "eor %0, %0, #4\n\t" /* corrupt single bit */
33 "autia %1, sp\n\t" /* validate corrupted pointer */
34 "xpaci %0\n\t" /* strip pac from corrupted pointer */
35 : /* out */ "=r"(x
), "=r"(y
)
36 : /* in */ [in
] "r" (in
)
40 * Once stripped, the corrupted pointer is of the form 0x0000...wxyz.
41 * We expect the autia to indicate failure, producing a pointer of the
42 * form 0x000e....wxyz. Use xpaci and != for the test, rather than
43 * extracting explicit bits from the top, because the location of the
44 * error code "e" depends on the configuration of virtual memory.
51 perc
= (float) count
/ (float) TESTS
;
52 printf("Checks Passed: %0.2f%%\n", perc
* 100.0);