diff options
-rw-r--r-- | coroutine/amd64/Context.s | 10 | ||||
-rw-r--r-- | coroutine/arm32/Context.s | 2 | ||||
-rw-r--r-- | coroutine/arm64/Context.s | 2 | ||||
-rw-r--r-- | coroutine/win32/Context.asm | 4 | ||||
-rw-r--r-- | coroutine/win32/Context.h | 2 | ||||
-rw-r--r-- | coroutine/win64/Context.asm | 4 | ||||
-rw-r--r-- | coroutine/win64/Context.h | 2 |
7 files changed, 14 insertions, 12 deletions
diff --git a/coroutine/amd64/Context.s b/coroutine/amd64/Context.s index e23f87de85..0c4296035e 100644 --- a/coroutine/amd64/Context.s +++ b/coroutine/amd64/Context.s @@ -21,13 +21,13 @@ _coroutine_transfer: pushq %r13 pushq %r14 pushq %r15 - + # Save caller stack pointer movq %rsp, (%rdi) - + # Restore callee stack pointer movq (%rsi), %rsp - + # Restore callee stack popq %r15 popq %r14 @@ -35,9 +35,9 @@ _coroutine_transfer: popq %r12 popq %rbx popq %rbp - + # Put the first argument into the return value movq %rdi, %rax - + # We pop the return address and jump to it ret diff --git a/coroutine/arm32/Context.s b/coroutine/arm32/Context.s index 86a80f3db2..c2b93d0a34 100644 --- a/coroutine/arm32/Context.s +++ b/coroutine/arm32/Context.s @@ -11,4 +11,4 @@ coroutine_transfer: stmia r1!, {r4-r11,sp,lr} ldmia r0!, {r4-r11,sp,pc} - bx lr
\ No newline at end of file + bx lr diff --git a/coroutine/arm64/Context.s b/coroutine/arm64/Context.s index 2410dfc7cd..f6e5f0a6bc 100644 --- a/coroutine/arm64/Context.s +++ b/coroutine/arm64/Context.s @@ -7,8 +7,10 @@ .text .align 2 + .global coroutine_transfer coroutine_transfer: + # Make space on the stack for caller registers sub sp, sp, 0xb0 diff --git a/coroutine/win32/Context.asm b/coroutine/win32/Context.asm index 8fa13831bc..4917faf9d7 100644 --- a/coroutine/win32/Context.asm +++ b/coroutine/win32/Context.asm @@ -19,10 +19,10 @@ push ebx push edi push esi - + ; Save caller stack pointer mov dword ptr [ecx], esp - + ; Restore callee stack pointer mov esp, dword ptr [edx] diff --git a/coroutine/win32/Context.h b/coroutine/win32/Context.h index 1953646882..cea0345db1 100644 --- a/coroutine/win32/Context.h +++ b/coroutine/win32/Context.h @@ -58,4 +58,4 @@ inline void coroutine_destroy(coroutine_context * context) #if __cplusplus } -#endif
\ No newline at end of file +#endif diff --git a/coroutine/win64/Context.asm b/coroutine/win64/Context.asm index 6f64547d80..d699bd14ad 100644 --- a/coroutine/win64/Context.asm +++ b/coroutine/win64/Context.asm @@ -16,10 +16,10 @@ coroutine_transfer proc push r13 push r14 push r15 - + ; Save caller stack pointer mov [rcx], rsp - + ; Restore callee stack pointer mov rsp, [rdx] diff --git a/coroutine/win64/Context.h b/coroutine/win64/Context.h index 28173ba789..ec2c0e8566 100644 --- a/coroutine/win64/Context.h +++ b/coroutine/win64/Context.h @@ -58,4 +58,4 @@ inline void coroutine_destroy(coroutine_context * context) #if __cplusplus } -#endif
\ No newline at end of file +#endif |