Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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?

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    the hills
    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.

  3. #3
    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.


    #if __GNUC__ < 4
    #error Thumb-2 kernel requires gcc >= 4

    /* The CPSR bit describing the instruction set (Thumb) */

    #define ARM(x...)
    #define THUMB(x...) x
    #ifdef __ASSEMBLY__
    #define W(instr) instr.w
    #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
    #define BSYM(sym) sym

    #endif /* CONFIG_THUMB2_KERNEL */

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts