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

Fix emulator detection #1966

Merged
merged 4 commits into from
Jul 19, 2024
Merged

Conversation

mrexodia
Copy link
Contributor

@mrexodia mrexodia commented Jun 22, 2024

References:

This fixes the bswap ax detection as well as various other detections related to bad REX prefix handling. This bug is also still upstream in qemu, but they moved the code around quite a bit:

https://github.com/qemu/qemu/blob/ffeddb979400b1580ad28acbee09b6f971c3912d/target/i386/tcg/decode-new.c.inc#L2561-L2570

There are two fixes here:

  • bswap ax now correctly sets ax to zero
  • REX prefixes are correctly ignored when appropriate (they only apply when they are right next to the first byte of the instruction)

@mrexodia
Copy link
Contributor Author

The build errors on macos are also present on the main branch. No idea about the crash for MINGW64, help would be appreciated!

@wtdcode
Copy link
Member

wtdcode commented Jun 24, 2024 via email

@wtdcode
Copy link
Member

wtdcode commented Jul 19, 2024

I will fix CI before 2.1.0. Let this PR get in firstly.

@wtdcode wtdcode merged commit 87610ba into unicorn-engine:dev Jul 19, 2024
29 of 32 checks passed
@mrexodia mrexodia deleted the fix-emulator-detection branch August 30, 2024 01:31
@wtdcode
Copy link
Member

wtdcode commented Sep 21, 2024

You code accidentally trigger a long-live known mingw bug causing random segfaults on Windows, which was finally fixed in a5fa548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants