From 0626159904fe1403d42c68444297d78575673772 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 31 Aug 2003 20:24:05 +0000 Subject: [PATCH] Fix usage of 32-bit "high" registers (such as r8d) in memory expressions in 64-bit mode. Reported by: Jean-Daniel Gooyert . svn path=/trunk/yasm/; revision=1045 --- modules/arch/x86/tests/Makefile.inc | 3 +++ modules/arch/x86/tests/mem64hi32.asm | 3 +++ modules/arch/x86/tests/mem64hi32.errwarn | 0 modules/arch/x86/tests/mem64hi32.hex | 9 +++++++++ modules/arch/x86/x86expr.c | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 modules/arch/x86/tests/mem64hi32.asm create mode 100644 modules/arch/x86/tests/mem64hi32.errwarn create mode 100644 modules/arch/x86/tests/mem64hi32.hex diff --git a/modules/arch/x86/tests/Makefile.inc b/modules/arch/x86/tests/Makefile.inc index 82b591ca..b7156618 100644 --- a/modules/arch/x86/tests/Makefile.inc +++ b/modules/arch/x86/tests/Makefile.inc @@ -61,6 +61,9 @@ EXTRA_DIST += modules/arch/x86/tests/mem64-err.errwarn EXTRA_DIST += modules/arch/x86/tests/mem64.asm EXTRA_DIST += modules/arch/x86/tests/mem64.errwarn EXTRA_DIST += modules/arch/x86/tests/mem64.hex +EXTRA_DIST += modules/arch/x86/tests/mem64hi32.asm +EXTRA_DIST += modules/arch/x86/tests/mem64hi32.errwarn +EXTRA_DIST += modules/arch/x86/tests/mem64hi32.hex EXTRA_DIST += modules/arch/x86/tests/mem64rip.asm EXTRA_DIST += modules/arch/x86/tests/mem64rip.errwarn EXTRA_DIST += modules/arch/x86/tests/mem64rip.hex diff --git a/modules/arch/x86/tests/mem64hi32.asm b/modules/arch/x86/tests/mem64hi32.asm new file mode 100644 index 00000000..d2fe07c5 --- /dev/null +++ b/modules/arch/x86/tests/mem64hi32.asm @@ -0,0 +1,3 @@ +[bits 64] +adc byte [eax], 12h +adc byte [r8d], 12h diff --git a/modules/arch/x86/tests/mem64hi32.errwarn b/modules/arch/x86/tests/mem64hi32.errwarn new file mode 100644 index 00000000..e69de29b diff --git a/modules/arch/x86/tests/mem64hi32.hex b/modules/arch/x86/tests/mem64hi32.hex new file mode 100644 index 00000000..1122f245 --- /dev/null +++ b/modules/arch/x86/tests/mem64hi32.hex @@ -0,0 +1,9 @@ +67 +80 +10 +12 +67 +41 +80 +10 +12 diff --git a/modules/arch/x86/x86expr.c b/modules/arch/x86/x86expr.c index e361474c..30a9ec21 100644 --- a/modules/arch/x86/x86expr.c +++ b/modules/arch/x86/x86expr.c @@ -53,7 +53,7 @@ x86_expr_checkea_get_reg3264(yasm_expr__item *ei, int *regnum, case X86_REG32: if (data->addrsize != 32) return 0; - *regnum = ei->data.reg & 0x7; + *regnum = ei->data.reg & 0xF; break; case X86_REG64: if (data->addrsize != 64) -- 2.40.0