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

Support for rol and ror #183

Open
carlreinke opened this issue Oct 7, 2018 · 1 comment
Open

Support for rol and ror #183

carlreinke opened this issue Oct 7, 2018 · 1 comment

Comments

@carlreinke
Copy link

Snowman outputs something like asm("rol ecx, 1"); and doesn't do proper data flow through the instruction.

@easyaspi314
Copy link

Haven't done the flags yet, but this is a start.

            case UD_Iror: {
                auto size = operand(0).size();
                if (hasOperand(1)) {
                    _[operand(0) ^= (unsigned_(operand(0)) >> operand(1)) | (unsigned_(operand(0)) << (constant(size) - operand(1))) ];
                } else {
                    _[operand(0) ^= (unsigned_(operand(0)) >> constant(1)) | (unsigned_(operand(0)) << constant(size - 1)) ];
                }

                _[
                    cf ^= intrinsic(),
                    sf ^= undefined(),
                    zf ^= operand(0) == constant(0),
                    pf ^= intrinsic(),
                    less ^= ~(sf == of),
                    less_or_equal ^= less | zf,
                    below_or_equal ^= cf | zf
                ];
                break;
            }
            case UD_Irol: {
                auto size = operand(0).size();
                if (hasOperand(1)) {
                    _[operand(0) ^= (unsigned_(operand(0)) << operand(1)) | (unsigned_(operand(0)) >> (constant(size) - operand(1))) ];
                } else {
                    _[operand(0) ^= (unsigned_(operand(0)) << constant(1)) | (unsigned_(operand(0)) >> constant(size - 1)) ];
                }

                _[
                    cf ^= intrinsic(),
                    sf ^= undefined(),
                    zf ^= operand(0) == constant(0),
                    pf ^= intrinsic(),
                    less ^= ~(sf == of),
                    less_or_equal ^= less | zf,
                    below_or_equal ^= cf | zf
                ];
                break;
            }

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