Hello,
I want to execute thumb instructions on foundation model. Please suggest how this can be done. If I run the thumb instructions as it is, the trace shows them as undefined instructions. The test case I have used is as follows:
.section .text
.global _start
_start:
.syntax unified
.THUMB
adc R7, R12, #0xad
The trace file generated shows that the instructions are not recognized:
---snip---
0 clk IT (0) 80000000 01fff04f O EL3h_s : DCI 0x01fff04f ; ? Undefined
0 clk E 80000000 00000084 CoreEvent_CURRENT_SPx_SYNC
0 clk R cpsr 000003cd
0 clk R ESR_EL3 02000000
0 clk R SPSR_EL3 000003cd
0 clk R ELR_EL3 0000000080000000
1 clk IT (1) 00000200 e7ff0010 O EL3h_s : DCI 0xe7ff0010 ; ? Undefined
1 clk E 00000200:0000000200 00000084 CoreEvent_CURRENT_SPx_SYNC
1 clk R cpsr 000003cd
1 clk R ESR_EL3 02000000
1 clk R SPSR_EL3 000003cd
1 clk R ELR_EL3 0000000000000200
2 clk IT (2) 00000200 e7ff0010 O EL3h_s : DCI 0xe7ff0010 ; ? Undefined
I also tried changing mode by ERET instruction:
adc X23, X25, X5 //Is in A64 mode
MOV x0,#0x131
MSR SCR_EL3,x0
MOV x1,#0x3c5 //Change to exception level EL1
adr X0, 22
MSR ELR_EL3,x0 //After ERET the control should go to last MOV
MSR SPSR_EL3, X1
MRS X1, SPSR_EL3
ERET //Should cause mode change to A32
However, the ERET instruction is still not able to change mode:
7 clk IT (7) 8000001c d53e4001 O EL3h_s : MRS x1,SPSR_EL3
7 clk R X1 00000000000003C5
8 clk IT (8) 80000020 d69f03e0 O EL3h_s : ERET
8 clk R cpsr 001003cd
8 clk E 80000024:0080000024 00000084 CoreEvent_CURRENT_SPx_SYNC
8 clk R cpsr 000003cd
8 clk R ESR_EL3 3a000000
8 clk R SPSR_EL3 001003cd
8 clk R ELR_EL3 0000000080000024
9 clk IT (9) 00000200 e7ff0010 O EL3h_s : DCI 0xe7ff0010 ; ? Undefined
What is the correct way to execute thumb instructions on the Foundation model?
Thanks,
Deepti