Partager via


THUMB-enabled ARM Implementation (Windows CE 5.0)

Send Feedback

THUMB-enabled ARM microprocessors can execute 16-bit THUMB instructions in addition to the usual 32-bit ARM instructions.

To execute THUMB instructions, switch the microprocessor into THUMB mode.

To resume executing ARM instructions, switch the microprocessor back into ARM mode.

The instruction that accomplishes the mode switch is the branch and exchange (BX) instruction.

To call a function compiled by the THUMB compiler from within a function compiled by the ARM compiler, the code sequence must include a BX instruction on the caller side and on the callee side.

The BX instruction is of the form BX Rx**,** where Rx is a register containing an address.

If the low bit of the BX target address is set, BX causes a switch into THUMB mode.

If the low bit of the BX target address is not set, BX causes a switch into ARM mode.

The linker sets the low bit of THUMB function addresses at link time.

The ARM C/C++ compiler supports function calls and returns for ARM/THUMB interworking. The following mechanisms support interworking.

  • Compiler flags
  • Language extensions by way of interworking declspec modifiers
  • Link-time generation of thunking routines

The use of an interworking calling sequence allows but does not require a mode switch to occur.

In addition, a THUMB function can call another THUMB function and an ARM function can call another ARM function through an interworking calling sequence.

See Also

Compiler Flags for Interworking | Declspecs | Linker-generated Thunking Routines | Code Size Considerations

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.