Skip to content

Big movabsq Instructions' Immediates shown in Dec in AT&T Syntax #2817

@rectrap

Description

@rectrap

Work environment

Questions Answers
System Capstone runs on OS/arch/bits Debian x86-64
Capstone module affected x86
Source of Capstone radare2
Version/git commit v5.0.6

Instruction bytes giving faulty results

48b80000000000000080

Expected results

It should be:

 0  48 b8 00 00 00 00 00 00 00 80                    movabsq	$0x8000000000000000, %rax
	ID: 461 (movabs)
	Prefix:0x00 0x00 0x00 0x00 
	Opcode:0xb8 0x00 0x00 0x00 
	rex: 0x48
	addr_size: 8
	modrm: 0x0
	disp: 0x0
	sib: 0x0
	imm_count: 1
		imms[1]: 0x8000000000000000
	op_count: 2
		operands[0].type: IMM = 0x8000000000000000
		operands[0].size: 8
		operands[1].type: REG = rax
		operands[1].size: 8
		operands[1].access: WRITE
	Registers modified: rax

Steps to get the wrong result

With cstool:

./cstool -d x64att 48b80000000000000080

Comments:

In x64att architecture, in movabsq instructions, if the immediate is greater or equal than 2^63 (0x8000000000000000), it is always shown in decimal, instead of expected hexadecimal. Intel syntax doesn't have this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    X86ArchbugSomething is not working as it should

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions