From 50ce8f27188d9ccf9ef8fabacc09c0fb828a4083 Mon Sep 17 00:00:00 2001 From: Lucas Schumacher Date: Mon, 7 Apr 2025 22:34:57 -0400 Subject: [PATCH] Add mips o32 --- print.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/print.c b/print.c index 4665d67..b90426b 100644 --- a/print.c +++ b/print.c @@ -16,6 +16,16 @@ long print(const void *buf, long count) { : "r" (buf), "r"(count) // Input operand: status : "x0", "x8" // Clobbered registers ); + #elif defined(__mips__) + asm ( "li $a0, 1\n" + "move $a1, %0\n" + "move $a2, %1\n" + "li $v0, 4004\n" + "syscall" + : + : "r"(buf), "r"(count) + : "a0", "a1", "a2", "v0" //TODO: temp registers clobbered by syscall should probably also be listed but this fn returns right away so it should be fine? + ); #endif return 0; } @@ -36,6 +46,14 @@ void exit(int status) { : "r" ((long)status) // Input operand: status : "x0", "x8" // Clobbered registers ); + #elif defined(__mips__) + asm ( "move $a0, %0\n" + "li $v0, 4001\n" + "syscall" + : + : "r" (status) + : "a0", "v0" + ); #endif for(;;); } @@ -52,6 +70,10 @@ void __libc_start_main() {exit(main());} void _start() { __libc_start_main(); } + +void __start() { + _start(); +} /* #if defined(__x86_64__) printf("Compiled for x86_64 architecture\n");