aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_mipsx.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/asm_mipsx.s')
-rw-r--r--src/runtime/asm_mipsx.s16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime/asm_mipsx.s b/src/runtime/asm_mipsx.s
index 87a1344e8f..4dc165849e 100644
--- a/src/runtime/asm_mipsx.s
+++ b/src/runtime/asm_mipsx.s
@@ -382,6 +382,22 @@ CALLFN(·call1073741824, 1073741824)
TEXT runtime·procyield(SB),NOSPLIT,$0-4
RET
+// void jmpdefer(fv, sp);
+// called from deferreturn.
+// 1. grab stored LR for caller
+// 2. sub 8 bytes to get back to JAL deferreturn
+// 3. JMP to fn
+TEXT runtime·jmpdefer(SB),NOSPLIT,$0-8
+ MOVW 0(R29), R31
+ ADDU $-8, R31
+
+ MOVW fv+0(FP), REGCTXT
+ MOVW argp+4(FP), R29
+ ADDU $-4, R29
+ NOR R0, R0 // prevent scheduling
+ MOVW 0(REGCTXT), R4
+ JMP (R4)
+
// Save state of caller into g->sched,
// but using fake PC from systemstack_switch.
// Must only be called from functions with no locals ($0)