Skip to content

Commit b3b90a6

Browse files
committed
[litmus] Introduce EXS, EIS and EOS variants to litmus
1 parent 2d1712a commit b3b90a6

File tree

14 files changed

+159
-4
lines changed

14 files changed

+159
-4
lines changed

catalogue/aarch64-faults/shelf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"tests/MP+dmb.st+ctrl-svc.exs1eis1.litmus",
2121
"tests/SVC-ifetch.exs1eis0.litmus",
2222
"tests/SVC-ifetch.exs1eis1.litmus",
23+
"tests/SVC-ifetch.dic0idc0-exs1eis0.litmus",
24+
"tests/SVC-ifetch.dic0idc0-exs1eis1.litmus",
2325
# "tests/SVC-pte.exs1eis0.litmus",
2426
# "tests/SVC-pte.exs1eis1.litmus",
2527
]

catalogue/aarch64-faults/tests/@all

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ MP+dmb.st+ctrl-svc.exs1eis0.litmus
99
MP+dmb.st+ctrl-svc.exs1eis1.litmus
1010
SVC-ifetch.exs1eis0.litmus
1111
SVC-ifetch.exs1eis1.litmus
12+
SVC-ifetch.dic0idc0-exs1eis0.litmus
13+
SVC-ifetch.dic0idc0-exs1eis1.litmus
1214
SVC-pte.exs1eis0.litmus
1315
SVC-pte.exs1eis1.litmus
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AArch64 SVC-ifetch.dic0idc0-exs1eis0.litmus
2+
variant=ifetch,exs
3+
{
4+
0:X0=instr:"NOP"; 0:X1=P0:L2;
5+
}
6+
P0 | P0.F ;
7+
STR W0,[X1] | ERET ;
8+
DC CVAU, X1 |;
9+
DSB ISH |;
10+
IC IVAU, X1 |;
11+
DSB ISH |;
12+
SVC #0 |;
13+
L2: |;
14+
B L1 |;
15+
MOV W9,#1 |;
16+
L1: |;
17+
18+
exists(0:X9=0)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AArch64 SVC-ifetch.dic0idc0-exs1eis1
2+
variant=ifetch,exs,eis
3+
{
4+
0:X0=instr:"NOP"; 0:X1=P0:L2;
5+
}
6+
P0 | P0.F ;
7+
STR W0,[X1] | ERET ;
8+
DC CVAU, X1 |;
9+
DSB ISH |;
10+
IC IVAU, X1 |;
11+
DSB ISH |;
12+
SVC #0 |;
13+
L2: |;
14+
B L1 |;
15+
MOV W9,#1 |;
16+
L1: |;
17+
18+
exists(0:X9=0)

catalogue/aarch64-faults/tests/kinds.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ SVC-pte.exs1eis0 Allowed
1111
SVC-pte.exs1eis1 Forbid
1212
SVC-ifetch.exs1eis0 Allowed
1313
SVC-ifetch.exs1eis1 Forbid
14+
SVC-ifetch.dic0idc0-exs1eis0 Allowed
15+
SVC-ifetch.dic0idc0-exs1eis1 Forbid

litmus/dumpRun.ml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ end = struct
139139
if flags.Flags.memtag then
140140
"memtag.o"::utils
141141
else utils in
142+
let utils =
143+
if flags.Flags.exs then
144+
"exs.o"::utils
145+
else utils in
142146
let utils =
143147
if flags.Flags.pac then
144148
"auth.o"::utils
@@ -210,10 +214,11 @@ let collect_flags names =
210214
let open Flags in
211215
{ pac = flags.pac || some_flags.pac;
212216
self = flags.self || some_flags.self;
213-
memtag = flags.memtag || some_flags.memtag;}
217+
memtag = flags.memtag || some_flags.memtag;
218+
exs = flags.exs || some_flags.exs;}
214219
| _ -> some_flags)
215220
names
216-
{Flags.pac=false; Flags.self=false; Flags.memtag=false}
221+
{Flags.pac=false; Flags.self=false; Flags.memtag=false; Flags.exs=false}
217222

218223
let run_tests names flags out_chan =
219224

