Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/scripts/download-bundled/boost-context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd "$(dirname "$0")/../../.."
tmp_dir=/tmp/php-src-download-bundled/boost-context
rm -rf "$tmp_dir"

revision=refs/tags/boost-1.86.0
revision=refs/tags/boost-1.91.0

git clone --depth 1 --revision="$revision" https://github.com/boostorg/context.git "$tmp_dir"

Expand All @@ -16,12 +16,14 @@ cd Zend/asm

# remove unneeded files
rm jump_arm_aapcs_pe_armasm.asm
rm jump_arm64_aapcs_pe_armclang.S
rm jump_i386_ms_pe_clang_gas.S
rm jump_i386_ms_pe_gas.asm
rm jump_i386_x86_64_sysv_macho_gas.S
rm jump_ppc32_ppc64_sysv_macho_gas.S
rm jump_x86_64_ms_pe_clang_gas.S
rm make_arm_aapcs_pe_armasm.asm
rm make_arm64_aapcs_pe_armclang.S
rm make_i386_ms_pe_clang_gas.S
rm make_i386_ms_pe_gas.asm
rm make_i386_x86_64_sysv_macho_gas.S
Expand Down
19 changes: 19 additions & 0 deletions Zend/asm/jump_arm64_aapcs_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,29 @@

.file "jump_arm64_aapcs_elf_gas.S"
.text
#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
/* Mark this object as requiring BTI, enabling the linker to set BTI on the output */
.pushsection .note.gnu.property, "a", %note
.p2align 3
.long 4 /* namesz */
.long 16 /* descsz (16 bytes) */
.long 5 /* type = NT_GNU_PROPERTY_TYPE_0 */
.asciz "GNU"
.p2align 3
.long 0xc0000000 /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
.long 4 /* datasz = 4 */
.long 1 /* GNU_PROPERTY_AARCH64_FEATURE_1_BTI */
.long 0 /* pad to 8-byte alignment */
.popsection
#endif
.align 2
.global jump_fcontext
.hidden jump_fcontext
.type jump_fcontext, %function
jump_fcontext:
#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
hint #34 /* bti c: valid indirect-entry target */
#endif
# prepare stack for GP + FPU
sub sp, sp, #0xb0

Expand Down
1 change: 1 addition & 0 deletions Zend/asm/jump_arm64_aapcs_macho_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
*******************************************************/

.text
.private_extern _jump_fcontext
.globl _jump_fcontext
.balign 16
_jump_fcontext:
Expand Down
4 changes: 2 additions & 2 deletions Zend/asm/jump_arm64_aapcs_pe_armasm.asm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
;* ------------------------------------------------- *
;* | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc| *
;* ------------------------------------------------- *
;* | fiber data| base | limit | dealloc | *
;* | base | limit | dealloc | fiber data| *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 48 | 49 | 50 | 51 | | | *
Expand Down Expand Up @@ -130,4 +130,4 @@ jump_fcontext proc

ret x4
ENDP
END
END
58 changes: 58 additions & 0 deletions Zend/asm/jump_arm_aapcs_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,46 @@
.file "jump_arm_aapcs_elf_gas.S"
.text
.globl jump_fcontext
.hidden jump_fcontext
.align 2
.type jump_fcontext,%function
.syntax unified
jump_fcontext:
@ save LR as PC
push {lr}
@ save hidden,V1-V8,LR

#if __ARM_ARCH >= 7

push {a1,v1-v8,lr}

#else

sub sp, #40

