]> git.pld-linux.org Git - packages/boost.git/blame - boost-x32-context.patch
- x32 rebuild
[packages/boost.git] / boost-x32-context.patch
CommitLineData
bab7ef8c
JR
1Index: libs/context/src/asm/jump_x86_64_sysv_elf_gas.S
2===================================================================
3--- libs/context/src/asm/jump_x86_64_sysv_elf_gas.S (revision 86799)
4+++ libs/context/src/asm/jump_x86_64_sysv_elf_gas.S (working copy)
5@@ -38,6 +38,12 @@
6 * *
7 * **************************************************************************************/
8
9+#ifdef __ILP32__
10+# define SIZEOF_FCONTEXT_T 0x50
11+#else
12+# define SIZEOF_FCONTEXT_T 0x58
13+#endif
14+
15 .text
16 .globl jump_fcontext
17 .type jump_fcontext,@function
18@@ -53,11 +59,11 @@ jump_fcontext:
19 cmp $0, %rcx
20 je 1f
21
22- stmxcsr 0x50(%rdi) /* save MMX control and status word */
23- fnstcw 0x54(%rdi) /* save x87 control word */
24+ stmxcsr (SIZEOF_FCONTEXT_T - 8)(%rdi) /* save MMX control and status word */
25+ fnstcw (SIZEOF_FCONTEXT_T - 4)(%rdi) /* save x87 control word */
26
27- ldmxcsr 0x50(%rsi) /* restore MMX control and status word */
28- fldcw 0x54(%rsi) /* restore x87 control word */
29+ ldmxcsr (SIZEOF_FCONTEXT_T - 8)(%rsi) /* restore MMX control and status word */
30+ fldcw (SIZEOF_FCONTEXT_T - 4)(%rsi) /* restore x87 control word */
31 1:
32
33 leaq 0x8(%rsp), %rax /* exclude the return address and save as stack pointer */
34Index: libs/context/src/asm/make_x86_64_sysv_elf_gas.S
35===================================================================
36--- libs/context/src/asm/make_x86_64_sysv_elf_gas.S (revision 86799)
37+++ libs/context/src/asm/make_x86_64_sysv_elf_gas.S (working copy)
38@@ -38,26 +38,43 @@
39 * *
40 * **************************************************************************************/
41
42+#ifdef __ILP32__
43+# define SIZEOF_FCONTEXT_T 0x50
44+#else
45+# define SIZEOF_FCONTEXT_T 0x58
46+#endif
47+
48 .text
49 .globl make_fcontext
50 .type make_fcontext,@function
51 .align 16
52-make_fcontext:
53- leaq -0x58(%rdi), %rax /* reserve space for fcontext_t at top of context stack */
54+make_fcontext: // (rax, rsi, rdx)
55+ leaq -SIZEOF_FCONTEXT_T(%rdi), %rax /* reserve space for fcontext_t at top of context stack */
56
57 /* shift address in RAX to lower 16 byte boundary */
58 /* == pointer to fcontext_t and address of context stack */
59 andq $-16, %rax
60
61+#ifdef __ILP32__
62+ mov %edi, 0x40(%rax) /* save address of context stack pointer (base) in fcontext_t */
63+ mov %esi, 0x44(%rax) /* save context stack size in fcontext_t */
64+ mov %edx, 0x38(%rax) /* save address of context function in fcontext_t */
65+#else
66 movq %rdi, 0x40(%rax) /* save address of context stack pointer (base) in fcontext_t */
67 movq %rsi, 0x48(%rax) /* save context stack size in fcontext_t */
68 movq %rdx, 0x38(%rax) /* save address of context function in fcontext_t */
69+#endif
70
71- stmxcsr 0x50(%rax) /* save MMX control and status word */
72- fnstcw 0x54(%rax) /* save x87 control word */
73+ stmxcsr (SIZEOF_FCONTEXT_T - 8)(%rax) /* save MMX control and status word */
74+ fnstcw (SIZEOF_FCONTEXT_T - 4)(%rax) /* save x87 control word */
75
76+#ifdef __ILP32__
77+ leaq -0x10(%rax), %rdx /* reserve space for the return address on context stack, (RSP - 0x8) % 16 == 0 */
78+ mov %edx, 0x30(%rax) /* save address in RDX as stack pointer for context function */
79+#else
80 leaq -0x8(%rax), %rdx /* reserve space for the return address on context stack, (RSP - 0x8) % 16 == 0 */
81 movq %rdx, 0x30(%rax) /* save address in RDX as stack pointer for context function */
82+#endif
83
84 leaq finish(%rip), %rcx /* compute abs address of label finish */
85 movq %rcx, (%rdx) /* save address of finish as return address for context function */
This page took 0.072076 seconds and 4 git commands to generate.