From: Peter Johnson Date: Tue, 16 Mar 2004 08:26:19 +0000 (-0000) Subject: Fix push in 64-bit mode to take a 32-bit signed immediate rather than a X-Git-Tag: v0.4.0~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=920c0082364096310c1599736330e82e32dc3f72;p=yasm Fix push in 64-bit mode to take a 32-bit signed immediate rather than a 64-bit immediate. Actually, whether it's signed or unsigned seems to be uncertain; AMD64 documentation shows it as signed, but Intel's new IA-32e says it's unsigned! While we're here, the Imm8 version is signed, not unsigned. Bugzilla bug: 30 Reported by: Michael Ryan svn path=/trunk/yasm/; revision=1105 --- diff --git a/modules/arch/x86/tests/Makefile.inc b/modules/arch/x86/tests/Makefile.inc index 9a78b067..a68358c9 100644 --- a/modules/arch/x86/tests/Makefile.inc +++ b/modules/arch/x86/tests/Makefile.inc @@ -98,6 +98,9 @@ EXTRA_DIST += modules/arch/x86/tests/overflow.hex EXTRA_DIST += modules/arch/x86/tests/pshift.asm EXTRA_DIST += modules/arch/x86/tests/pshift.errwarn EXTRA_DIST += modules/arch/x86/tests/pshift.hex +EXTRA_DIST += modules/arch/x86/tests/push64.asm +EXTRA_DIST += modules/arch/x86/tests/push64.errwarn +EXTRA_DIST += modules/arch/x86/tests/push64.hex EXTRA_DIST += modules/arch/x86/tests/rep.asm EXTRA_DIST += modules/arch/x86/tests/rep.errwarn EXTRA_DIST += modules/arch/x86/tests/rep.hex diff --git a/modules/arch/x86/tests/push64.asm b/modules/arch/x86/tests/push64.asm new file mode 100644 index 00000000..fc863b78 --- /dev/null +++ b/modules/arch/x86/tests/push64.asm @@ -0,0 +1,4 @@ +[bits 64] +push dword 50 +push dword -1 +push dword 1000000000000 diff --git a/modules/arch/x86/tests/push64.errwarn b/modules/arch/x86/tests/push64.errwarn new file mode 100644 index 00000000..6a622a99 --- /dev/null +++ b/modules/arch/x86/tests/push64.errwarn @@ -0,0 +1 @@ +-:4: warning: value does not fit in 32 bit field diff --git a/modules/arch/x86/tests/push64.hex b/modules/arch/x86/tests/push64.hex new file mode 100644 index 00000000..c9627ada --- /dev/null +++ b/modules/arch/x86/tests/push64.hex @@ -0,0 +1,15 @@ +68 +32 +00 +00 +00 +68 +ff +ff +ff +ff +68 +00 +10 +a5 +d4 diff --git a/modules/arch/x86/x86id.re b/modules/arch/x86/x86id.re index ecad2ab6..97fe80a4 100644 --- a/modules/arch/x86/x86id.re +++ b/modules/arch/x86/x86id.re @@ -441,13 +441,13 @@ static const x86_insn_info push_insn[] = { { CPU_Hammer|CPU_64, 0, 0, 64, 0, 1, {0xFF, 0, 0}, 6, 1, {OPT_RM|OPS_64|OPA_EA, 0, 0} }, { CPU_Any, 0, 0, 64, 0, 1, {0x6A, 0, 0}, 0, 1, - {OPT_Imm|OPS_8|OPA_Imm, 0, 0} }, + {OPT_Imm|OPS_8|OPA_SImm, 0, 0} }, { CPU_Any, 0, 16, 64, 0, 1, {0x68, 0, 0}, 0, 1, {OPT_Imm|OPS_16|OPA_Imm, 0, 0} }, { CPU_386|CPU_Not64, 0, 32, 0, 0, 1, {0x68, 0, 0}, 0, 1, {OPT_Imm|OPS_32|OPA_Imm, 0, 0} }, { CPU_Hammer|CPU_64, 0, 64, 64, 0, 1, {0x68, 0, 0}, 0, 1, - {OPT_Imm|OPS_64|OPA_Imm, 0, 0} }, + {OPT_Imm|OPS_32|OPA_SImm, 0, 0} }, { CPU_Not64, 0, 0, 0, 0, 1, {0x0E, 0, 0}, 0, 1, {OPT_CS|OPS_Any|OPA_None, 0, 0} }, { CPU_Not64, 0, 16, 0, 0, 1, {0x0E, 0, 0}, 0, 1,