libk  x86.cdecl.32.s at [f0f16493ca]

File arch/x86.cdecl.32.s artifact 6e1eece757 part of check-in f0f16493ca


;; 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