6

In IDA I would press Alt+G and set the T register to 1 to first the code to be Thumb, but in Ghidra am not not sure how to force it.

The context is I have some functions pointed to by a data structure, I have set those to have a data type of a new function pointer type, so I am not sure if I really just need to re-analyze the code, and it will flow correctly (also not sure how to that), Or if I just need to manually force it.

[Edit:]I originally selected ARMv4 as my target, after doing some reading ARM architecture and starting again with ARMv7 the code correctly has Thumb support.

Simeon Pilgrim
  • 942
  • 6
  • 15

1 Answers1

6

So once in an architecture that has Thumb (ARMv7+) selecting the region of interest and pressing CTRL+R will bring up the Set Register Value editor, and selecting TMode and setting value 1.

If you have the Edit -> Tool Options -> Options | Listing Fields | Register Field | Display Hidden Registers set, you will have annotations like

assume TMode = 0x1

in your listings

Simeon Pilgrim
  • 942
  • 6
  • 15
  • Do you know how to do this from a script? The currentProgram object has a getRegister method to but no setRegister. – genghiskhan Dec 24 '19 at 18:23
  • Good reference for which ARM architectures support Thumb: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.kui0100a/armasm_cihedhif.htm – jmcarter9t Feb 04 '20 at 20:08