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

Cannot correctly explain the operand access mode of the bts instruction #29

Open
LLLZed opened this issue Dec 15, 2020 · 3 comments
Open

Comments

@LLLZed
Copy link

LLLZed commented Dec 15, 2020

disinfo.CompleteInstr: bts qword ptr ds:[rcx], 08h
disinfo.Instruction.Category: 10005
disinfo.AccessMode: 1

I think the access mode of this instruction should be READ+WRITE

@BeaEngine
Copy link
Owner

you are right, actually, when operand is READ+WRITE, BeaEngine uses WRITE but it is wrong. Work in progress...

BeaEngine added a commit that referenced this issue Dec 17, 2020
@BeaEngine
Copy link
Owner

fixed in commit fb42d80

from BeaEnginePython import *
buffer = bytes.fromhex('480fba2908')
instr = Disasm(buffer)
instr.read()
print(instr.json())

output is:

{
    "repr": "bts qword ptr [rcx], 08h",
    "category": "GENERAL_PURPOSE_INSTRUCTION",
    "mnemonic": "bts",
    "bytes": "48 0f ba 29 08",
    "error": 0,
    "arch": 64,
    "operands": {
        "1": {
            "repr": "rcx",
            "type": "memory",
            "size": 64,
            "mode": "read+write",
            "memory": {
                "base": "REG1",
                "index": "",
                "scale": 0,
                "displacement": "0x0"
            }
        },
        "2": {
            "repr": "08h",
            "type": "constant",
            "size": 8,
            "mode": "read"
        }
    },
    "registers": {
        "modified": {
            "type": 32,
            "gpr": "",
            "mmx": "",
            "xmm": "",
            "ymm": "",
            "zmm": "",
            "special": "REG0",
            "cr": "",
            "dr": "",
            "mem_management": "",
            "mpx": "",
            "opmask": "",
            "segment": "",
            "fpu": "",
            "tmm": ""
        },
        "read": {
            "type": 2049,
            "gpr": "REG1",
            "mmx": "",
            "xmm": "",
            "ymm": "",
            "zmm": "",
            "special": "",
            "cr": "",
            "dr": "",
            "mem_management": "",
            "mpx": "",
            "opmask": "",
            "segment": "REG1",
            "fpu": "",
            "tmm": ""
        }
    },
    "rflags": {
        "of": "undef",
        "sf": "undef",
        "zf": "undef",
        "af": "undef",
        "pf": "undef",
        "cf": "modified",
        "tf": null,
        "if": null,
        "df": null,
        "nt": null,
        "rf": null
    },
    "immediat": "0x8"
}

@BeaEngine
Copy link
Owner

Last release 5.3.0 is now available : https://github.com/BeaEngine/beaengine/releases/tag/v5.3.0

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