Skip to content

Commit 9cefeea

Browse files
kn1g78arnaud-lb
authored andcommitted
Sync Boost.Context assembly with 1.91.0
Closes GH-22584
1 parent 8613e0e commit 9cefeea

43 files changed

Lines changed: 203 additions & 70 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/download-bundled/boost-context.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cd "$(dirname "$0")/../../.."
55
tmp_dir=/tmp/php-src-download-bundled/boost-context
66
rm -rf "$tmp_dir"
77

8-
revision=refs/tags/boost-1.86.0
8+
revision=refs/tags/boost-1.91.0
99

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

@@ -16,12 +16,14 @@ cd Zend/asm
1616

1717
# remove unneeded files
1818
rm jump_arm_aapcs_pe_armasm.asm
19+
rm jump_arm64_aapcs_pe_armclang.S
1920
rm jump_i386_ms_pe_clang_gas.S
2021
rm jump_i386_ms_pe_gas.asm
2122
rm jump_i386_x86_64_sysv_macho_gas.S
2223
rm jump_ppc32_ppc64_sysv_macho_gas.S
2324
rm jump_x86_64_ms_pe_clang_gas.S
2425
rm make_arm_aapcs_pe_armasm.asm
26+
rm make_arm64_aapcs_pe_armclang.S
2527
rm make_i386_ms_pe_clang_gas.S
2628
rm make_i386_ms_pe_gas.asm
2729
rm make_i386_x86_64_sysv_macho_gas.S

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.6.0alpha2
44

5+
- Core:
6+
. Sync Boost.Context assembly with 1.91.0. (kn1g78)
7+
58
- DBA:
69
. Fixed OOB read on malformed length field in dba flatfile handler. (alhudz)
710

Zend/asm/jump_arm64_aapcs_elf_gas.S

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,29 @@
5353

5454
.file "jump_arm64_aapcs_elf_gas.S"
5555
.text
56+
#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
57+
/* Mark this object as requiring BTI, enabling the linker to set BTI on the output */
58+
.pushsection .note.gnu.property, "a", %note
59+
.p2align 3
60+
.long 4 /* namesz */
61+
.long 16 /* descsz (16 bytes) */
62+
.long 5 /* type = NT_GNU_PROPERTY_TYPE_0 */
63+
.asciz "GNU"
64+
.p2align 3
65+
.long 0xc0000000 /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
66+
.long 4 /* datasz = 4 */
67+
.long 1 /* GNU_PROPERTY_AARCH64_FEATURE_1_BTI */
68+
.long 0 /* pad to 8-byte alignment */
69+
.popsection
70+
#endif
5671
.align 2
5772
.global jump_fcontext
73+
.hidden jump_fcontext
5874
.type jump_fcontext, %function
5975
jump_fcontext:
76+
#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
77+
hint #34 /* bti c: valid indirect-entry target */
78+
#endif
6079
# prepare stack for GP + FPU
6180
sub sp, sp, #0xb0
6281

Zend/asm/jump_arm64_aapcs_macho_gas.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
*******************************************************/
5353

5454
.text
55+
.private_extern _jump_fcontext
5556
.globl _jump_fcontext
5657
.balign 16
5758
_jump_fcontext:

Zend/asm/jump_arm64_aapcs_pe_armasm.asm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
;* ------------------------------------------------- *
4646
;* | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc| *
4747
;* ------------------------------------------------- *
48-
;* | fiber data| base | limit | dealloc | *
48+
;* | base | limit | dealloc | fiber data| *
4949
;* ------------------------------------------------- *
5050
;* ------------------------------------------------- *
5151
;* | 48 | 49 | 50 | 51 | | | *
@@ -130,4 +130,4 @@ jump_fcontext proc
130130

131131
ret x4
132132
ENDP
133-
END
133+
END

Zend/asm/jump_arm_aapcs_elf_gas.S

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,46 @@
4141
.file "jump_arm_aapcs_elf_gas.S"
4242
.text
4343
.globl jump_fcontext
44+
.hidden jump_fcontext
4445
.align 2
4546
.type jump_fcontext,%function
4647
.syntax unified
4748
jump_fcontext:
4849
@ save LR as PC
4950
push {lr}
5051
@ save hidden,V1-V8,LR
52+
53+
#if __ARM_ARCH >= 7
54+
5155
push {a1,v1-v8,lr}
5256

