diff options
author | Ayke van Laethem <[email protected]> | 2024-06-24 20:22:16 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-07-22 16:21:26 +0200 |
commit | 725518f007663d6742f1e92ebc2d6d88418ccf61 (patch) | |
tree | 01489f64270419ddb28520cd040b24babddab475 /src/runtime/asm_mipsx.S | |
parent | 04d1261f8a48b18a4404c52f858c35c0668316cd (diff) | |
download | tinygo-725518f007663d6742f1e92ebc2d6d88418ccf61.tar.gz tinygo-725518f007663d6742f1e92ebc2d6d88418ccf61.zip |
all: add linux/mipsle support
This adds linux/mipsle (little endian Mips) support to TinyGo.
It also adds experimental linux/mips (big-endian) support. It doesn't
quite work yet, some parts of the standard library (like the reflect
package) currently seem to assume a little-endian system.
Diffstat (limited to 'src/runtime/asm_mipsx.S')
-rw-r--r-- | src/runtime/asm_mipsx.S | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/runtime/asm_mipsx.S b/src/runtime/asm_mipsx.S new file mode 100644 index 000000000..e38064364 --- /dev/null +++ b/src/runtime/asm_mipsx.S @@ -0,0 +1,40 @@ +.section .text.tinygo_scanCurrentStack +.global tinygo_scanCurrentStack +.type tinygo_scanCurrentStack, %function +tinygo_scanCurrentStack: + // Push callee-saved registers onto the stack. + addiu $sp, $sp, -40 + sw $ra, 36($sp) + sw $s8, 32($sp) + sw $s7, 28($sp) + sw $s6, 24($sp) + sw $s5, 20($sp) + sw $s4, 16($sp) + sw $s3, 12($sp) + sw $s2, 8($sp) + sw $s1, 4($sp) + sw $s0, ($sp) + + // Scan the stack. + jal tinygo_scanstack + move $a0, $sp // in the branch delay slot + + // Restore return address. + lw $ra, 36($sp) + + // Restore stack state. + addiu $sp, $sp, 40 + + // Return to the caller. + jalr $ra + nop + +.section .text.tinygo_longjmp +.global tinygo_longjmp +tinygo_longjmp: + // Note: the code we jump to assumes a0 is non-zero, which is already the + // case because that's the defer frame pointer. + lw $sp, 0($a0) // jumpSP + lw $a1, 4($a0) // jumpPC + jr $a1 + nop |