litmus/flags.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ type t =
2121
pac : bool ; (* Requires pointer authentification *)
2222
self : bool ; (* Self modying code *)
2323
memtag : bool ; (* Requires memory tagging *)
24+
exs : bool ; (* Requires ExS helpers *)
2425
}

litmus/libdir/_aarch64/_exs.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/****************************************************************************/
2+
/* the diy toolsuite */
3+
/* */
4+
/* Jade Alglave, University College London, UK. */
5+
/* Luc Maranget, INRIA Paris-Rocquencourt, France. */
6+
/* */
7+
/* Copyright 2026-present Institut National de Recherche en Informatique et */
8+
/* en Automatique and the authors. All rights reserved. */
9+
/* */
10+
/* This software is governed by the CeCILL-B license under French law and */
11+
/* abiding by the rules of distribution of free software. You can use, */
12+
/* modify and/ or redistribute the software under the terms of the CeCILL-B */
13+
/* license as circulated by CEA, CNRS and INRIA at the following URL */
14+
/* "http://www.cecill.info". We also give a copy in LICENSE.txt. */
15+
/****************************************************************************/
16+
#include "kvm-headers.h"
17+
#include "exs.h"
18+
19+
#define MMFR0_EXS_SHIFT 44
20+
#define MMFR0_EXS_MASK 0xf
21+
22+
int check_exs(const char *tname) {
23+
uint64_t mmfr0;
24+
asm volatile("mrs %0, ID_AA64MMFR0_EL1" : "=r" (mmfr0));
25+
int exs = (mmfr0 >> MMFR0_EXS_SHIFT) & MMFR0_EXS_MASK;
26+
if (exs == 0) {
27+
printf("Test %s, ExS not supported on this system\n", tname);
28+
return 0;
29+
}
30+
return 1;
31+
}
32+
33+
void init_exs(int eis_val, int eos_val) {
34+
uint64_t sctlr;
35+
asm volatile("mrs %0, SCTLR_EL1" : "=r" (sctlr));
36+
sctlr = eis_val ? (sctlr | SCTLR_EL1_EIS) : (sctlr & ~SCTLR_EL1_EIS);
37+
sctlr = eos_val ? (sctlr | SCTLR_EL1_EOS) : (sctlr & ~SCTLR_EL1_EOS);
38+
asm volatile("msr SCTLR_EL1, %0" :: "r" (sctlr));
39+
asm volatile("isb");
40+
}

litmus/libdir/_aarch64/_exs.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/****************************************************************************/
2+
/* the diy toolsuite */
3+
/* */
4+
/* Jade Alglave, University College London, UK. */
5+
/* Luc Maranget, INRIA Paris-Rocquencourt, France. */
6+
/* */
7+
/* Copyright 2026-present Institut National de Recherche en Informatique et */
8+
/* en Automatique and the authors. All rights reserved. */
9+
/* */
10+
/* This software is governed by the CeCILL-B license under French law and */
11+
/* abiding by the rules of distribution of free software. You can use, */
12+
/* modify and/ or redistribute the software under the terms of the CeCILL-B */
13+
/* license as circulated by CEA, CNRS and INRIA at the following URL */
14+
/* "http://www.cecill.info". We also give a copy in LICENSE.txt. */
15+
/****************************************************************************/
16+
#ifndef _LITMUS_EXS_H
17+
#define _LITMUS_EXS_H 1
18+
19+
int check_exs(const char *tname);
20+
void init_exs(int eis_val, int eos_val);
21+
22+
#endif

litmus/objUtil.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,15 @@ module Make(O:Config)(Tar:Tar.S) =
272272
fnames
273273
end
274274
else fnames in
275+
let fnames =
276+
if flags.Flags.exs then
277+
begin
278+
let sub = dir_of_sysarch O.sysarch in
279+
let fnames = cpy ~sub:sub fnames "exs" ".c" in
280+
let fnames = cpy ~sub:sub fnames "exs" ".h" in
281+
fnames
282+
end
283+
else fnames in
275284
let fnames =
276285
if flags.Flags.pac then
277286
let sub = dir_of_sysarch O.sysarch in

0 commit comments

Comments
 (0)