asm_dip/toolchain/fasm2/source/macos/x64/ccall.inc

24 lines
422 B
PHP
Raw Normal View History

2024-11-24 21:04:53 -08:00
; Adapted and tested by Jacob Young (jacobly.alt@gmail.com)
iterate reg, rdi, rsi, rdx, rcx, r8, r9
arguments.%? equ reg
end iterate
macro ccall? proc*,args&
local size
mov rbp,rsp
and rsp,0FFFFFFFFFFFFFFF0h
match any, args
iterate arg, args
if sizeof (arg)
lea arguments.%,[arg]
else if ~ arg eq arguments.%
mov arguments.%,arg
end if
end iterate
end match
call proc
mov rsp,rbp
end macro