Lecture 07
Mechanisms in Procedures
1.passing control (to beginning of procedure code and back to return point)
2.passing data (procedure arguments and return value)
3.memory management (allocate and deallocate)
4.mechanisms all implemented with machine instructions
Stack Structure
1.region of memory managed stack discipline
2.grows toward lower addresses
3.register %rsp contain the lowest stack address (address of "top" element)
Calling Conventions
Procedure Control Flow
栈是以八个字节为单位进退的,0x130->0x128->0x120,一个内存单元可以存一个字节,即一个栈可以存八个字节,也就是说存的内存地址最多16位。
Procedure Data Flow
1.first 6 arguments
%rsi, %rdi, %rdx, %rcx, %r8, %r9
2.return value
%rax
Managing Local Data
stack frame
Each block we use for aparticular call then is called the stack frame.
register saving conventions
when the caller call the callee, may produce two value needing %rdi,
there are two ways of saving conventions: