From: Peter Johnson Date: Fri, 1 Aug 2003 03:52:35 +0000 (-0000) Subject: Fix iretq, stosq, etc, which were properly setting the opersize but the REX X-Git-Tag: v0.3.0~6^2~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b8b002131a04760f162650d78cdb43da53d5eba;p=yasm Fix iretq, stosq, etc, which were properly setting the opersize but the REX generation code wasn't seeing it because it wasn't looking at the modified opersize. Bug noticed by: Antoine Leca (x86-64 discuss ML) svn path=/trunk/yasm/; revision=1022 --- diff --git a/modules/arch/x86/tests/Makefile.inc b/modules/arch/x86/tests/Makefile.inc index 0c8a3a13..26a6814a 100644 --- a/modules/arch/x86/tests/Makefile.inc +++ b/modules/arch/x86/tests/Makefile.inc @@ -30,6 +30,9 @@ EXTRA_DIST += modules/arch/x86/tests/fwdequ64.hex EXTRA_DIST += modules/arch/x86/tests/genopcode.asm EXTRA_DIST += modules/arch/x86/tests/genopcode.errwarn EXTRA_DIST += modules/arch/x86/tests/genopcode.hex +EXTRA_DIST += modules/arch/x86/tests/iret.asm +EXTRA_DIST += modules/arch/x86/tests/iret.errwarn +EXTRA_DIST += modules/arch/x86/tests/iret.hex EXTRA_DIST += modules/arch/x86/tests/jmp64-1.asm EXTRA_DIST += modules/arch/x86/tests/jmp64-1.errwarn EXTRA_DIST += modules/arch/x86/tests/jmp64-1.hex @@ -83,6 +86,9 @@ EXTRA_DIST += modules/arch/x86/tests/segmov.hex EXTRA_DIST += modules/arch/x86/tests/shift.asm EXTRA_DIST += modules/arch/x86/tests/shift.errwarn EXTRA_DIST += modules/arch/x86/tests/shift.hex +EXTRA_DIST += modules/arch/x86/tests/stos.asm +EXTRA_DIST += modules/arch/x86/tests/stos.errwarn +EXTRA_DIST += modules/arch/x86/tests/stos.hex EXTRA_DIST += modules/arch/x86/tests/twobytemem.asm EXTRA_DIST += modules/arch/x86/tests/twobytemem.errwarn EXTRA_DIST += modules/arch/x86/tests/twobytemem.hex diff --git a/modules/arch/x86/tests/iret.asm b/modules/arch/x86/tests/iret.asm new file mode 100644 index 00000000..2521f584 --- /dev/null +++ b/modules/arch/x86/tests/iret.asm @@ -0,0 +1,13 @@ +[bits 16] +iret +iretw +iretd +[bits 32] +iret +iretw +iretd +[bits 64] +iret +iretw +iretd +iretq diff --git a/modules/arch/x86/tests/iret.errwarn b/modules/arch/x86/tests/iret.errwarn new file mode 100644 index 00000000..e69de29b diff --git a/modules/arch/x86/tests/iret.hex b/modules/arch/x86/tests/iret.hex new file mode 100644 index 00000000..571c637d --- /dev/null +++ b/modules/arch/x86/tests/iret.hex @@ -0,0 +1,14 @@ +cf +cf +66 +cf +cf +66 +cf +cf +cf +66 +cf +cf +48 +cf diff --git a/modules/arch/x86/tests/stos.asm b/modules/arch/x86/tests/stos.asm new file mode 100644 index 00000000..4e9682b0 --- /dev/null +++ b/modules/arch/x86/tests/stos.asm @@ -0,0 +1,13 @@ +[bits 16] +stosb +stosw +stosd +[bits 32] +stosb +stosw +stosd +[bits 64] +stosb +stosw +stosd +stosq diff --git a/modules/arch/x86/tests/stos.errwarn b/modules/arch/x86/tests/stos.errwarn new file mode 100644 index 00000000..e69de29b diff --git a/modules/arch/x86/tests/stos.hex b/modules/arch/x86/tests/stos.hex new file mode 100644 index 00000000..b495827e --- /dev/null +++ b/modules/arch/x86/tests/stos.hex @@ -0,0 +1,14 @@ +aa +ab +66 +ab +aa +66 +ab +ab +aa +66 +ab +ab +48 +ab diff --git a/modules/arch/x86/x86id.re b/modules/arch/x86/x86id.re index 8aea141e..e86cdf7f 100644 --- a/modules/arch/x86/x86id.re +++ b/modules/arch/x86/x86id.re @@ -1919,7 +1919,6 @@ yasm_x86__parse_insn(const unsigned long data[4], int num_operands, d.op[1] = info->opcode[1]; d.op[2] = info->opcode[2]; d.spare = info->spare; - d.rex = (yasm_x86_LTX_mode_bits == 64 && info->opersize == 64) ? 0x48: 0; d.im_len = 0; d.im_sign = 0; d.shift_op = 0; @@ -1957,6 +1956,8 @@ yasm_x86__parse_insn(const unsigned long data[4], int num_operands, /*mod_data >>= 8;*/ } + d.rex = (yasm_x86_LTX_mode_bits == 64 && d.opersize == 64) ? 0x48: 0; + /* Go through operands and assign */ if (operands) { for(i = 0, op = yasm_ops_first(operands); op && inum_operands;