ARM APCS 学习笔记

最近在学习arm体系架构,先简单了解一下APCS。

什么是APCS?http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf

具体的概念随后理解下,先提供一个汇编和反汇编的方法,以供实验。之后会详细写APCS的东西。

获取arm gnu工具链之后,我们写一个简单的c代码。

int func0(int x)
{
        return x++;
}
void main()
{
        int x = 9;
        x = func0(x);
}

然后执行: arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb hello.c -nostartfiles -o hello.o

这时会生成hello.o,我们再反汇编一下:

arm-none-eabi-objdump -S hello.o > hello.s

hello.s:

hello.o:     file format elf32-littlearm


Disassembly of section .text:

00008000 <func0>:
    8000:       b480            push    {r7}
    8002:       b083            sub     sp, #12
    8004:       af00            add     r7, sp, #0
    8006: 
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值