diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2010-02-26 13:57:50 +0100 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2010-02-26 13:57:50 +0100 |
commit | 9a52f0dd19a1d3314b435fade0a5338609e838a1 (patch) | |
tree | 9be84e54fdc7b375b2778705659176d6ecbfc6b5 /library/fibers/switchstack_gcc_32_linux_mac.s | |
parent | 754a63ff40fd78be7bc0bf70c8b072d079e1fac9 (diff) |
Diffstat (limited to 'library/fibers/switchstack_gcc_32_linux_mac.s')
-rw-r--r-- | library/fibers/switchstack_gcc_32_linux_mac.s | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/library/fibers/switchstack_gcc_32_linux_mac.s b/library/fibers/switchstack_gcc_32_linux_mac.s new file mode 100644 index 0000000..e4eac63 --- /dev/null +++ b/library/fibers/switchstack_gcc_32_linux_mac.s @@ -0,0 +1,41 @@ +.text +.globl _switchStackInternal + +_switchStackInternal: + // save callee-saved registers + push %ebp + movl %esp, %ebp + push %ebx + push %esi + push %edi + + // store SIMD floating point control word + sub $4, %esp + stmxcsr (%esp) + + // store floating point control bytes + sub $4, %esp + fstcw (%esp) + + // save the old stack pointer + movl 0xc(%ebp), %edx + movl %esp, (%edx) + // set the new stack pointer + movl 0x8(%ebp), %esp + + // restore floating point control bytes + fnclex + fldcw (%esp) + add $4, %esp + + // restore SIMD floating point control word + ldmxcsr (%esp) + add $4, %esp + + // pop callee-saved registers + pop %edi + pop %esi + pop %ebx + pop %ebp + + ret |