Next: , Previous: Local Calls, Up: Calling Convention

2.3 Full Calls

     ;;; There is something of a cross-product effect with full calls.
     ;;; Different versions are used depending on whether we know the
     ;;; number of arguments or the name of the called function, and
     ;;; whether we want fixed values, unknown values, or a tail call.
     ;;; In full call, the arguments are passed creating a partial frame on
     ;;; the stack top and storing stack arguments into that frame. On
     ;;; entry to the callee, this partial frame is pointed to by FP.

Basically, we use caller-allocated frames, pass an fdefinition, function, or closure in EAX, argcount in ECX, and first three args in EDX, EDI, and ESI. EBP points to just past the start of the frame (the first frame slot is at [EBP-4], not the traditional [EBP], due in part to how the frame allocation works). The caller stores the link for the old frame at [EBP-4] and reserved space for a return address at [EBP-8]. [EBP-12] appears to be an empty slot available to the compiler within a function, it may-or-may-not be used by some of the call/return junk. The first stack argument is at [EBP-16]. The callee then reallocates the frame to include sufficient space for its local variables, after possibly converting any &rest arguments to a proper list.