diff --git a/litmus/litmus_tests/exc/MP+daifset+dmb.c b/litmus/litmus_tests/exc/MP+daifset+dmb.c new file mode 100644 index 0000000..7312fa4 --- /dev/null +++ b/litmus/litmus_tests/exc/MP+daifset+dmb.c @@ -0,0 +1,68 @@ + +#include "lib.h" + +#define VARS x, y +#define REGS p1x0, p1x2 + +static void P0(litmus_test_run* data) { + asm volatile ( + "mov x0, #1\n\t" + "str x0, [%[x]]\n\t" + + "msr daifset, #5\n\t" + + "mov x2, #1\n\t" + "str x2, [%[y]]\n\t" + : + : ASM_VARS(data, VARS), + ASM_REGS(data, REGS) + : "cc", "memory", "x0", "x2" + ); +} + +static void P1(litmus_test_run* data) { + asm volatile ( + /* load variables into machine registers */ + "mov x1, %[y]\n\t" + "mov x3, %[x]\n\t" + + /* test */ + "ldr x0, [x1]\n\t" + + "dmb sy\n\t" + + "ldr x2, [x3]\n\t" + + /* extract values */ + "str x0, [%[outp1r0]]\n\t" + "str x2, [%[outp1r2]]\n\t" + : + : ASM_VARS(data, VARS), + ASM_REGS(data, REGS) + : "cc", "memory", "x0", "x1", "x2", "x3", "x4", "x5", "x6", + "x7" /* dont touch parameter registers */ + ); +} + + + +litmus_test_t MP_daifset_dmb = { + "MP+daifset+dmb", + MAKE_THREADS(2), + MAKE_VARS(VARS), + MAKE_REGS(REGS), + INIT_STATE( + 2, + INIT_VAR(x, 0), + INIT_VAR(y, 0) + ), + .thread_sync_handlers = + (u32**[]){ + (u32*[]){NULL, NULL}, + (u32*[]){NULL, NULL}, + }, + .interesting_result = (u64[]){ + /* p1:x0 =*/1, + /* p1:x2 =*/0, + }, +}; diff --git a/litmus/litmus_tests/exc/MP+dmb+daifset.c b/litmus/litmus_tests/exc/MP+dmb+daifset.c new file mode 100644 index 0000000..9da90b8 --- /dev/null +++ b/litmus/litmus_tests/exc/MP+dmb+daifset.c @@ -0,0 +1,68 @@ + +#include "lib.h" + +#define VARS x, y +#define REGS p1x0, p1x2 + +static void P0(litmus_test_run* data) { + asm volatile ( + "mov x0, #1\n\t" + "str x0, [%[x]]\n\t" + + "dmb sy\n\t" + + "mov x2, #1\n\t" + "str x2, [%[y]]\n\t" + : + : ASM_VARS(data, VARS), + ASM_REGS(data, REGS) + : "cc", "memory", "x0", "x2" + ); +} + +static void P1(litmus_test_run* data) { + asm volatile ( + /* load variables into machine registers */ + "mov x1, %[y]\n\t" + "mov x3, %[x]\n\t" + + /* test */ + "ldr x0, [x1]\n\t" + + "msr daifset, #5\n\t" + + "ldr x2, [x3]\n\t" + + /* extract values */ + "str x0, [%[outp1r0]]\n\t" + "str x2, [%[outp1r2]]\n\t" + : + : ASM_VARS(data, VARS), + ASM_REGS(data, REGS) + : "cc", "memory", "x0", "x1", "x2", "x3", "x4", "x5", "x6", + "x7" /* dont touch parameter registers */ + ); +} + + + +litmus_test_t MP_dmb_daifset = { + "MP+dmb+daifset", + MAKE_THREADS(2), + MAKE_VARS(VARS), + MAKE_REGS(REGS), + INIT_STATE( + 2, + INIT_VAR(x, 0), + INIT_VAR(y, 0) + ), + .thread_sync_handlers = + (u32**[]){ + (u32*[]){NULL, NULL}, + (u32*[]){NULL, NULL}, + }, + .interesting_result = (u64[]){ + /* p1:x0 =*/1, + /* p1:x2 =*/0, + }, +}; diff --git a/litmus/litmus_tests/exc/SB+daifsets.c b/litmus/litmus_tests/exc/SB+daifsets.c new file mode 100644 index 0000000..41a6de6 --- /dev/null +++ b/litmus/litmus_tests/exc/SB+daifsets.c @@ -0,0 +1,74 @@ +#include "lib.h" + +#define VARS x, y +#define REGS p0x2, p1x2 + +static void P0(litmus_test_run* data) { + asm volatile ( + /* initial registers */ + "mov x0, #1\n\t" + "mov x1, %[x]\n\t" + "mov x3, %[y]\n\t" + + /* test */ + "str x0, [x1]\n\t" + + "msr daifset, #5\n\t" + + "ldr x2, [x3]\n\t" + + /* extract values */ + "str x2, [%[outp0r2]]\n\t" + : + : ASM_VARS(data, VARS), + ASM_REGS(data, REGS) + : "cc", "memory", "x0", "x1", "x2", "x3" + ); +} + +static void P1(litmus_test_run* data) { + asm volatile ( + /* initial registers */ + "mov x0, #1\n\t" + "mov x1, %[y]\n\t" + "mov x3, %[x]\n\t" + + /* test */ + "str x0, [x1]\n\t" + + "msr daifset, #5\n\t" + + "ldr x2, [x3]\n\t" + + /* extract values */ + "str x2, [%[outp1r2]]\n\t" + : + : ASM_VARS(data, VARS), + ASM_REGS(data, REGS) + : "cc", "memory", "x0", "x1", "x2", "x3" + ); +} + +litmus_test_t SB_daifsets = { + "SB+daifsets", + MAKE_THREADS(2), + MAKE_VARS(VARS), + MAKE_REGS(REGS), + INIT_STATE( + 2, + INIT_VAR(x, 0), + INIT_VAR(y, 0) + ), + .thread_sync_handlers = (u32**[]){ + (u32*[]){NULL, NULL}, + (u32*[]){NULL, NULL}, + }, + .interesting_result = (u64[]){ + /* p0:x2 =*/0, + /* p1:x2 =*/0, + }, + .no_sc_results=3, + .expected_allowed = (arch_allow_st[]) { + {"armv8", OUTCOME_UNKNOWN}, + } +};