Created
February 6, 2012 09:10
-
-
Save kikairoya/1750972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S b/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S | |
index ee27876..25c3339 100644 | |
--- a/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S | |
+++ b/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S | |
@@ -86,9 +86,13 @@ boost_fcontext_make: | |
movl %ecx, 0x14(%eax) /* save the address of the function supposed to run */ | |
movl 0x20(%eax), %edx /* load the stack base */ | |
+ pushl %ebx | |
pushl %eax /* save pointer to fcontext_t */ | |
pushl %edx /* stack pointer as arg for boost_fcontext_align */ | |
#ifdef __PIC__ | |
+ call 4f | |
+4: popl %ebx | |
+ addl $_GLOBAL_OFFSET_TABLE_+[.-4b], %ebx | |
call boost_fcontext_align@PLT /* align stack */ | |
#else | |
call boost_fcontext_align /* align stack */ | |
@@ -96,6 +100,7 @@ boost_fcontext_make: | |
movl %eax, %edx /* begin of aligned stack */ | |
popl %eax /* remove arg for boost_fcontext_align */ | |
popl %eax /* restore pointer to fcontext_t */ | |
+ popl %ebx | |
leal -0x14(%edx), %edx /* reserve space for the last frame on stack, (ESP + 4) % 16 == 0 */ | |
movl %edx, 0x10(%eax) /* save the address as stack pointer */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment