qemu/tests/tcg/aarch64/pauth.h
Richard Henderson 871a7f6a9a tests/tcg/aarch64: Adjust pauth tests for FEAT_FPAC
With FEAT_FPAC, AUT* instructions that fail authentication
do not produce an error value but instead fault.

For pauth-2, install a signal handler and verify it gets called.

For pauth-4 and pauth-5, we are explicitly testing the error value,
so there's nothing to test with FEAT_FPAC, so exit early.
Adjust the makefile to use -cpu neoverse-v1, which has FEAT_EPAC
but not FEAT_FPAC.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230829232335.965414-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-09-08 12:50:44 +01:00

24 lines
539 B
C

/*
* Helper for pauth test case
*
* Copyright (c) 2023 Linaro Ltd
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <assert.h>
#include <sys/auxv.h>
static int get_pac_feature(void)
{
unsigned long isar1, isar2;
assert(getauxval(AT_HWCAP) & HWCAP_CPUID);
asm("mrs %0, id_aa64isar1_el1" : "=r"(isar1));
asm("mrs %0, S3_0_C0_C6_2" : "=r"(isar2)); /* id_aa64isar2_el1 */
return ((isar1 >> 4) & 0xf) /* APA */
| ((isar1 >> 8) & 0xf) /* API */
| ((isar2 >> 12) & 0xf); /* APA3 */
}