This is not the current version of the class.

Assembly 2: Calling convention and control flow

Overview

We discuss calling conventions and control flow in machine code.

Full lecture notes on assemblyTextbook readings

Calling convention

Elements of a calling convention

Let’s explore: cc01.cccc03.cc

Arguments

Return values

cc04.cc

Function entry and exit sequence

Action of call FUNCTION instruction

subq $8, %rsp
movq %NEXT_rip, (%rsp)
movq FUNCTION, %rip

Action of ret instruction

addq $8, %rsp
movq -8(%rsp), %rip

cc05.cc

Local variables