From: Andrew Cooper Date: Sat, 2 Mar 2024 22:49:49 +0000 (+0000) Subject: test-swint: Update to avoid using test_wants_user_mappings X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=997566c2637af370fa886ed715339694bada714e;p=xtf.git test-swint: Update to avoid using test_wants_user_mappings Create a second set stubs, and place them in .text.user. No change in test behaviour. Signed-off-by: Andrew Cooper --- diff --git a/tests/swint-emulation/lowlevel.S b/tests/swint-emulation/lowlevel.S index 53bb72c..ffd1ddb 100644 --- a/tests/swint-emulation/lowlevel.S +++ b/tests/swint-emulation/lowlevel.S @@ -62,19 +62,29 @@ ENDFUNC(stub_\name\()) .endm /* For a single instruction, generate each test variant. */ -.macro GEN_SEQUENCE insn - GEN_SINGLE \insn \insn - GEN_SINGLE \insn\()_A \insn addr=1 - GEN_SINGLE \insn\()_F \insn fep=1 - GEN_SINGLE \insn\()_FA \insn fep=1 addr=1 +.macro GEN_SEQUENCE user insn + GEN_SINGLE \user\()\insn \insn + GEN_SINGLE \user\()\insn\()_A \insn addr=1 + GEN_SINGLE \user\()\insn\()_F \insn fep=1 + GEN_SINGLE \user\()\insn\()_FA \insn fep=1 addr=1 .endm /* Generate test sequences for each instruction. */ -GEN_SEQUENCE int3 -GEN_SEQUENCE int_0x3 -GEN_SEQUENCE icebp -GEN_SEQUENCE int_0x1 -GEN_SEQUENCE into +GEN_SEQUENCE , int3 +GEN_SEQUENCE , int_0x3 +GEN_SEQUENCE , icebp +GEN_SEQUENCE , int_0x1 +GEN_SEQUENCE , into + +.pushsection .text.user, "ax", @progbits + +GEN_SEQUENCE user_ int3 +GEN_SEQUENCE user_ int_0x3 +GEN_SEQUENCE user_ icebp +GEN_SEQUENCE user_ int_0x1 +GEN_SEQUENCE user_ into + +.popsection /* * Local variables: diff --git a/tests/swint-emulation/lowlevel.h b/tests/swint-emulation/lowlevel.h index e3ab755..b5ff371 100644 --- a/tests/swint-emulation/lowlevel.h +++ b/tests/swint-emulation/lowlevel.h @@ -6,6 +6,8 @@ * Nomaclature: * - `stub_$X_$Y()` * - Stub function executing instruction `$X` with prefix `$Y`. + * - `stub_user_$X_$Y()` + * - Stub function executing instruction `$X` with prefix `$Y` in userspace. * * Instructions `$X`: * - int3 @@ -57,6 +59,32 @@ unsigned long stub_into_A(void); unsigned long stub_into_F(void); unsigned long stub_into_FA(void); + +unsigned long stub_user_int3(void); +unsigned long stub_user_int3_A(void); +unsigned long stub_user_int3_F(void); +unsigned long stub_user_int3_FA(void); + +unsigned long stub_user_int_0x3(void); +unsigned long stub_user_int_0x3_A(void); +unsigned long stub_user_int_0x3_F(void); +unsigned long stub_user_int_0x3_FA(void); + +unsigned long stub_user_icebp(void); +unsigned long stub_user_icebp_A(void); +unsigned long stub_user_icebp_F(void); +unsigned long stub_user_icebp_FA(void); + +unsigned long stub_user_int_0x1(void); +unsigned long stub_user_int_0x1_A(void); +unsigned long stub_user_int_0x1_F(void); +unsigned long stub_user_int_0x1_FA(void); + +unsigned long stub_user_into(void); +unsigned long stub_user_into_A(void); +unsigned long stub_user_into_F(void); +unsigned long stub_user_into_FA(void); + #endif /* __LOWLEVEL_H__ */ /* diff --git a/tests/swint-emulation/main.c b/tests/swint-emulation/main.c index a4d1452..8d9b48b 100644 --- a/tests/swint-emulation/main.c +++ b/tests/swint-emulation/main.c @@ -50,8 +50,6 @@ const char test_title[] = "Software interrupt emulation"; -bool test_wants_user_mappings = true; - #ifdef __i386__ # define COND(_32, _64) _32 #else @@ -74,6 +72,7 @@ struct insn { const char *name; unsigned long (*fn[4])(void); + unsigned long (*user_fn[4])(void); }; const struct insn int3 = { @@ -84,6 +83,12 @@ const struct insn int3 = { stub_int3_F, stub_int3_FA, }, + { + stub_user_int3, + stub_user_int3_A, + stub_user_int3_F, + stub_user_int3_FA, + }, }; const struct insn int_0x3 = { @@ -94,6 +99,12 @@ const struct insn int_0x3 = { stub_int_0x3_F, stub_int_0x3_FA, }, + { + stub_user_int_0x3, + stub_user_int_0x3_A, + stub_user_int_0x3_F, + stub_user_int_0x3_FA, + }, }; const struct insn icebp = { @@ -104,6 +115,12 @@ const struct insn icebp = { stub_icebp_F, stub_icebp_FA, }, + { + stub_user_icebp, + stub_user_icebp_A, + stub_user_icebp_F, + stub_user_icebp_FA, + }, }; const struct insn int_0x1 = { @@ -114,6 +131,12 @@ const struct insn int_0x1 = { stub_int_0x1_F, stub_int_0x1_FA, }, + { + stub_user_int_0x1, + stub_user_int_0x1_A, + stub_user_int_0x1_F, + stub_user_int_0x1_FA, + }, }; const struct insn into = { @@ -124,6 +147,12 @@ const struct insn into = { stub_into_F, stub_into_FA, }, + { + stub_user_into, + stub_user_into_A, + stub_user_into_F, + stub_user_into_FA, + }, }; void test_insn(enum mode user, const struct insn *insn, exinfo_t exp) @@ -134,7 +163,7 @@ void test_insn(enum mode user, const struct insn *insn, exinfo_t exp) { exinfo_t got; - got = user ? exec_user(insn->fn[i]) : insn->fn[i](); + got = user ? exec_user(insn->user_fn[i]) : insn->fn[i](); if ( exp != got ) xtf_failure(" Fail (Force%c, Addr%c): expected %pe %s, got %pe %s\n",