Professional Documents
Culture Documents
1
AGENDA
1. Thumb mode
2. Difference between Thumb and Normal mode
3. Switching to Thumb Mode
2
THUMB MODE - INTRODUCTION
Jazelle state is not set and so is THUMB state since T=0. And hence the state selected is
3
ARM. And the mode value is set as 11111.
THUMB MODE -
INTRODUCTION
oCore has two execution states ARM and Thumb;
oThumb is a compressed and 16 bit representation of a subset of the ARM instruction
set.
oLike ARM, Thumb also uses load store architecture for data processing, data
transfer and control flow instructions.
oThe standard chip that includes the Thumb instruction set is the ARM7TDMI where
"T" specifies Thumb.
4
THUMB MODE
5
DIFFERENCE
6
REGISTER SET
When operating in the 16-bit Thumb state, the application encounters a slightly
different set of registers. Figure 1 compares the programmer's model in that
state to the same model in the 32-bit ARM state.
8
HOW TO SET THUMB STATE?
D3 is the default value for the CPSR as shown in the below. So by default one can observe that the
Thumb state is disabled. To get it enabled, as already discussed CPSR should be accessed and T bit
should be set.
9
CONTD.,
Setting the T bit can be done by adding 0x20 to the D3. It will then set the T bit and
eventually the THUMB mode will be set
10
MOV AND SHIFT – 3-ADDRESS
11
ADD/SUB – 3-ADDRESS
12
MOV/ADD/CMP/SUB #IMM – 2-
ADDRESS
13
OTHER ALU OPERATIONS – 2-
ADDRESS
14
USING HI-REGISTERS / BX
15
LOAD 1 – PC-RELATIVE
16
LDR/STR WITH REGISTER
OFFSET
17
LDR/STR -3 : SIGNED
BYTE/HALF-WORD
18
LDR/STR-4 – IMMEDIATE
OFFSET
19
LDR/STR-5 – HALF-WORD
20
LDR/STR-5 : SP-RELATIVE
21
BRANCH INSTRUCTION FORMATS
FEATURES
To allow for a reasonably large offset to the target subroutine each of these two
instructions is automatically translated by the assembler into a sequence of two 16
bit thumb instructions
1. H = 10
LR := PC + (sign-extended offset shifted left 12 places);
2. H = 11
PC := LR + (offset shifted left 1 place)
1 1 0 1 1 1 1 1 8 – Bit Immediate
27 of 37