From 47d02a8898777c681d263259b0e70d296813f5ff Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Sun, 17 Nov 2024 22:16:20 +0000 Subject: [PATCH] Differentiate for the fourth argument on x64 Windows and Unix - %r9 for Windows - %rcx for Unix --- objc_msgSend.x86-64.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/objc_msgSend.x86-64.S b/objc_msgSend.x86-64.S index 2d153140..10ecd163 100644 --- a/objc_msgSend.x86-64.S +++ b/objc_msgSend.x86-64.S @@ -7,6 +7,7 @@ # define FIRST_ARGUMENT %rcx # define SECOND_ARGUMENT %rdx # define THIRD_ARGUMENT %r8 +# define FOURTH_ARGUMENT %r9 #else # define START_PROC(x) .cfi_startproc # define END_PROC(x) .cfi_endproc @@ -15,6 +16,7 @@ # define FIRST_ARGUMENT %rdi # define SECOND_ARGUMENT %rsi # define THIRD_ARGUMENT %rdx +# define FOURTH_ARGUMENT %rcx #endif .macro MSGSEND fnname receiver, sel @@ -209,7 +211,7 @@ 5: # slowSend: push %rax # We need to preserve all registers that may contain arguments: push %rbx - push %rcx + push FOURTH_ARGUMENT push %r8 push %r9 @@ -258,7 +260,7 @@ pop %r9 pop %r8 - pop %rcx + pop FOURTH_ARGUMENT pop %rbx pop %rax jmp 7b