Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (C) 2021 ARM Limited
0004  *
0005  * Verify that using a streaming mode instruction without enabling it
0006  * generates a SIGILL.
0007  */
0008 
0009 #include <signal.h>
0010 #include <ucontext.h>
0011 #include <sys/prctl.h>
0012 
0013 #include "test_signals_utils.h"
0014 #include "testcases.h"
0015 
0016 int sme_trap_no_sm_trigger(struct tdescr *td)
0017 {
0018     /* SMSTART ZA ; ADDHA ZA0.S, P0/M, P0/M, Z0.S */
0019     asm volatile(".inst 0xd503457f ; .inst 0xc0900000");
0020 
0021     return 0;
0022 }
0023 
0024 int sme_trap_no_sm_run(struct tdescr *td, siginfo_t *si, ucontext_t *uc)
0025 {
0026     return 1;
0027 }
0028 
0029 struct tdescr tde = {
0030     .name = "SME trap without SM",
0031     .descr = "Check that we get a SIGILL if we use streaming mode without enabling it",
0032     .timeout = 3,
0033     .feats_required = FEAT_SME,   /* We need a SMSTART ZA */
0034     .sanity_disabled = true,
0035     .trigger = sme_trap_no_sm_trigger,
0036     .run = sme_trap_no_sm_run,
0037     .sig_ok = SIGILL,
0038 };