From 2279fe00f7bb71a6d2b21c5c24d7f9748d49f18c Mon Sep 17 00:00:00 2001 From: Denis Drakhnia Date: Mon, 25 Dec 2023 07:06:01 +0200 Subject: [PATCH] common: add exit_with_code --- tests/asm/include/common.S | 15 ++++++++++----- tests/asm/include/test_end.S | 3 +-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/asm/include/common.S b/tests/asm/include/common.S index 34a71d4..6bd5abd 100644 --- a/tests/asm/include/common.S +++ b/tests/asm/include/common.S @@ -54,7 +54,7 @@ #define exit(code) sys_exit code .macro set_exit_code code=0 - addd,0 0, 1, SCRATCH_REG3; \ + addd,0 0, \code, SCRATCH_REG3; \ stb,2 SCRATCH_REG3, [ exit_code ]; \ .endm @@ -73,6 +73,15 @@ } .endm + .macro exit_with_code + ldb,0 [ exit_code ], SCRATCH_REG3 + sys_exit SCRATCH_REG3 + .endm + + .macro skip_test + sys_exit 77 + .endm + #define write(MSG) \ .pushsection ".rodata"; \ local(str):; \ @@ -165,10 +174,6 @@ #define test_i32(OP, S1, S2, EXPECTED) test_helper(OP, cmpesb, S1, S2, EXPECTED) #define test_i64(OP, S1, S2, EXPECTED) test_helper(OP, cmpedb, S1, S2, EXPECTED) - .macro skip_test - exit(77) - .endm - #define MDL_E4S 3 /* Elbrus-4S */ #define MDL_E2S 4 /* Elbrus-2S+ */ #define MDL_E2SM 6 /* Elbrus-2SM */ diff --git a/tests/asm/include/test_end.S b/tests/asm/include/test_end.S index c2167fe..736c72a 100644 --- a/tests/asm/include/test_end.S +++ b/tests/asm/include/test_end.S @@ -1,8 +1,7 @@ #ifndef SRC_BASE_TEST_END_H #define SRC_BASE_TEST_END_H - ldb,0 [ exit_code ], SCRATCH_REG3 - exit(SCRATCH_REG3) + exit_with_code .size _start, . - _start .pushsection ".data"