最近在学习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: 6078 str r0, [r7, #4]
8008: 687b

本文是关于ARM APCS(ARM Procedure Call Standard)的学习笔记,首先介绍了APCS的基本概念,并提供了一种通过GNU工具链进行汇编和反汇编的方法。作者通过编写并编译C代码,生成汇编文件,计划以此为切入点深入解析APCS的细节。
最低0.47元/天 解锁文章
695





