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

Add suport for emulating movzx #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add suport for emulating movzx #35

wants to merge 2 commits into from

Conversation

truls
Copy link
Contributor

@truls truls commented Dec 8, 2016

No description provided.

@truls
Copy link
Contributor Author

truls commented Dec 8, 2016

I think the separation of state/value setting that you just committed is breaking it... I'll update the commit

@weidendo
Copy link
Contributor

weidendo commented Dec 8, 2016

Sorry, I am moving around some stuff in emulate.c.

But this PR (and perhaps following ones?) is straight-forward, no need for you to make it compile after every break. I can just apply it with slight modifications myself.

@weidendo
Copy link
Contributor

weidendo commented Dec 9, 2016

The first part of this PR (8/16-bit moves) is without test, and adds emulation of a large number of different conversions (for movsx). We do not really have emulator tests yet which check the result of emulation. We could add a debug output mode which only prints the static data -- which should be enough.
It would be nice to also extend the generator for the instructions.

@truls
Copy link
Contributor Author

truls commented Dec 9, 2016

My strategy for testing the results of the emulation is writing tests which performs a calculation that depends on the correctness of emulation and stores the result in rax. That way, since all values used in the tests are static, the only generated instruction will be storing the static result value into rax. It would, however, be nice to have a way of performing fine-grained unit testing of the emulation results of instructions. That would simplify the tests somewhat and make it easier to increase coverage.

You're right about the missing test cases for the movsx conversions and the missing generator support. I'll look into that.

@weidendo
Copy link
Contributor

weidendo commented Dec 9, 2016

About the emulator tests: I see, yes, that works. However, it really would be better to directly call something like emulateInstr() - not existing at the moment - , perhaps just on given input values, and checking for the correct output values/flags without having a dependency on instruction decoding are even different operand types...

@truls
Copy link
Contributor Author

truls commented Dec 9, 2016

Yes, I agree

@weidendo
Copy link
Contributor

weidendo commented Dec 9, 2016

Just committed the 1st part (8/16 bit mov operands) with 8/8, 16/16 test, but tests for the extended
movsx cases still wanted...

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