Calling Convention Save caller save registers (%eax, edx %ecx) Push actual arguments from right to left Call instruction Save return address Transfer control to callee
16 Calling Convention • Save caller save registers (%eax, %edx, %ecx) • Push actual arguments from right to left • Call instruction – Save return address – Transfer control to callee
Passing Parameters pushl argument Argument n esp
17 Passing Parameters pushl argument n ……… Argument n %esp
Passing Parameters pushl argument Argument n pushl argument 1 e。 Argument esp 18
18 Passing Parameters pushl argument n …………… pushl argument 1 ……… Argument n ……… Argument 1 %esp
Passing Parameters pushl argument Argument n pushl argument 1 e。 Argument ↑1 can callee Return address esp
19 Passing Parameters pushl argument n …………… pushl argument 1 call callee ……… Argument n ……… Argument 1 Return address %esp
cd工 nstruction P172 call label direct) call operand (indirect) Save return address in the stack Jump to the entry to callee
20 Call Instruction P172 • call label (direct) • call *operand (indirect) • Save return address in the stack • Jump to the entry to callee