common: add exit_with_code

This commit is contained in:
Denis Drakhnia 2023-12-25 07:06:01 +02:00
parent 2ddd3e9a5a
commit 2279fe00f7
2 changed files with 11 additions and 7 deletions

View File

@ -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 */

View File

@ -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"