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 emulating some ARM firmware code and noticed that unicorn can not emulate 'msr' or 'mrs' and other 'platform specific' instructions. My solution is to use hook UC_HOOK_INSN_INVALID, and inside of the hook function, I manually emulate the behavior of these instructions, and adjust pc to skip them. However, even if I return "true" from the hook function, the emulation still throws UC_ERR_EXCEPTION. Is there a way to avoid execution flow interruption because of this?
I'm using unicorn-2.1.1 with python binding.
The text was updated successfully, but these errors were encountered:
I'm emulating some ARM firmware code and noticed that unicorn can not emulate 'msr' or 'mrs' and other 'platform specific' instructions.
The MSR and MRS instructions are supported by the Unicorn emulation. MRC and MCR have more spotty support for the different combinations, but the status to register (and vice-versa) instructions are supported. If you are seeing that they're not supported in your code, please ensure that you are in a privileged mode (which is how most firmware will probably be executed). Only a subset of the MSR/MRS operations are supported when you are in USR mode.
Whilst you may still need the fixes mentioned in the prior reply for other platform specific operations, you should be able to use those two instructions without any special emulation needed (unless, of course, you want to intentionally hook them to change their behaviour of course).
"The MSR and MRS instructions are supported by the Unicorn emulation" interesting as this is not what I'm seeing. In my case the instructions are something like "MSR r0, BASEPRI" -- maybe this register itself is not supported?
Hi,
I'm emulating some ARM firmware code and noticed that unicorn can not emulate 'msr' or 'mrs' and other 'platform specific' instructions. My solution is to use hook UC_HOOK_INSN_INVALID, and inside of the hook function, I manually emulate the behavior of these instructions, and adjust pc to skip them. However, even if I return "true" from the hook function, the emulation still throws UC_ERR_EXCEPTION. Is there a way to avoid execution flow interruption because of this?
I'm using unicorn-2.1.1 with python binding.
The text was updated successfully, but these errors were encountered: