Fix a bug in decoding an instruction that has an SIB byte as well as an

immediate operand. The presence of an SIB byte in decoding the ModR/M field
would cause 'imm_bytes' to not be set to the correct value.

Fix this by initializing 'imm_bytes' independent of the ModR/M decoding.

Reported by: grehan@
Approved by: re@
This commit is contained in:
Neel Natu 2013-09-17 16:06:07 +00:00
parent dcc756789c
commit 0f9d5dc758
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255638

View File

@ -701,12 +701,6 @@ decode_modrm(struct vie *vie)
break;
}
/* Figure out immediate operand size (if any) */
if (vie->op.op_flags & VIE_OP_F_IMM)
vie->imm_bytes = 4;
else if (vie->op.op_flags & VIE_OP_F_IMM8)
vie->imm_bytes = 1;
done:
vie_advance(vie);
@ -822,6 +816,12 @@ decode_immediate(struct vie *vie)
int32_t signed32;
} u;
/* Figure out immediate operand size (if any) */
if (vie->op.op_flags & VIE_OP_F_IMM)
vie->imm_bytes = 4;
else if (vie->op.op_flags & VIE_OP_F_IMM8)
vie->imm_bytes = 1;
if ((n = vie->imm_bytes) == 0)
return (0);