Ticket #9445: boost-x32-context.patch
File boost-x32-context.patch, 4.0 KB (added by , 9 years ago) |
---|
-
libs/context/src/asm/jump_x86_64_sysv_elf_gas.S
38 38 * * 39 39 * **************************************************************************************/ 40 40 41 #ifdef __ILP32__ 42 # define SIZEOF_FCONTEXT_T 0x50 43 #else 44 # define SIZEOF_FCONTEXT_T 0x58 45 #endif 46 41 47 .text 42 48 .globl jump_fcontext 43 49 .type jump_fcontext,@function … … jump_fcontext: 53 59 cmp $0, %rcx 54 60 je 1f 55 61 56 stmxcsr 0x50(%rdi) /* save MMX control and status word */57 fnstcw 0x54(%rdi) /* save x87 control word */62 stmxcsr (SIZEOF_FCONTEXT_T - 8)(%rdi) /* save MMX control and status word */ 63 fnstcw (SIZEOF_FCONTEXT_T - 4)(%rdi) /* save x87 control word */ 58 64 59 ldmxcsr 0x50(%rsi) /* restore MMX control and status word */60 fldcw 0x54(%rsi) /* restore x87 control word */65 ldmxcsr (SIZEOF_FCONTEXT_T - 8)(%rsi) /* restore MMX control and status word */ 66 fldcw (SIZEOF_FCONTEXT_T - 4)(%rsi) /* restore x87 control word */ 61 67 1: 62 68 63 69 leaq 0x8(%rsp), %rax /* exclude the return address and save as stack pointer */ -
libs/context/src/asm/make_x86_64_sysv_elf_gas.S
38 38 * * 39 39 * **************************************************************************************/ 40 40 41 #ifdef __ILP32__ 42 # define SIZEOF_FCONTEXT_T 0x50 43 #else 44 # define SIZEOF_FCONTEXT_T 0x58 45 #endif 46 41 47 .text 42 48 .globl make_fcontext 43 49 .type make_fcontext,@function 44 50 .align 16 45 make_fcontext: 46 leaq - 0x58(%rdi), %rax/* reserve space for fcontext_t at top of context stack */51 make_fcontext: // (rax, rsi, rdx) 52 leaq -SIZEOF_FCONTEXT_T(%rdi), %rax /* reserve space for fcontext_t at top of context stack */ 47 53 48 54 /* shift address in RAX to lower 16 byte boundary */ 49 55 /* == pointer to fcontext_t and address of context stack */ 50 56 andq $-16, %rax 51 57 58 #ifdef __ILP32__ 59 mov %edi, 0x40(%rax) /* save address of context stack pointer (base) in fcontext_t */ 60 mov %esi, 0x44(%rax) /* save context stack size in fcontext_t */ 61 mov %edx, 0x38(%rax) /* save address of context function in fcontext_t */ 62 #else 52 63 movq %rdi, 0x40(%rax) /* save address of context stack pointer (base) in fcontext_t */ 53 64 movq %rsi, 0x48(%rax) /* save context stack size in fcontext_t */ 54 65 movq %rdx, 0x38(%rax) /* save address of context function in fcontext_t */ 66 #endif 55 67 56 stmxcsr 0x50(%rax) /* save MMX control and status word */57 fnstcw 0x54(%rax) /* save x87 control word */68 stmxcsr (SIZEOF_FCONTEXT_T - 8)(%rax) /* save MMX control and status word */ 69 fnstcw (SIZEOF_FCONTEXT_T - 4)(%rax) /* save x87 control word */ 58 70 71 #ifdef __ILP32__ 72 leaq -0x10(%rax), %rdx /* reserve space for the return address on context stack, (RSP - 0x8) % 16 == 0 */ 73 mov %edx, 0x30(%rax) /* save address in RDX as stack pointer for context function */ 74 #else 59 75 leaq -0x8(%rax), %rdx /* reserve space for the return address on context stack, (RSP - 0x8) % 16 == 0 */ 60 76 movq %rdx, 0x30(%rax) /* save address in RDX as stack pointer for context function */ 77 #endif 61 78 62 79 leaq finish(%rip), %rcx /* compute abs address of label finish */ 63 80 movq %rcx, (%rdx) /* save address of finish as return address for context function */