From ce2b397f1ed4e589c724e192e74ffc99e00d5bb5 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 30 May 2007 22:21:11 +0000 Subject: [PATCH] Fix the handling of the \313 code. \313 indicates a fixed 64-bit address size. It was incorrectly documented and incorrectly implemented in the assembler, and was unimplemented in the disassembler. --- assemble.c | 5 ++--- disasm.c | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/assemble.c b/assemble.c index 831a9178..e32df627 100644 --- a/assemble.c +++ b/assemble.c @@ -52,13 +52,13 @@ * \310 - indicates fixed 16-bit address size, i.e. optional 0x67. * \311 - indicates fixed 32-bit address size, i.e. optional 0x67. * \312 - (disassembler only) marker on LOOP, LOOPxx instructions. - * \313 - indicates fixed 64-bit address size, no REX required. + * \313 - indicates fixed 64-bit address size, 0x67 invalid. * \320 - indicates fixed 16-bit operand size, i.e. optional 0x66. * \321 - indicates fixed 32-bit operand size, i.e. optional 0x66. * \322 - indicates that this instruction is only valid when the * operand size is the default (instruction to disassembler, * generates no code in the assembler) - * \323 - indicates fixed 64-bit operand size, REX on extensions, only. + * \323 - indicates fixed 64-bit operand size, REX on extensions only. * \324 - indicates 64-bit operand size requiring REX prefix. * \330 - a literal byte follows in the code stream, to be added * to the condition code value of the instruction. @@ -837,7 +837,6 @@ static int32_t calcsize(int32_t segment, int32_t offset, int bits, case 0312: break; case 0313: - length -= 1; break; case 0320: length += (bits != 16); diff --git a/disasm.c b/disasm.c index fcc0c54b..adf3a37a 100644 --- a/disasm.c +++ b/disasm.c @@ -505,6 +505,11 @@ static int matches(struct itemplate *t, uint8_t *data, int asize, return FALSE; else a_used = TRUE; + } else if (c == 0313) { + if (asize != 64) + return FALSE; + else + a_used = TRUE; } else if (c == 0320) { if (osize != 16) return FALSE;