ObjFW  Check-in [bf1cc071e3]

Overview
Comment:Convert apple-call-x86_64.S to Intel syntax
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bf1cc071e3b2c08b74604fd4617dfb6bf07d1a0663fc9cf4bdc84427f4446ad0
User & Date: js on 2020-06-30 23:46:18
Other Links: manifest | tags
Context
2021-02-08
02:04
Revert apple-call-x86_64.S back to AT&T syntax check-in: adc1dedc5f user: js tags: trunk
2020-06-30
23:56
Convert call-x86_64-elf.S to Intel syntax check-in: 71c7f864e4 user: js tags: trunk
23:46
Convert apple-call-x86_64.S to Intel syntax check-in: bf1cc071e3 user: js tags: trunk
23:31
Convert all x86_64/Mach-O ASM to Intel syntax check-in: 5c288708e0 user: js tags: trunk
Changes

Modified src/invocation/apple-call-x86_64.S from [faa19cc12c] to [3884ee11f3].

14
15
16
17
18
19
20


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include "invoke-x86_64.h"



.globl _of_invocation_call

.section __TEXT, __text, regular, pure_instructions
_of_invocation_call:
	pushq	%rbp
	movq	%rsp, %rbp

	subq	$16, %rsp
	andq	$-16, %rsp
	movq	%rdi, -8(%rbp)

	leaq	OFFSET_STACK(%rdi), %rdx
	movq	OFFSET_STACK_SIZE(%rdi), %rcx

	testq	$1, %rcx
	jnz	Lfix_align

Lfill_stack:
	testq	%rcx, %rcx
	jz	Lstack_filled

	decq	%rcx
	movq	(%rdx,%rcx,8), %r11
	pushq	%r11

	jmp	Lfill_stack

Lstack_filled:
	movb	OFFSET_NUM_SSE_USED(%rdi), %al

	movaps	OFFSET_SSE_INOUT+112(%rdi), %xmm7
	movaps	OFFSET_SSE_INOUT+96(%rdi), %xmm6
	movaps	OFFSET_SSE_INOUT+80(%rdi), %xmm5
	movaps	OFFSET_SSE_INOUT+64(%rdi), %xmm4
	movaps	OFFSET_SSE_INOUT+48(%rdi), %xmm3
	movaps	OFFSET_SSE_INOUT+32(%rdi), %xmm2
	movaps	OFFSET_SSE_INOUT+16(%rdi), %xmm1
	movaps	OFFSET_SSE_INOUT(%rdi), %xmm0

	movq	OFFSET_GPR_IN+40(%rdi), %r9
	movq	OFFSET_GPR_IN+32(%rdi), %r8
	movq	OFFSET_GPR_IN+24(%rdi), %rcx
	movq	OFFSET_GPR_IN+16(%rdi), %rdx
	movq	OFFSET_GPR_IN+8(%rdi), %rsi

	movb	OFFSET_RETURN_TYPE(%rdi), %r11b
	movq	OFFSET_GPR_IN(%rdi), %rdi

	cmpb	$RETURN_TYPE_STRET, %r11b
	je	Lcall_send_stret

	cmpb	$RETURN_TYPE_JMP, %r11b
	je	_objc_msgSend

	cmpb	$RETURN_TYPE_JMP_STRET, %r11b
	je	_objc_msgSend_stret

	call	_objc_msgSend

Lafter_send:
	movq	-8(%rbp), %rdi
	movq	%rax, OFFSET_GPR_OUT(%rdi)
	movq	%rdx, OFFSET_GPR_OUT+8(%rdi)
	movaps	%xmm0, OFFSET_SSE_INOUT(%rdi)
	movaps	%xmm1, OFFSET_SSE_INOUT+16(%rdi)

	movb	OFFSET_RETURN_TYPE(%rdi), %r11b

	cmpb	$RETURN_TYPE_X87, %r11b
	je	Lpop_long_double

	cmpb	$RETURN_TYPE_COMPLEX_X87, %r11b
	je	Lpop_complex_long_double

Lreturn:
	movq	%rbp, %rsp
	popq	%rbp

	ret

Lfix_align:
	xorq	%r11, %r11
	pushq	%r11
	jmp	Lfill_stack

