1 # MACRO: exit 2 .macro exit nr 3 li a0, \nr 4 # The exit utility function. 5 li a7, 93; 6 # Trigger OS trap. 7 ecall; 8 .endm 9 10 # MACRO: pass 11 # Write 'pass' to stdout and quit. 12 .macro pass 13 # syscall write(). 14 li a7, 64; 15 # Use stdout. 16 li a0, 1; 17 # Point to the string. 18 lla a1, 1f; 19 # Number of bytes to write. 20 li a2, 5; 21 # Trigger OS trap. 22 ecall; 23 exit 0; 24 .pushsection .data 25 1: .asciz "pass\n" 26 .popsection 27 .endm 28 29 # MACRO: fail 30 # Write 'fail' to stdout and quit. 31 .macro fail 32 # syscall write(). 33 li a7, 64; 34 # Use stdout. 35 li a0, 1; 36 # Point to the string. 37 la a1, 1f; 38 # Number of bytes to write. 39 li a2, 5; 40 # Trigger OS trap. 41 ecall; 42 exit 0; 43 .pushsection .data 44 1: .asciz "fail\n" 45 .popsection 46 .endm 47 48 # MACRO: start 49 # All assembler tests should start with a call to "start". 50 .macro start 51 .text 52 .global _start 53 _start: 54 .option push 55 .option norelax 56 lla gp, __global_pointer$ 57 .option pop 58 .endm 59