汇编学习笔记(2015 CMU CSAPP)

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:

Inllustration of recursion

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值