You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm currently working on a plugin to add support for the Qualcomm Hexagon architecture (docs) to ghidra.
I've made pretty good progress on dissassembly, but this architecture has many quirks that don't fit well into the sleigh model, but handling of dotnew registers is one I can't see a solution for.
Instructions in Hexagon are grouped into "packets" of up to 4 concurrently executing instructions, when referencing a register the value will be the value that the register held before the execution of the packet (the old value). If an instruction needs to reference the value produced by the current packet then a dotnew can be used. As an example:
Before: r0 = 0, P0=0
{ P0 = cmp.eq( r0 , #0 )
if (P0) jump:t 0x1000 }
After: P0=0xFF, jump is not taken
This is possible to implement in SLEIGH by having a second set of registers and some pre/post packet logic to shuffle the values around. However that only works if the use of the dotnew comes after its generation. The following is an example from real code where that doesn't hold:
As you can see the value is generated two sub-instructions after it is used, so that strategy can't be used. I can't really see any other feasible ways to implement this in Ghidra, so I'm hoping someone might have an idea how this could be done (ideally with as little re-writing of sleigh as possible)?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm currently working on a plugin to add support for the Qualcomm Hexagon architecture (docs) to ghidra.
I've made pretty good progress on dissassembly, but this architecture has many quirks that don't fit well into the sleigh model, but handling of dotnew registers is one I can't see a solution for.
Instructions in Hexagon are grouped into "packets" of up to 4 concurrently executing instructions, when referencing a register the value will be the value that the register held before the execution of the packet (the old value). If an instruction needs to reference the value produced by the current packet then a dotnew can be used. As an example:
This is possible to implement in SLEIGH by having a second set of registers and some pre/post packet logic to shuffle the values around. However that only works if the use of the dotnew comes after its generation. The following is an example from real code where that doesn't hold:
As you can see the value is generated two sub-instructions after it is used, so that strategy can't be used. I can't really see any other feasible ways to implement this in Ghidra, so I'm hoping someone might have an idea how this could be done (ideally with as little re-writing of sleigh as possible)?
Beta Was this translation helpful? Give feedback.
All reactions