summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Schleifer <js@nil.im>2020-06-30 01:53:16 +0000
committerJonathan Schleifer <js@nil.im>2020-06-30 01:53:16 +0000
commit9296afb5ae3bc367bc42fe8bc82b3dda92cedd84 (patch)
treedb53ab8ac67c8c8c106a41b43c6560da1a5601f8
parent0b7c5274ee984d32a45aeed192bcbaaf4f383d35 (diff)
Convert all x86/Win32 ASM to Intel syntax
GAS has decent support for Intel syntax these days, so there is little reason to stick with AT&T syntax. FossilOrigin-Name: 2630b77909e0ab16046b4a586c90453ec777861cb73fe31cb4cef97f6351b9da
-rw-r--r--src/forwarding/forwarding-x86-win32.S176
-rw-r--r--src/runtime/lookup-asm/lookup-asm-x86-win32.S50
2 files changed, 115 insertions, 111 deletions
diff --git a/src/forwarding/forwarding-x86-win32.S b/src/forwarding/forwarding-x86-win32.S
index 0b25a75a..a3cc1fab 100644
--- a/src/forwarding/forwarding-x86-win32.S
+++ b/src/forwarding/forwarding-x86-win32.S
@@ -17,138 +17,140 @@
#include "config.h"
+.intel_syntax noprefix
+
.globl _of_forward
.globl _of_forward_stret
.section .text
_of_forward:
- pushl %ebp
- movl %esp, %ebp
+ push ebp
+ mov ebp, esp
- pushl %ebx
- subl $20, %esp
+ push ebx
+ sub esp, 20
- movl 8(%ebp), %eax
- movl %eax, (%esp)
+ mov eax, [ebp+8]
+ mov [esp], eax
call _object_getClass
- movl %eax, (%esp)
- movl $sel_forwardingTargetForSelector_, %eax
- movl %eax, 4(%esp)
+ mov [esp], eax
+ mov eax, offset sel_forwardingTargetForSelector_
+ mov [esp+4], eax
call _class_respondsToSelector
- testl %eax, %eax
- jz 0f
+ test eax, eax
+ jz short 0f
- movl 8(%ebp), %eax
- movl %eax, (%esp)
- movl $sel_forwardingTargetForSelector_, %eax
- movl %eax, 4(%esp)
+ mov eax, [ebp+8]
+ mov [esp], eax
+ mov eax, offset sel_forwardingTargetForSelector_
+ mov [esp+4], eax
call _objc_msg_lookup
- movl 8(%ebp), %edx
- movl %edx, (%esp)
- movl $sel_forwardingTargetForSelector_, %edx
- movl %edx, 4(%esp)
- movl 12(%ebp), %edx
- movl %edx, 8(%esp)
- call *%eax
-
- testl %eax, %eax
- jz 0f
- cmpl 8(%ebp), %eax
- je 0f
-
- movl %eax, 8(%ebp)
- movl %eax, (%esp)
- movl 12(%ebp), %eax
- movl %eax, 4(%esp)
+ mov edx, [ebp+8]
+ mov [esp], edx
+ mov edx, offset sel_forwardingTargetForSelector_
+ mov [esp+4], edx
+ mov edx, [ebp+12]
+ mov [esp+8], edx
+ call eax
+
+ test eax, eax
+ jz short 0f
+ cmp eax, [ebp+8]
+ je short 0f
+
+ mov [ebp+8], eax
+ mov [esp], eax
+ mov eax, [ebp+12]
+ mov [esp+4], eax
call _objc_msg_lookup
- addl $20, %esp
- popl %ebx
- popl %ebp
+ add esp, 20
+ pop ebx
+ pop ebp
- jmp *%eax
+ jmp eax
0:
- addl $20, %esp
- popl %ebx
- popl %ebp
+ add esp, 20
+ pop ebx
+ pop ebp
jmp _of_method_not_found
_of_forward_stret:
- pushl %ebp
- movl %esp, %ebp
+ push ebp
+ mov ebp, esp
- pushl %ebx
- subl $20, %esp
+ push ebx
+ sub esp, 20
- movl 12(%ebp), %eax
- movl %eax, (%esp)
+ mov eax, [ebp+12]
+ mov [esp], eax
call _object_getClass
- movl %eax, (%esp)
- movl $sel_forwardingTargetForSelector_, %eax
- movl %eax, 4(%esp)
+ mov [esp], eax
+ mov eax, offset sel_forwardingTargetForSelector_
+ mov [esp+4], eax
call _class_respondsToSelector
- testl %eax, %eax
- jz 0f
+ test eax, eax
+ jz short 0f
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- movl $sel_forwardingTargetForSelector_, %eax
- movl %eax, 4(%esp)
+ mov eax, [ebp+12]
+ mov [esp], eax
+ mov eax, offset sel_forwardingTargetForSelector_
+ mov [esp+4], eax
call _objc_msg_lookup
- movl 12(%ebp), %edx
- movl %edx, (%esp)
- movl $sel_forwardingTargetForSelector_, %edx
- movl %edx, 4(%esp)
- movl 16(%ebp), %edx
- movl %edx, 8(%esp)
- call *%eax
-
- testl %eax, %eax
- jz 0f
- cmpl 12(%ebp), %eax
- je 0f
-
- movl %eax, 12(%ebp)
- movl %eax, (%esp)
- movl 16(%ebp), %eax
- movl %eax, 4(%esp)
+ mov edx, [ebp+12]
+ mov [esp], edx
+ mov edx, offset sel_forwardingTargetForSelector_
+ mov [esp+4], edx
+ mov edx, [ebp+16]
+ mov [esp+8], edx
+ call eax
+
+ test eax, eax
+ jz short 0f
+ cmp eax, [ebp+12]
+ je short 0f
+
+ mov [ebp+12], eax
+ mov [esp], eax
+ mov eax, [ebp+16]
+ mov [esp+4], eax
call _objc_msg_lookup_stret
- addl $20, %esp
- popl %ebx
- popl %ebp
+ add esp, 20
+ pop ebx
+ pop ebp
- jmp *%eax
+ jmp eax
0:
- addl $20, %esp
- popl %ebx
- popl %ebp
+ add esp, 20
+ pop ebx
+ pop ebp
jmp _of_method_not_found_stret
init:
- pushl %ebp
- movl %esp, %ebp
+ push ebp
+ mov ebp, esp
- pushl %ebx
- subl $4, %esp
+ push ebx
+ sub esp, 4
- movl $module, %eax
- movl %eax, (%esp)
+ mov eax, offset module
+ mov [esp], eax
call ___objc_exec_class
- addl $4, %esp
- popl %ebx
- popl %ebp
+ add esp, 4
+ pop ebx
+ pop ebp
ret
.section .ctors, "aw"
diff --git a/src/runtime/lookup-asm/lookup-asm-x86-win32.S b/src/runtime/lookup-asm/lookup-asm-x86-win32.S
index a3aa1caa..a68d3338 100644
--- a/src/runtime/lookup-asm/lookup-asm-x86-win32.S
+++ b/src/runtime/lookup-asm/lookup-asm-x86-win32.S
@@ -17,6 +17,8 @@
#include "config.h"
+.intel_syntax noprefix
+
.globl _objc_msg_lookup
.globl _objc_msg_lookup_stret
.globl _objc_msg_lookup_super
@@ -25,27 +27,27 @@
.section .text
.macro generate_lookup name not_found
\name:
- movl 4(%esp), %edx
- testl %edx, %edx
- jz ret_nil
+ mov edx, [esp+4]
+ test edx, edx
+ jz short ret_nil
- movl (%edx), %edx
- movl 32(%edx), %edx
+ mov edx, [edx]
+ mov edx, [edx+32]
.Lmain_\name:
- movl 8(%esp), %eax
+ mov eax, [esp+8]
#ifdef OF_SELUID24
- movzbl 2(%eax), %ecx
- movl (%edx,%ecx,4), %edx
+ movzx ecx, byte ptr [eax+2]
+ mov edx, [edx+ecx*4]
#endif
- movzbl 1(%eax), %ecx
- movl (%edx,%ecx,4), %edx
- movzbl (%eax), %ecx
- movl (%edx,%ecx,4), %eax
+ movzx ecx, byte ptr [eax+1]
+ mov edx, [edx+ecx*4]
+ movzx ecx, byte ptr [eax]
+ mov eax, [edx+ecx*4]
- testl %eax, %eax
- jz 0f
+ test eax, eax
+ jz short 0f
ret
@@ -55,15 +57,15 @@
.macro generate_lookup_super name lookup
\name:
- movl 4(%esp), %edx
- movl (%edx), %eax
- cmpl $0, %eax
- je ret_nil
+ mov edx, [esp+4]
+ mov eax, [edx]
+ test eax, eax
+ jz short ret_nil
- movl %eax, 4(%esp)
- movl 4(%edx), %edx
- movl 32(%edx), %edx
- jmp .Lmain_\lookup
+ mov [esp+4], eax
+ mov edx, [edx+4]
+ mov edx, [edx+32]
+ jmp short .Lmain_\lookup
.endm
generate_lookup _objc_msg_lookup _objc_method_not_found
@@ -72,9 +74,9 @@ generate_lookup_super _objc_msg_lookup_super _objc_msg_lookup
generate_lookup_super _objc_msg_lookup_super_stret _objc_msg_lookup_stret
ret_nil:
- movl $nil_method, %eax
+ mov eax, offset nil_method
ret
nil_method:
- xorl %eax, %eax
+ xor eax, eax
ret