项目作者: konstantin89

项目描述 :
Reference for ARM assembly topics.
高级语言: Assembly
项目地址: git://github.com/konstantin89/arm-asm-reference.git
创建时间: 2020-08-28T19:28:56Z
项目社区:https://github.com/konstantin89/arm-asm-reference

开源协议:MIT License

下载


arm-asm-reference

Internal

Course Content

External

ARM assembler simulator

system call table per arch


GNU build command reference

Assemble assembly source file into object file

  1. as -o program.o program.s

Assemble assembly source file into object file with debugging info

  1. as -g -o program.o program.s

Link assemble object file into executable

  1. ld -o program program.o

Exiting ASM program

The proper way to finish a program is by calling sys_exit.
System calls are called “Software Interrupt” command
The following code is an example of using exit system call:

  1. .global _start
  2. _start:
  3. MOV R0,#5 ; Set the parameter for sys_exit
  4. MOV R7,#1
  5. SWI 0 ; Call sys_exit

You can observe the exit code of the last exited command by running:

  1. echo $?


GNU vs Keil Directives

  1. .req - Alias for register.
  2. foo .req R0
  3. .equ - Define a constant.
  4. .equ BYTES_TO_ALLOCATE, 16

directives


System-calls calling conventions

system calls


Interesting topics

Stack pointer and Frame pointer