HW24
COP-3402

  1. Draw the stack frames for the following two functions (after running main and calling f, but before f returns). Remember to include

    • the return address,
    • the old base pointer, and
    • the local variables
    function main
    localVariables retval x
    x := 2
    retval := call f
    return x
    end function
    
    function f
    localVariables x
    parameters x
    x := 3
    return x
    end function
    
  2. Write mov instruction(s) that implement x := 2 above in function f.
  3. In the x86 64 System V ABI, how are parameters passed?
  4. The following are the contents of a stack frame, label which ones are caller created and which are callee created in the x86 64 System V ABI:
    • Stack parameters
    • Return address
    • Local variables
    • Old base pointer

Author: Paul Gazzillo

Created: 2025-10-15 Wed 09:59