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

Another corner case shift issue #8

Closed
DCNick3 opened this issue Jul 23, 2020 · 5 comments
Closed

Another corner case shift issue #8

DCNick3 opened this issue Jul 23, 2020 · 5 comments

Comments

@DCNick3
Copy link

DCNick3 commented Jul 23, 2020

The following snippet

stc
mov $0x00, %al
rcr $0x20, %al

sets al to 0x8, while 0 is expected, as x86 masks the shift count with 0x1f before the rotate.

nepx added a commit that referenced this issue Jul 24, 2020
@nepx
Copy link
Owner

nepx commented Jul 24, 2020

Thanks for the report. I believe it should be fixed now.

@DCNick3
Copy link
Author

DCNick3 commented Jul 24, 2020

I believe the 32-bit shift should be changed to just & 0x1f, as per intel's pseudocode.
Screenshot_20200724_104354

nepx added a commit that referenced this issue Jul 24, 2020
@nepx
Copy link
Owner

nepx commented Jul 24, 2020

It should be fixed now, thanks for letting me know.

By the way, how are you finding all these corner-case shift bugs?

@DCNick3
Copy link
Author

DCNick3 commented Jul 24, 2020

I'm doing my own implementation of JIT-based x86 emulator. To make it easier to develop I fuzz it using (a bit patched) halfix implementation and compare results. Most times the fault is mine, but sometimes I find bugs in halfix =)

@nepx
Copy link
Owner

nepx commented Jul 24, 2020

That's really cool, I'm planning on adding a JIT compiler too, I hope to see your project soon!

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

No branches or pull requests

2 participants