Finding arguments after the prologue

An x86-64 Linux assembly function uses the System V AMD64 convention and receives eight long arguments named a1 through a8, in that order. Each long and return address occupies 8 bytes. At entry, a7 and a8 occupy consecutive stack slots immediately above the return address.


The function executes this prologue without changing any argument registers:


asm
push rbp
mov rbp, rsp
push rbx
sub rsp, 24


Complete the table for the instant after these instructions. For register locations, enter the lowercase register name. For stack locations, enter the exact integer byte displacement from the current RSP, so a displacement of 32 means [rsp + 32].


The incoming stack places argument eight above argument seven and the return address.


ArgumentRequested locationAnswer
a3Register name
a6Register name
a7Byte displacement from current RSP
a8Byte displacement from current RSP

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Assembler with C Questions: