Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sleigh userop 'LOCK' is not in the library #7495

Open
astrelsky opened this issue Feb 13, 2025 · 3 comments
Open

Sleigh userop 'LOCK' is not in the library #7495

astrelsky opened this issue Feb 13, 2025 · 3 comments
Assignees
Labels
Status: Internal This is being tracked internally by the Ghidra team Type: Enhancement New feature or request

Comments

@astrelsky
Copy link
Contributor

Describe the bug
Basic x86 instructions such as XCHG cannot be emulated

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to step through the x86 XCHG instruction.
  2. 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
@nsadeveloper789
Copy link
Contributor

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.

@nsadeveloper789
Copy link
Contributor

Found the other issue: #6089

@nsadeveloper789 nsadeveloper789 self-assigned this Feb 13, 2025
@nsadeveloper789 nsadeveloper789 added Type: Enhancement New feature or request Status: Internal This is being tracked internally by the Ghidra team labels Feb 13, 2025
@astrelsky
Copy link
Contributor Author

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Internal This is being tracked internally by the Ghidra team Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants