ghidra
ghidra copied to clipboard
Sleigh userop 'LOCK' is not in the library
Describe the bug Basic x86 instructions such as XCHG cannot be emulated
To Reproduce Steps to reproduce the behavior:
- Attempt to step through the x86 XCHG instruction.
- See error
Expected behavior Basic instructions should be emulatable in the GUI. Especially ones that are fundamentally a no op as far as emulation is concerned.
Environment (please complete the following information):
- Ghidra Version: 11.3 and 11.4_DEV
So the more general solution to this problem is currently in progress. At the moment, you can use a script to install a handler for LOCK, at which point the GUI becomes capable of emulating the affected instructions. I believe this is documented in the "Modeling" section of the Debugger course. I can't find the original issue, but I believe this same question was asked of the ARM (maybe AARCH64) emulator, so I imagine this ask is still about making it easier, i.e., no scripts.
As for the upcoming solution, we're essentially re-working the EmulateStateModifier thing. Each pspec file will name one or more PcodeUseropLibraries to incorporate into the emulator by default. We have some existing modifiers to port over first, and then we plan to go after the common processors to ensure their userops all have some default handler.
Found the other issue: https://github.com/NationalSecurityAgency/ghidra/issues/6089
So the more general solution to this problem is currently in progress. At the moment, you can use a script to install a handler for LOCK, at which point the GUI becomes capable of emulating the affected instructions. I believe this is documented in the "Modeling" section of the Debugger course. I can't find the original issue, but I believe this same question was asked of the ARM (maybe AARCH64) emulator, so I imagine this ask is still about making it easier, i.e., no scripts.
As for the upcoming solution, we're essentially re-working the
EmulateStateModifierthing. Each pspec file will name one or more PcodeUseropLibraries to incorporate into the emulator by default. We have some existing modifiers to port over first, and then we plan to go after the common processors to ensure their userops all have some default handler.
Ok. I took the simplest solution for now and just removed all the LOCK and UNLOCK calls from the sleigh files. So now it just runs up until it fails for an unrelated reason that I can solve so I won't be emulating it anyway.