Replies: 3 comments 2 replies
-
You can't know for an entire ARM binary because it's a dynamic setting; unless your elf is for a specific processor that only supports Thumb instructions it's highly likely your binary will have a mix. You can however tell for a specific function by looking at the branches to the code in question; the LSB of the destination address in a BLX is actually the Thumb instruction set bit. Which is why branches to thumb code are always odd. Ghidra will end up showing these as (Label+1) if you have a function or label defined. |
Beta Was this translation helpful? Give feedback.
-
My question was more about determining whether an ARM binary has only 32
bit instructions or mix of 32 and 16 bits instructions.
Is there any API function for that?
On Fri 12. May 2023 at 07:22, James Churchill ***@***.***> wrote:
You can't know for an *entire* ARM binary because it's a dynamic setting;
unless your elf is for a specific processor that *only* supports Thumb
instructions it's highly likely your binary will have a mix.
You can however tell for a specific function by looking at the branches to
the code in question; the LSB of the destination address in a BLX is
actually the Thumb instruction set bit. Which is why branches to thumb code
are always odd. Ghidra will end up showing these as (Label+1) if you have a
function or label defined.
—
Reply to this email directly, view it on GitHub
<#5103 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHYJNBAXNSPU2NDUFTIYWZTXFXCI7ANCNFSM6AAAAAAV4ZM27M>
.
You are receiving this because you authored the thread.Message ID:
<NationalSecurityAgency/ghidra/repo-discussions/5103/comments/5880813@
github.com>
--
|
Beta Was this translation helpful? Give feedback.
-
No, I don't see how you could. You'd have to have the entire binary analyzed and all the code sections correctly identified and marked already, at which point you already know. |
Beta Was this translation helpful? Give feedback.
-
Hi,
ARM has an instruction encoding that is called thumb2, that encodes some instructions in 2 bytes among the 4 bytes instructions, and RISCV also has similar instruction encoding called compressesd.
Is there an API call/method that Ghidra provides to tell if the current opened program is in Thumb2 or Compressed mode? The way I currently do it, I check the length of the current instruction at the current address, but I don't know a way to judge the whole executable, I always depend on the length of the current instruction.
Thanks in advance for your help.
Beta Was this translation helpful? Give feedback.
All reactions