參考資訊:
https://chromium.googlesource.com/chromiumos/docs/+/HEAD/constants/syscalls.md
https://teaching.basilico.di.unimi.it/lib/exe/fetch.php/pub/debian-mips-tutorial.pdf
main.s
.global main .data msg: .asciz "hello, world!\n" len = . - msg .text main: li $v0, 4004 li $a0, 1 la $a1, msg li $a2, len syscall li $v0, 4001 li $a0, 0 syscall
NR | syscall name | v0 | arg0(a0) | arg1(a1) | arg2(a2) |
---|---|---|---|---|---|
4001 | exit | 1 | int error_code | ||
4004 | write | 4 | unsigned int fd | const char *buf | size_t count |
編譯、執行
$ mipsel-linux-gnu-gcc main.s -o main -static $ qemu-mipsel ./main hello, world!