Skip to content

Incorrect registers in x86_64 loop/loope/loopne #2823

@hainest

Description

@hainest

Work environment

Questions Answers
System Capstone runs on OS/arch/bits Ubuntu x86_64
Capstone module affected x86
Source of Capstone git clone
Version/git commit 8872be6

loop instructions with a size override (i.e., prefix 0x67) should use ecx instead of rcx.

./cstool -dar x64 67e2c2
 0  67 e2 c2                                         loop	0xffffffffffffffc5
	ID: 348 (loop)
	Prefix:0x00 0x00 0x00 0x67 
	Opcode:0xe2 0x00 0x00 0x00 
	rex: 0x0
	addr_size: 4
	modrm: 0x0
	disp: 0x0
	sib: 0x0
	imm_count: 1
		imms[1]: 0xffffffffffffffc5
	op_count: 1
		operands[0].type: IMM = 0xffffffffffffffc5
		operands[0].size: 8
	Registers read: rip rcx
	Registers modified: rip rcx
	Groups: branch_relative

See #2799 for details. This can wait until a decision has been made about a new x86 backend (cf. #2505).

Metadata

Metadata

Assignees

No one assigned

    Labels

    X86ArchbugSomething is not working as it shouldoutdated-moduleIssue due to an outdated arch module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions