binutils-gdb/sim/testsuite/riscv/testutils.inc

53 lines
783 B
PHP
Raw Normal View History

# MACRO: exit
.macro exit nr
li a0, \nr
# The exit utility function.
li a7, 93;
# Trigger OS trap.
ecall;
.endm
# MACRO: pass
# Write 'pass' to stdout and quit.
.macro pass
# syscall write().
li a7, 64;
# Use stdout.
li a0, 1;
# Point to the string.
lla a1, 1f;
# Number of bytes to write.
li a2, 5;
# Trigger OS trap.
ecall;
exit 0;
.data
1: .asciz "pass\n"
.endm
# MACRO: fail
# Write 'fail' to stdout and quit.
.macro fail
# syscall write().
li a7, 64;
# Use stdout.
li a0, 1;
# Point to the string.
lla a1, 1f;
# Number of bytes to write.
li a2, 5;
# Trigger OS trap.
ecall;
exit 0;
.data
1: .asciz "fail\n"
.endm
# MACRO: start
# All assembler tests should start with a call to "start".
.macro start
.text
.global _start
_start:
.endm