binutils-gdb/sim/testsuite/microblaze/testutils.inc
Mike Frysinger cd09ab7c74 sim: microblaze: hook up libgloss syscalls
When in the virtual environment, have brki 8 trigger libgloss syscalls
like other ports.  This also matches the ABI that Linux uses for its
syscalls (ignoring the syscall table differences).
2021-05-04 21:47:10 -04:00

48 lines
753 B
PHP

# MACRO: system_call
# Make a libgloss/Linux system call
.macro system_call nr:req
addi r12, r0, \nr;
brki r14, 8;
.endm
# MACRO: exit
.macro exit nr:req
addi r3, r0, \nr;
bri 0;
.endm
# MACRO: pass
# Write 'pass' to stdout and quit
.macro pass
write 1, 1f, 5
exit 0
.data
1: .asciz "pass\n"
.endm
# MACRO: fail
# Write 'fail' to stdout and quit
.macro fail
write 1, 1f, 5
exit 1
.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
# MACRO: write
# Just like the write() C function; uses system calls
.macro write fd:req, buf:req, count:req
addi r5, r0, \fd;
addi r6, r0, \buf;
addi r7, r0, \count;
system_call 5
.endm