What is .arm in assembly code ? -
the following code taken https://github.com/xilinx/linux-xlnx/blob/master/arch/arm/kernel/head.s
i have never done arm assembly programming can me understand going on in these lines? .ar.? etc:
.arm __head entry(stext) thumb( adr r9, bsym(1f) ) @ kernel entered in arm. thumb( bx r9 ) @ if thumb-2 kernel, thumb( .thumb ) @ switch thumb now. thumb(1: )
also kindly point me tutorials getting starting with.
plenty of arm microcontrollers have 2 different instruction sets:
- the default 32 bit arm instruction set
- the lightweight 16 bit thumb instruction set
during program execution, arm chip can switch between 2 modes in order run instructions of these sets.
the purpose of these lines seems selection of right mode (i.e., .arm or .thumb) in order execute subsequent code.
edit: sorry, made mistake. real purpose specify set of instruction used in generated code. example, if write add r0, r1, #3
, binary instruction produced belong either arm or thumb instruction set, depending on directive chose between .arm
, .thumb
.
from https://sourceware.org/binutils/docs/as/arm-directives.html :
.arm
this performs same action .code 32.
-
.thumb
this performs same action .code 16.
-
.code [16|32]
this directive selects instruction set being generated. value 16 selects thumb, value 32 selecting arm.
Comments
Post a Comment