Results 1 to 3 of 3
I'm reading arch/arm/boot/compressed/head.s, and have a question about the following codes:
ARM( mov r0, r0 )
ARM( b 1f )
THUMB( adr r12, BSYM(1f) )
THUMB( bx r12 )
what ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-01-2012 #1Just Joined!
- Join Date
- Dec 2011
- Posts
- 2
Ask a simple question
I'm reading arch/arm/boot/compressed/head.s, and have a question about the following codes:
ARM( mov r0, r0 )
ARM( b 1f )
THUMB( adr r12, BSYM(1f) )
THUMB( bx r12 )
what do "ARM()" and "THUMB()" mean? Are they ARM directives or macro? where can I find the definition of them?
Thanks.
- 01-02-2012 #2
This has to do with the fact that the ARM chip has two
modes, one is the normal ARM mode and one is THUMB
mode. My guess is that those instructions are macros
to make the mode switch.
- 01-02-2012 #3Just Joined!
- Join Date
- Dec 2011
- Posts
- 2
Thanks for your reply. I know ".arm" and ".thumb" are assembly directives for ARM and THUMB mode, but they are capital letters.
according to your remind, I searched all .h file, and I found where they are:
In arch/arm/include/asm/unified.h, there are several declaration. In short, if the cpu is Thumb2, use THUMB, otherwise ARM.
#ifdef CONFIG_THUMB2_KERNEL
#if __GNUC__ < 4
#error Thumb-2 kernel requires gcc >= 4
#endif
/* The CPSR bit describing the instruction set (Thumb) */
#define PSR_ISETSTATE PSR_T_BIT
#define ARM(x...)
#define THUMB(x...) x
#ifdef __ASSEMBLY__
#define W(instr) instr.w
#endif
#define BSYM(sym) sym + 1
#else /* !CONFIG_THUMB2_KERNEL */
/* The CPSR bit describing the instruction set (ARM) */
#define PSR_ISETSTATE 0
#define ARM(x...) x
#define THUMB(x...)
#ifdef __ASSEMBLY__
#define W(instr) instr
#endif
#define BSYM(sym) sym
#endif /* CONFIG_THUMB2_KERNEL */


Reply With Quote
