Add mips o32
This commit is contained in:
parent
2d2cb0c7aa
commit
50ce8f2718
22
print.c
22
print.c
@ -16,6 +16,16 @@ long print(const void *buf, long count) {
|
|||||||
: "r" (buf), "r"(count) // Input operand: status
|
: "r" (buf), "r"(count) // Input operand: status
|
||||||
: "x0", "x8" // Clobbered registers
|
: "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
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -36,6 +46,14 @@ void exit(int status) {
|
|||||||
: "r" ((long)status) // Input operand: status
|
: "r" ((long)status) // Input operand: status
|
||||||
: "x0", "x8" // Clobbered registers
|
: "x0", "x8" // Clobbered registers
|
||||||
);
|
);
|
||||||
|
#elif defined(__mips__)
|
||||||
|
asm ( "move $a0, %0\n"
|
||||||
|
"li $v0, 4001\n"
|
||||||
|
"syscall"
|
||||||
|
:
|
||||||
|
: "r" (status)
|
||||||
|
: "a0", "v0"
|
||||||
|
);
|
||||||
#endif
|
#endif
|
||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
@ -52,6 +70,10 @@ void __libc_start_main() {exit(main());}
|
|||||||
void _start() {
|
void _start() {
|
||||||
__libc_start_main();
|
__libc_start_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __start() {
|
||||||
|
_start();
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
printf("Compiled for x86_64 architecture\n");
|
printf("Compiled for x86_64 architecture\n");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user