libk  Artifact [6e1eece757]

Artifact 6e1eece757523fdbb494d3d8bf79d933b2eaf787a9b4ac28f91302940ad04a47:


;; x86.cdecl.32.s: x86 cdecl impl
; vim: ft=nasm

%macro ccall 1-*
	%assign i 0
	; arguments must be pushed to the stack backwards
	%assign ct (%0-ct)-1
	%rotate ct
	%rep ct
		%rotate -1
		push %1
	%endrep
	%rotate ct
	push esp ; it's our responsibility to preserve the stack
	call %1
	; the arguments are still on the stack; time to
	; dump them back into the Garbage Zone
	pop esp
%endmacro