|
|
7837e6 |
diff -Nru php-8.1.0.orig/Zend/asm/jump_x86_64_ms_pe_gas.S php-8.1.0/Zend/asm/jump_x86_64_ms_pe_gas.S
|
|
|
7837e6 |
--- php-8.1.0.orig/Zend/asm/jump_x86_64_ms_pe_gas.S 1970-01-01 01:00:00.000000000 +0100
|
|
|
7837e6 |
+++ php-8.1.0/Zend/asm/jump_x86_64_ms_pe_gas.S 2021-11-28 11:43:11.689492139 +0100
|
|
|
7837e6 |
@@ -0,0 +1,213 @@
|
|
|
7837e6 |
+/*
|
|
|
7837e6 |
+ Copyright Oliver Kowalke 2009.
|
|
|
7837e6 |
+ Copyright Thomas Sailer 2013.
|
|
|
7837e6 |
+ Distributed under the Boost Software License, Version 1.0.
|
|
|
7837e6 |
+ (See accompanying file LICENSE_1_0.txt or copy at
|
|
|
7837e6 |
+ http://www.boost.org/LICENSE_1_0.txt)
|
|
|
7837e6 |
+*/
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+/*************************************************************************************
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | limit | base | R12 | R13 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | R14 | R15 | RDI | RSI | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | RBX | RBP | hidden | RIP | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | parameter area | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | FCTX | DATA | | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+**************************************************************************************/
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+.file "jump_x86_64_ms_pe_gas.asm"
|
|
|
7837e6 |
+.text
|
|
|
7837e6 |
+.p2align 4,,15
|
|
|
7837e6 |
+.def jump_fcontext; .scl 2; .type 32; .endef
|
|
|
7837e6 |
+.seh_proc jump_fcontext
|
|
|
7837e6 |
+jump_fcontext:
|
|
|
7837e6 |
+.seh_endprologue
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ leaq -0x118(%rsp), %rsp /* prepare stack */
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+#if !defined(BOOST_USE_TSX)
|
|
|
7837e6 |
+ /* save XMM storage */
|
|
|
7837e6 |
+ movaps %xmm6, 0x0(%rsp)
|
|
|
7837e6 |
+ movaps %xmm7, 0x10(%rsp)
|
|
|
7837e6 |
+ movaps %xmm8, 0x20(%rsp)
|
|
|
7837e6 |
+ movaps %xmm9, 0x30(%rsp)
|
|
|
7837e6 |
+ movaps %xmm10, 0x40(%rsp)
|
|
|
7837e6 |
+ movaps %xmm11, 0x50(%rsp)
|
|
|
7837e6 |
+ movaps %xmm12, 0x60(%rsp)
|
|
|
7837e6 |
+ movaps %xmm13, 0x70(%rsp)
|
|
|
7837e6 |
+ movaps %xmm14, 0x80(%rsp)
|
|
|
7837e6 |
+ movaps %xmm15, 0x90(%rsp)
|
|
|
7837e6 |
+ stmxcsr 0xa0(%rsp) /* save MMX control- and status-word */
|
|
|
7837e6 |
+ fnstcw 0xa4(%rsp) /* save x87 control-word */
|
|
|
7837e6 |
+#endif
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* load NT_TIB */
|
|
|
7837e6 |
+ movq %gs:(0x30), %r10
|
|
|
7837e6 |
+ /* save fiber local storage */
|
|
|
7837e6 |
+ movq 0x20(%r10), %rax
|
|
|
7837e6 |
+ movq %rax, 0xb0(%rsp)
|
|
|
7837e6 |
+ /* save current deallocation stack */
|
|
|
7837e6 |
+ movq 0x1478(%r10), %rax
|
|
|
7837e6 |
+ movq %rax, 0xb8(%rsp)
|
|
|
7837e6 |
+ /* save current stack limit */
|
|
|
7837e6 |
+ movq 0x10(%r10), %rax
|
|
|
7837e6 |
+ movq %rax, 0xc0(%rsp)
|
|
|
7837e6 |
+ /* save current stack base */
|
|
|
7837e6 |
+ movq 0x08(%r10), %rax
|
|
|
7837e6 |
+ movq %rax, 0xc8(%rsp)
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ movq %r12, 0xd0(%rsp) /* save R12 */
|
|
|
7837e6 |
+ movq %r13, 0xd8(%rsp) /* save R13 */
|
|
|
7837e6 |
+ movq %r14, 0xe0(%rsp) /* save R14 */
|
|
|
7837e6 |
+ movq %r15, 0xe8(%rsp) /* save R15 */
|
|
|
7837e6 |
+ movq %rdi, 0xf0(%rsp) /* save RDI */
|
|
|
7837e6 |
+ movq %rsi, 0xf8(%rsp) /* save RSI */
|
|
|
7837e6 |
+ movq %rbx, 0x100(%rsp) /* save RBX */
|
|
|
7837e6 |
+ movq %rbp, 0x108(%rsp) /* save RBP */
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ movq %rcx, 0x110(%rsp) /* save hidden address of transport_t */
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* preserve RSP (pointing to context-data) in R9 */
|
|
|
7837e6 |
+ movq %rsp, %r9
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* restore RSP (pointing to context-data) from RDX */
|
|
|
7837e6 |
+ movq %rdx, %rsp
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+#if !defined(BOOST_USE_TSX)
|
|
|
7837e6 |
+ /* restore XMM storage */
|
|
|
7837e6 |
+ movaps 0x0(%rsp), %xmm6
|
|
|
7837e6 |
+ movaps 0x10(%rsp), %xmm7
|
|
|
7837e6 |
+ movaps 0x20(%rsp), %xmm8
|
|
|
7837e6 |
+ movaps 0x30(%rsp), %xmm9
|
|
|
7837e6 |
+ movaps 0x40(%rsp), %xmm10
|
|
|
7837e6 |
+ movaps 0x50(%rsp), %xmm11
|
|
|
7837e6 |
+ movaps 0x60(%rsp), %xmm12
|
|
|
7837e6 |
+ movaps 0x70(%rsp), %xmm13
|
|
|
7837e6 |
+ movaps 0x80(%rsp), %xmm14
|
|
|
7837e6 |
+ movaps 0x90(%rsp), %xmm15
|
|
|
7837e6 |
+ ldmxcsr 0xa0(%rsp) /* restore MMX control- and status-word */
|
|
|
7837e6 |
+ fldcw 0xa4(%rsp) /* restore x87 control-word */
|
|
|
7837e6 |
+#endif
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* load NT_TIB */
|
|
|
7837e6 |
+ movq %gs:(0x30), %r10
|
|
|
7837e6 |
+ /* restore fiber local storage */
|
|
|
7837e6 |
+ movq 0xb0(%rsp), %rax
|
|
|
7837e6 |
+ movq %rax, 0x20(%r10)
|
|
|
7837e6 |
+ /* restore current deallocation stack */
|
|
|
7837e6 |
+ movq 0xb8(%rsp), %rax
|
|
|
7837e6 |
+ movq %rax, 0x1478(%r10)
|
|
|
7837e6 |
+ /* restore current stack limit */
|
|
|
7837e6 |
+ movq 0xc0(%rsp), %rax
|
|
|
7837e6 |
+ movq %rax, 0x10(%r10)
|
|
|
7837e6 |
+ /* restore current stack base */
|
|
|
7837e6 |
+ movq 0xc8(%rsp), %rax
|
|
|
7837e6 |
+ movq %rax, 0x08(%r10)
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ movq 0xd0(%rsp), %r12 /* restore R12 */
|
|
|
7837e6 |
+ movq 0xd8(%rsp), %r13 /* restore R13 */
|
|
|
7837e6 |
+ movq 0xe0(%rsp), %r14 /* restore R14 */
|
|
|
7837e6 |
+ movq 0xe8(%rsp), %r15 /* restore R15 */
|
|
|
7837e6 |
+ movq 0xf0(%rsp), %rdi /* restore RDI */
|
|
|
7837e6 |
+ movq 0xf8(%rsp), %rsi /* restore RSI */
|
|
|
7837e6 |
+ movq 0x100(%rsp), %rbx /* restore RBX */
|
|
|
7837e6 |
+ movq 0x108(%rsp), %rbp /* restore RBP */
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ movq 0x110(%rsp), %rax /* restore hidden address of transport_t */
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ leaq 0x118(%rsp), %rsp /* prepare stack */
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* restore return-address */
|
|
|
7837e6 |
+ popq %r10
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* transport_t returned in RAX */
|
|
|
7837e6 |
+ /* return parent fcontext_t */
|
|
|
7837e6 |
+ movq %r9, 0x0(%rax)
|
|
|
7837e6 |
+ /* return data */
|
|
|
7837e6 |
+ movq %r8, 0x8(%rax)
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* transport_t as 1.arg of context-function */
|
|
|
7837e6 |
+ movq %rax, %rcx
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* indirect jump to context */
|
|
|
7837e6 |
+ jmp *%r10
|
|
|
7837e6 |
+.seh_endproc
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+#ifdef __midipix__
|
|
|
7837e6 |
+ .section .got$jump_fcontext,"r"
|
|
|
7837e6 |
+ .global __imp_jump_fcontext
|
|
|
7837e6 |
+__imp_jump_fcontext:
|
|
|
7837e6 |
+ .quad jump_fcontext
|
|
|
7837e6 |
+ .linkonce discard
|
|
|
7837e6 |
+#endif
|
|
|
7837e6 |
diff -Nru php-8.1.0.orig/Zend/asm/make_x86_64_ms_pe_gas.S php-8.1.0/Zend/asm/make_x86_64_ms_pe_gas.S
|
|
|
7837e6 |
--- php-8.1.0.orig/Zend/asm/make_x86_64_ms_pe_gas.S 1970-01-01 01:00:00.000000000 +0100
|
|
|
7837e6 |
+++ php-8.1.0/Zend/asm/make_x86_64_ms_pe_gas.S 2021-11-28 11:44:29.385178672 +0100
|
|
|
7837e6 |
@@ -0,0 +1,178 @@
|
|
|
7837e6 |
+/*
|
|
|
7837e6 |
+ Copyright Oliver Kowalke 2009.
|
|
|
7837e6 |
+ Copyright Thomas Sailer 2013.
|
|
|
7837e6 |
+ Distributed under the Boost Software License, Version 1.0.
|
|
|
7837e6 |
+ (See accompanying file LICENSE_1_0.txt or copy at
|
|
|
7837e6 |
+ http://www.boost.org/LICENSE_1_0.txt)
|
|
|
7837e6 |
+*/
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+/*************************************************************************************
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | SEE registers (XMM6-XMM15) | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | limit | base | R12 | R13 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | R14 | R15 | RDI | RSI | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | RBX | RBP | hidden | RIP | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | parameter area | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+* | FCTX | DATA | | *
|
|
|
7837e6 |
+* ---------------------------------------------------------------------------------- *
|
|
|
7837e6 |
+**************************************************************************************/
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+.file "make_x86_64_ms_pe_gas.asm"
|
|
|
7837e6 |
+.text
|
|
|
7837e6 |
+.p2align 4,,15
|
|
|
7837e6 |
+.def make_fcontext; .scl 2; .type 32; .endef
|
|
|
7837e6 |
+.seh_proc make_fcontext
|
|
|
7837e6 |
+make_fcontext:
|
|
|
7837e6 |
+.seh_endprologue
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* first arg of make_fcontext() == top of context-stack */
|
|
|
7837e6 |
+ movq %rcx, %rax
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* shift address in RAX to lower 16 byte boundary */
|
|
|
7837e6 |
+ /* == pointer to fcontext_t and address of context stack */
|
|
|
7837e6 |
+ andq $-16, %rax
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* reserve space for context-data on context-stack */
|
|
|
7837e6 |
+ /* on context-function entry: (RSP -0x8) % 16 == 0 */
|
|
|
7837e6 |
+ leaq -0x150(%rax), %rax
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* third arg of make_fcontext() == address of context-function */
|
|
|
7837e6 |
+ movq %r8, 0x100(%rax)
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* first arg of make_fcontext() == top of context-stack */
|
|
|
7837e6 |
+ /* save top address of context stack as 'base' */
|
|
|
7837e6 |
+ movq %rcx, 0xc8(%rax)
|
|
|
7837e6 |
+ /* second arg of make_fcontext() == size of context-stack */
|
|
|
7837e6 |
+ /* negate stack size for LEA instruction (== substraction) */
|
|
|
7837e6 |
+ negq %rdx
|
|
|
7837e6 |
+ /* compute bottom address of context stack (limit) */
|
|
|
7837e6 |
+ leaq (%rcx,%rdx), %rcx
|
|
|
7837e6 |
+ /* save bottom address of context stack as 'limit' */
|
|
|
7837e6 |
+ movq %rcx, 0xc0(%rax)
|
|
|
7837e6 |
+ /* save address of context stack limit as 'dealloction stack' */
|
|
|
7837e6 |
+ movq %rcx, 0xb8(%rax)
|
|
|
7837e6 |
+ /* set fiber-storage to zero */
|
|
|
7837e6 |
+ xorq %rcx, %rcx
|
|
|
7837e6 |
+ movq %rcx, 0xb0(%rax)
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* save MMX control- and status-word */
|
|
|
7837e6 |
+ stmxcsr 0xa0(%rax)
|
|
|
7837e6 |
+ /* save x87 control-word */
|
|
|
7837e6 |
+ fnstcw 0xa4(%rax)
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* compute address of transport_t */
|
|
|
7837e6 |
+ leaq 0x140(%rax), %rcx
|
|
|
7837e6 |
+ /* store address of transport_t in hidden field */
|
|
|
7837e6 |
+ movq %rcx, 0x110(%rax)
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* compute abs address of label trampoline */
|
|
|
7837e6 |
+ leaq trampoline(%rip), %rcx
|
|
|
7837e6 |
+ /* save address of finish as return-address for context-function */
|
|
|
7837e6 |
+ /* will be entered after jump_fcontext() first time */
|
|
|
7837e6 |
+ movq %rcx, 0x118(%rax)
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ /* compute abs address of label finish */
|
|
|
7837e6 |
+ leaq finish(%rip), %rcx
|
|
|
7837e6 |
+ /* save address of finish as return-address for context-function */
|
|
|
7837e6 |
+ /* will be entered after context-function returns */
|
|
|
7837e6 |
+ movq %rcx, 0x108(%rax)
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+ ret /* return pointer to context-data */
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+trampoline:
|
|
|
7837e6 |
+ /* store return address on stack */
|
|
|
7837e6 |
+ /* fix stack alignment */
|
|
|
7837e6 |
+ pushq %rbp
|
|
|
7837e6 |
+ /* jump to context-function */
|
|
|
7837e6 |
+ jmp *%rbx
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+finish:
|
|
|
7837e6 |
+ /* 32byte shadow-space for _exit() */
|
|
|
7837e6 |
+ andq $-32, %rsp
|
|
|
7837e6 |
+ /* 32byte shadow-space for _exit() are */
|
|
|
7837e6 |
+ /* already reserved by make_fcontext() */
|
|
|
7837e6 |
+ /* exit code is zero */
|
|
|
7837e6 |
+ xorq %rcx, %rcx
|
|
|
7837e6 |
+ /* exit application */
|
|
|
7837e6 |
+ call _exit
|
|
|
7837e6 |
+ hlt
|
|
|
7837e6 |
+.seh_endproc
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+.def _exit; .scl 2; .type 32; .endef /* standard C library function */
|
|
|
7837e6 |
+
|
|
|
7837e6 |
+#ifdef __midipix__
|
|
|
7837e6 |
+ .section .got$make_fcontext,"r"
|
|
|
7837e6 |
+ .global __imp_make_fcontext
|
|
|
7837e6 |
+__imp_make_fcontext:
|
|
|
7837e6 |
+ .quad make_fcontext
|
|
|
7837e6 |
+ .linkonce discard
|
|
|
7837e6 |
+#endif
|