aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/rt0_amd64.s
diff options
context:
space:
mode:
authorKen Thompson <ken@golang.org>2009-01-27 12:03:53 -0800
committerKen Thompson <ken@golang.org>2009-01-27 12:03:53 -0800
commit1e1cc4eb570aa6fec645ff4faf13431847b99db8 (patch)
treebbbf12c48e9ab2d82b89e6a0adf15f15757e57af /src/runtime/rt0_amd64.s
parent4a903e0b32be5a590880ceb7379e68790602c29d (diff)
downloadgo-1e1cc4eb570aa6fec645ff4faf13431847b99db8.tar.xz
defer
R=r OCL=23592 CL=23592
Diffstat (limited to 'src/runtime/rt0_amd64.s')
-rw-r--r--src/runtime/rt0_amd64.s12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/runtime/rt0_amd64.s b/src/runtime/rt0_amd64.s
index 8588d61a4e..f8d4a381b3 100644
--- a/src/runtime/rt0_amd64.s
+++ b/src/runtime/rt0_amd64.s
@@ -120,7 +120,7 @@ TEXT setspgoto(SB), 7, $0
// if(*val == old){
// *val = new;
// return 1;
-// }else
+// } else
// return 0;
TEXT cas(SB), 7, $0
MOVQ 8(SP), BX
@@ -133,3 +133,13 @@ TEXT cas(SB), 7, $0
RET
MOVL $1, AX
RET
+
+// void jmpdefer(byte*);
+// 1. pop the caller
+// 2. sub 5 bytes from the callers return
+// 3. jmp to the argument
+TEXT jmpdefer(SB), 7, $0
+ MOVQ 8(SP), AX // function
+ ADDQ $(8+56), SP // pop saved PC and callers frame
+ SUBQ $5, (SP) // reposition his return address
+ JMP AX // and goto function