sme_trap_za.c (707B)
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2021 ARM Limited 4 * 5 * Verify that accessing ZA without enabling it generates a SIGILL. 6 */ 7 8#include <signal.h> 9#include <ucontext.h> 10#include <sys/prctl.h> 11 12#include "test_signals_utils.h" 13#include "testcases.h" 14 15int sme_trap_za_trigger(struct tdescr *td) 16{ 17 /* ZERO ZA */ 18 asm volatile(".inst 0xc00800ff"); 19 20 return 0; 21} 22 23int sme_trap_za_run(struct tdescr *td, siginfo_t *si, ucontext_t *uc) 24{ 25 return 1; 26} 27 28struct tdescr tde = { 29 .name = "SME ZA trap", 30 .descr = "Check that we get a SIGILL if we access ZA without enabling", 31 .timeout = 3, 32 .sanity_disabled = true, 33 .trigger = sme_trap_za_trigger, 34 .run = sme_trap_za_run, 35 .sig_ok = SIGILL, 36};