mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
b9249c461c
This is a hand-written implementation that should have fairly complete coverage for the base integer instruction set ("i"), and for the atomic ("a") and integer multiplication+division ("m") extensions. It also covers 32-bit & 64-bit targets. The unittest coverage is a bit weak atm, but should get better.
53 lines
783 B
PHP
53 lines
783 B
PHP
# 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
|