57+
#else
58+
59+
sub sp, #40
60+
61+
str a1, [sp, #0]
62+
str v1, [sp, #4]
63+
str v2, [sp, #8]
64+
str v3, [sp, #12]
65+
str v4, [sp, #16]
66+
67+
mov v4, v5
68+
str v4, [sp, #20]
69+
70+
mov v4, v6
71+
str v4, [sp, #24]
72+
73+
mov v4, v7
74+
str v4, [sp, #28]
75+
76+
mov v4, v8
77+
str v4, [sp, #32]
78+
79+
mov v4, lr
80+
str v4, [sp, #36]
81+
82+
#endif
83+
5384
@ prepare stack for FPU
5485
sub sp, sp, #64
5586
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@@ -71,7 +102,34 @@ jump_fcontext:
71102
add sp, sp, #64
72103

73104
@ restore hidden,V1-V8,LR
105+
#if __ARM_ARCH >= 7
74106
pop {a4,v1-v8,lr}
107+
#else
108+
109+
ldr v4, [sp, #20]
110+
mov v5, v4
111+
112+
ldr v4, [sp, #24]
113+
mov v6, v4
114+
115+
ldr v4, [sp, #28]
116+
mov v7, v4
117+
118+
ldr v4, [sp, #32]
119+
mov v8, v4
120+
121+
ldr v4, [sp, #36]
122+
mov lr, v4
123+
124+
ldr a4, [sp, #0]
125+
ldr v1, [sp, #4]
126+
ldr v2, [sp, #8]
127+
ldr v3, [sp, #12]
128+
ldr v4, [sp, #16]
129+
130+
add sp, #40
131+
132+
#endif
75133

76134
@ return transfer_t from jump
77135
str a1, [a4, #0]

Zend/asm/jump_arm_aapcs_macho_gas.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
*******************************************************/
4040

4141
.text
42+
.private_extern _jump_fcontext
4243
.globl _jump_fcontext
4344
.align 2
4445
_jump_fcontext:

Zend/asm/jump_i386_ms_pe_masm.asm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ ENDIF
5555
mov eax, [edx]
5656
mov [esp+018h], eax
5757

58-
mov [esp+01ch], edi ; save EDI
59-
mov [esp+020h], esi ; save ESI
60-
mov [esp+024h], ebx ; save EBX
61-
mov [esp+028h], ebp ; save EBP
58+
mov [esp+01ch], edi ; save EDI
59+
mov [esp+020h], esi ; save ESI
60+
mov [esp+024h], ebx ; save EBX
61+
mov [esp+028h], ebp ; save EBP
6262

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

6666
; firstarg of jump_fcontext() == fcontext to jump to
6767
mov ecx, [esp+030h]
68-
68+
6969
; restore ESP (pointing to context-data) from ECX
7070
mov esp, ecx
7171

@@ -98,10 +98,10 @@ ENDIF
9898

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

101-
mov edi, [esp+01ch] ; restore EDI
102-
mov esi, [esp+020h] ; restore ESI
103-
mov ebx, [esp+024h] ; restore EBX
104-
mov ebp, [esp+028h] ; restore EBP
101+
mov edi, [esp+01ch] ; restore EDI
102+
mov esi, [esp+020h] ; restore ESI
103+
mov ebx, [esp+024h] ; restore EBX
104+
mov ebp, [esp+028h] ; restore EBP
105105

106106
; prepare stack
107107
lea esp, [esp+030h]

Zend/asm/jump_i386_sysv_elf_gas.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
.file "jump_i386_sysv_elf_gas.S"
3232
.text
3333
.globl jump_fcontext
34+
.hidden jump_fcontext
3435
.align 2
3536
.type jump_fcontext,@function
3637
jump_fcontext:

Zend/asm/jump_i386_sysv_macho_gas.S

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
****************************************************************************************/
2626

2727
.text
28+
.private_extern _jump_fcontext
2829
.globl _jump_fcontext
2930
.align 2
3031
_jump_fcontext:
@@ -54,8 +55,8 @@ _jump_fcontext:
5455

5556
/* return parent fcontext_t */
5657
movl %ecx, %eax
57-
/* returned data is stored in EDX */
58-
58+
/* returned data is stored in EDX */
59+
5960
movl 0x18(%esp), %ecx /* restore EIP */
6061

6162
#if !defined(BOOST_USE_TSX)

0 commit comments

Comments
 (0)