summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Schleifer <js@nil.im>2020-06-30 23:56:10 +0000
committerJonathan Schleifer <js@nil.im>2020-06-30 23:56:10 +0000
commit6e430db6f77d8d669ca4477a6220ab53b04026e1 (patch)
tree7d3aac882547bc7be1bdeeb5642bb4399c4e048a
parentea957811d35d168ed47b8a54fc4dd327c915aa40 (diff)
Convert call-x86_64-elf.S to Intel syntax
FossilOrigin-Name: 71c7f864e4c18a9e77b85ad303c630f664ccff77d405f0d92439fb872c621c0c
-rw-r--r--src/invocation/call-x86_64-elf.S160
1 files changed, 81 insertions, 79 deletions
diff --git a/src/invocation/call-x86_64-elf.S b/src/invocation/call-x86_64-elf.S
index e8ceb51b..bf2b2454 100644
--- a/src/invocation/call-x86_64-elf.S
+++ b/src/invocation/call-x86_64-elf.S
@@ -19,121 +19,123 @@
#include "invoke-x86_64.h"
+.intel_syntax noprefix
+
.globl of_invocation_call
.section .text
of_invocation_call:
- pushq %rbp
- movq %rsp, %rbp
+ pushq rbp
+ mov rbp, rsp
- subq $16, %rsp
- andq $-16, %rsp
- movq %rdi, -8(%rbp)
+ sub rsp, 16
+ and rsp, -16
+ mov [rbp-8], rdi
- movb OFFSET_RETURN_TYPE(%rdi), %r11b
- cmpb $RETURN_TYPE_STRET, %r11b
- je .lookup_stret
- cmpb $RETURN_TYPE_JMP_STRET, %r11b
- je .lookup_stret
+ mov r11b, [rdi+OFFSET_RETURN_TYPE]
+ cmp r11b, RETURN_TYPE_STRET
+ je short .Llookup_stret
+ cmp r11b, RETURN_TYPE_JMP_STRET
+ je short .Llookup_stret
- movq OFFSET_GPR_IN+8(%rdi), %rsi
- movq OFFSET_GPR_IN+0(%rdi), %rdi
+ mov rsi, [rdi+OFFSET_GPR_IN+8]
+ mov rdi, [rdi+OFFSET_GPR_IN]
call objc_msg_lookup@PLT
-.after_lookup:
- movq %rax, -16(%rbp)
- movq -8(%rbp), %rdi
+.Lafter_lookup:
+ mov [rbp-16], rax
+ mov rdi, [rbp-8]
- leaq OFFSET_STACK(%rdi), %rdx
- movq OFFSET_STACK_SIZE(%rdi), %rcx
+ lea rdx, [rdi+OFFSET_STACK]
+ mov rcx, [rdi+OFFSET_STACK_SIZE]
- testq $1, %rcx
- jnz .fix_align
+ test rcx, $1
+ jnz short .Lfix_align
-.fill_stack:
- testq %rcx, %rcx
- jz .stack_filled
+.Lfill_stack:
+ test rcx, rcx
+ jz short .Lstack_filled
- decq %rcx
- movq (%rdx,%rcx,8), %r11
- pushq %r11
+ dec rcx
+ mov r11, [rdx+rcx*8]
+ push r11
- jmp .fill_stack
+ jmp short .Lfill_stack
.stack_filled:
- movb OFFSET_NUM_SSE_USED(%rdi), %al
+ mov al, [rdi+OFFSET_NUM_SSE_USED]
- 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
+ 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]
- 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
+ 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]
- movb OFFSET_RETURN_TYPE(%rdi), %r11b
- movq OFFSET_GPR_IN(%rdi), %rdi
+ mov r11b, [rdi+OFFSET_RETURN_TYPE]
+ mov rdi, [rdi+OFFSET_GPR_IN]
- cmpb $RETURN_TYPE_JMP, %r11b
- je .jmp_into_method
- cmpb $RETURN_TYPE_JMP_STRET, %r11b
- je .jmp_into_method
+ cmp r11b, RETURN_TYPE_JMP
+ je short .Ljmp_into_method
+ cmp r11b, RETURN_TYPE_JMP_STRET
+ je short .Ljmp_into_method
- movq -16(%rbp), %r11
- call *%r11
+ mov r11, [rbp-16]
+ call r11
-.after_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)
+.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
- movb OFFSET_RETURN_TYPE(%rdi), %r11b
+ mov r11b, [rdi+OFFSET_RETURN_TYPE]
- cmpb $RETURN_TYPE_X87, %r11b
- je .pop_long_double
+ cmp r11b, RETURN_TYPE_X87
+ je short .Lpop_long_double
- cmpb $RETURN_TYPE_COMPLEX_X87, %r11b
- je .pop_complex_long_double
+ cmp r11b, RETURN_TYPE_COMPLEX_X87
+ je short .Lpop_complex_long_double
-.return:
- movq %rbp, %rsp
- popq %rbp
+.Lreturn:
+ mov rsp, rbp
+ pop rbp
ret
-.fix_align:
- xorq %r11, %r11
- pushq %r11
- jmp .fill_stack
+.Lfix_align:
+ xor r11, r11
+ push r11
+ jmp short .Lfill_stack
-.lookup_stret:
- movq OFFSET_GPR_IN+16(%rdi), %rsi
- movq OFFSET_GPR_IN+8(%rdi), %rdi
+.Llookup_stret:
+ mov rsi, [rdi+OFFSET_GPR_IN+16]
+ mov rdi, [rdi+OFFSET_GPR_IN+8]
call objc_msg_lookup_stret@PLT
- jmp .after_lookup
+ jmp short .Lafter_lookup
-.jmp_into_method:
- movq -16(%rbp), %r11
- jmp *%r11
+.Ljmp_into_method:
+ mov r11, [rbp-16]
+ jmp r11
-.pop_long_double:
- fstpt OFFSET_X87_OUT(%rdi)
- jmp .return
+.Lpop_long_double:
+ fstp tbyte ptr [rdi+OFFSET_X87_OUT]
+ jmp short .Lreturn
.pop_complex_long_double:
- fstpt OFFSET_X87_OUT(%rdi)
- fstpt OFFSET_X87_OUT+16(%rdi)
- jmp .return
+ fstp tbyte ptr [rdi+OFFSET_X87_OUT]
+ fstp tbyte ptr [rdi+OFFSET_X87_OUT+16]
+ jmp short .Lreturn
#ifdef OF_LINUX
.section .note.GNU-stack, "", %progbits