Lcall_send_stret:
	call	_objc_msgSend_stret
	jmp	Lafter_send

Lpop_long_double:
	fstpt	OFFSET_X87_OUT(%rdi)
	jmp	Lreturn

Lpop_complex_long_double:
	fstpt	OFFSET_X87_OUT(%rdi)
	fstpt	OFFSET_X87_OUT+16(%rdi)
	jmp	Lreturn







>
>





|
|

|
|
|

|
|

|



|


|
|
|




|

|
|
|
|
|
|
|
|

|
|
|
|
|

|
|

|


|


|





|
|
|
|
|

|

|


|



|
|




|
|







|



|
|

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include "invoke-x86_64.h"

.intel_syntax noprefix

.globl _of_invocation_call

.section __TEXT, __text, regular, pure_instructions
_of_invocation_call:
	push	rbp
	mov	rbp, rsp

	sub	rsp, 16
	and	rsp, -16
	mov	[rbp-8], rdi

	lea	rdx, [rdi+OFFSET_STACK]
	mov	rcx, [rdi+OFFSET_STACK_SIZE]

	test	rcx, 1
	jnz	Lfix_align

Lfill_stack:
	test	rcx, rcx
	jz	Lstack_filled

	dec	rcx
	mov	r11, [rdx+rcx*8]
	push	r11

	jmp	Lfill_stack

Lstack_filled:
	mov	al, [rdi+OFFSET_NUM_SSE_USED]

	movaps	xmm7, [rdi+OFFSET_SSE_INOUT+112]
	movaps	xmm6, [rdi+OFFSET_SSE_INOUT+96]
	movaps	xmm5, [rdi+OFFSET_SSE_INOUT+80]
	movaps	xmm4, [rdi+OFFSET_SSE_INOUT+64]
	movaps	xmm3, [rdi+OFFSET_SSE_INOUT+48]
	movaps	xmm2, [rdi+OFFSET_SSE_INOUT+32]
	movaps	xmm1, [rdi+OFFSET_SSE_INOUT+16]
	movaps	xmm0, [rdi+OFFSET_SSE_INOUT]

	mov	r9,  [rdi+OFFSET_GPR_IN+40]
	mov	r8,  [rdi+OFFSET_GPR_IN+32]
	mov	rcx, [rdi+OFFSET_GPR_IN+24]
	mov	rdx, [rdi+OFFSET_GPR_IN+16]
	mov	rsi, [rdi+OFFSET_GPR_IN+8]

	mov	r11b, [rdi+OFFSET_RETURN_TYPE]
	mov	rdi,  [rdi+OFFSET_GPR_IN]

	cmp	r11b, RETURN_TYPE_STRET
	je	Lcall_send_stret

	cmp	r11b, RETURN_TYPE_JMP
	je	_objc_msgSend

	cmp	r11b, RETURN_TYPE_JMP_STRET
	je	_objc_msgSend_stret

	call	_objc_msgSend

Lafter_send:
	mov	rdi, [rbp-8]
	mov	[rdi+OFFSET_GPR_OUT], rax
	mov	[rdi+OFFSET_GPR_OUT+8], rdx
	movaps	[rdi+OFFSET_SSE_INOUT], xmm0
	movaps	[rdi+OFFSET_SSE_INOUT+16], xmm1

	mov	r11b, [rdi+OFFSET_RETURN_TYPE]

	cmp	r11b, RETURN_TYPE_X87
	je	Lpop_long_double

	cmp	r11b, RETURN_TYPE_COMPLEX_X87
	je	Lpop_complex_long_double

Lreturn:
	mov	rsp, rbp
	pop	rbp

	ret

Lfix_align:
	xor	r11, r11
	push	r11
	jmp	Lfill_stack

Lcall_send_stret:
	call	_objc_msgSend_stret
	jmp	Lafter_send

Lpop_long_double:
	fstp	tbyte ptr [rdi+OFFSET_X87_OUT]
	jmp	Lreturn

Lpop_complex_long_double:
	fstp	tbyte ptr [rdi+OFFSET_X87_OUT]
	fstp	tbyte ptr [rdi+OFFSET_X87_OUT+16]
	jmp	Lreturn