str a1, [sp, #0]
str v1, [sp, #4]
str v2, [sp, #8]
str v3, [sp, #12]
str v4, [sp, #16]

mov v4, v5
str v4, [sp, #20]

mov v4, v6
str v4, [sp, #24]

mov v4, v7
str v4, [sp, #28]

mov v4, v8
str v4, [sp, #32]

mov v4, lr
str v4, [sp, #36]

#endif

@ prepare stack for FPU
sub sp, sp, #64
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
Expand All @@ -71,7 +102,34 @@ jump_fcontext:
add sp, sp, #64

@ restore hidden,V1-V8,LR
#if __ARM_ARCH >= 7
pop {a4,v1-v8,lr}
#else

ldr v4, [sp, #20]
mov v5, v4

ldr v4, [sp, #24]
mov v6, v4

ldr v4, [sp, #28]
mov v7, v4

ldr v4, [sp, #32]
mov v8, v4

ldr v4, [sp, #36]
mov lr, v4

ldr a4, [sp, #0]
ldr v1, [sp, #4]
ldr v2, [sp, #8]
ldr v3, [sp, #12]
ldr v4, [sp, #16]

add sp, #40

#endif

@ return transfer_t from jump
str a1, [a4, #0]
Expand Down
1 change: 1 addition & 0 deletions Zend/asm/jump_arm_aapcs_macho_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
*******************************************************/

.text
.private_extern _jump_fcontext
.globl _jump_fcontext
.align 2
_jump_fcontext:
Expand Down
18 changes: 9 additions & 9 deletions Zend/asm/jump_i386_ms_pe_masm.asm
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ ENDIF
mov eax, [edx]
mov [esp+018h], eax

mov [esp+01ch], edi ; save EDI
mov [esp+020h], esi ; save ESI
mov [esp+024h], ebx ; save EBX
mov [esp+028h], ebp ; save EBP
mov [esp+01ch], edi ; save EDI
mov [esp+020h], esi ; save ESI
mov [esp+024h], ebx ; save EBX
mov [esp+028h], ebp ; save EBP

; store ESP (pointing to context-data) in EAX
mov eax, esp

; firstarg of jump_fcontext() == fcontext to jump to
mov ecx, [esp+030h]

; restore ESP (pointing to context-data) from ECX
mov esp, ecx

Expand Down Expand Up @@ -98,10 +98,10 @@ ENDIF

mov ecx, [esp+02ch] ; restore EIP

mov edi, [esp+01ch] ; restore EDI
mov esi, [esp+020h] ; restore ESI
mov ebx, [esp+024h] ; restore EBX
mov ebp, [esp+028h] ; restore EBP
mov edi, [esp+01ch] ; restore EDI
mov esi, [esp+020h] ; restore ESI
mov ebx, [esp+024h] ; restore EBX
mov ebp, [esp+028h] ; restore EBP

; prepare stack
lea esp, [esp+030h]
Expand Down
1 change: 1 addition & 0 deletions Zend/asm/jump_i386_sysv_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
.file "jump_i386_sysv_elf_gas.S"
.text
.globl jump_fcontext
.hidden jump_fcontext
.align 2
.type jump_fcontext,@function
jump_fcontext:
Expand Down
5 changes: 3 additions & 2 deletions Zend/asm/jump_i386_sysv_macho_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
****************************************************************************************/

.text
.private_extern _jump_fcontext
.globl _jump_fcontext
.align 2
_jump_fcontext:
Expand Down Expand Up @@ -54,8 +55,8 @@ _jump_fcontext:

/* return parent fcontext_t */
movl %ecx, %eax
/* returned data is stored in EDX */
/* returned data is stored in EDX */

movl 0x18(%esp), %ecx /* restore EIP */

#if !defined(BOOST_USE_TSX)
Expand Down
1 change: 1 addition & 0 deletions Zend/asm/jump_loongarch64_sysv_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
.file "jump_loongarch64_sysv_elf_gas.S"
.text
.globl jump_fcontext
.hidden jump_fcontext
.align 2
.type jump_fcontext,@function
jump_fcontext:
Expand Down
5 changes: 3 additions & 2 deletions Zend/asm/jump_mips32_o32_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
.file "jump_mips32_o32_elf_gas.S"
.text
.globl jump_fcontext
.hidden jump_fcontext
.align 2
.type jump_fcontext,@function
.ent jump_fcontext
Expand Down Expand Up @@ -102,13 +103,13 @@ jump_fcontext:

# adjust stack
addiu $sp, $sp, 96

# return transfer_t from jump
sw $a0, ($v0) # fctx of transfer_t
sw $a2, 4($v0) # data of transfer_t
# pass transfer_t as first arg in context function
# A0 == fctx, A1 == data
move $a1, $a2
move $a1, $a2

# jump to context
jr $t9
Expand Down
1 change: 1 addition & 0 deletions Zend/asm/jump_mips64_n64_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
.file "jump_mips64_n64_elf_gas.S"
.text
.globl jump_fcontext
.hidden jump_fcontext
.align 3
.type jump_fcontext,@function
.ent jump_fcontext
Expand Down
1 change: 1 addition & 0 deletions Zend/asm/jump_ppc32_sysv_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
.file "jump_ppc32_sysv_elf_gas.S"
.text
.globl jump_fcontext
.hidden jump_fcontext
.align 2
.type jump_fcontext,@function
jump_fcontext:
Expand Down
5 changes: 3 additions & 2 deletions Zend/asm/jump_ppc32_sysv_macho_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@
* ------------------------------------------------- *
* | 256 | | *
* ------------------------------------------------- *
* | DATA| | *
* | DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/

.text
.private_extern _jump_fcontext
.globl _jump_fcontext
.align 2
_jump_fcontext:
Expand Down Expand Up @@ -193,7 +194,7 @@ _jump_fcontext:
; adjust stack
addi r1, r1, 244

; return transfer_t
; return transfer_t
stw r6, 0(r3)
stw r5, 4(r3)

Expand Down
14 changes: 12 additions & 2 deletions Zend/asm/jump_ppc64_sysv_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

.file "jump_ppc64_sysv_elf_gas.S"
.globl jump_fcontext
.hidden jump_fcontext
#if _CALL_ELF == 2
.text
.align 2
Expand Down Expand Up @@ -97,7 +98,7 @@ jump_fcontext:
# endif
#endif
# reserve space on stack
subi %r1, %r1, 184
subi %r1, %r1, 200

#if _CALL_ELF != 2
std %r2, 0(%r1) # save TOC
Expand Down Expand Up @@ -133,6 +134,10 @@ jump_fcontext:
# save LR as PC
std %r0, 176(%r1)

# Save VS63
li %r31, 184
stvx %v31, %r1, %r31

# store RSP (pointing to context-data) in R6
mr %r6, %r1

Expand All @@ -145,6 +150,11 @@ jump_fcontext:

ld %r2, 0(%r1) # restore TOC
#endif

# Restore VS63
li %r31, 184
lvx %v31, %r1, %r31

ld %r14, 8(%r1) # restore R14
ld %r15, 16(%r1) # restore R15
ld %r16, 24(%r1) # restore R16
Expand Down Expand Up @@ -180,7 +190,7 @@ jump_fcontext:
mtctr %r12

# adjust stack
addi %r1, %r1, 184
addi %r1, %r1, 200

#if _CALL_ELF == 2
# copy transfer_t into transfer_fn arg registers
Expand Down
1 change: 1 addition & 0 deletions Zend/asm/jump_ppc64_sysv_macho_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

.text
.align 2
.private_extern _jump_fcontext
.globl _jump_fcontext

_jump_fcontext:
Expand Down
1 change: 1 addition & 0 deletions Zend/asm/jump_riscv64_sysv_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
.text
.align 1
.global jump_fcontext
.hidden jump_fcontext
.type jump_fcontext, %function
jump_fcontext:
# prepare stack for GP + FPU
Expand Down
1 change: 1 addition & 0 deletions Zend/asm/jump_s390x_sysv_elf_gas.S
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
.text
.align 8
.global jump_fcontext
.hidden jump_fcontext
.type jump_fcontext, @function

#define ARG_OFFSET 0
Expand Down
Loading
Loading