diff options
author | Victor van den Elzen <victor.vde@gmail.com> | 2010-11-07 19:56:14 +0100 |
---|---|---|
committer | Victor van den Elzen <victor.vde@gmail.com> | 2010-11-07 23:27:48 +0100 |
commit | b3cee5a57ab2cd0a99ad01ac9db73e31ae90d519 (patch) | |
tree | ac9dfc68d616388aa3254e5e4d4f447149c7af71 /assemble.c | |
parent | 0bae3e5ffa72c141cffd61292ed0642e33d0495b (diff) | |
download | nasm-b3cee5a57ab2cd0a99ad01ac9db73e31ae90d519.tar.gz nasm-b3cee5a57ab2cd0a99ad01ac9db73e31ae90d519.tar.bz2 nasm-b3cee5a57ab2cd0a99ad01ac9db73e31ae90d519.zip |
BR3058845: mostly fix bogus warning with implicit operand size override
The implicit operand size override code didn't set the operand size
prefix, which confused the size calculation code for the range check.
The BITS 64 operand size calculation is still off, but "fixing" it by
making it 32-bit unless REX.W is set breaks PUSH and maybe others.
Diffstat (limited to 'assemble.c')
-rw-r--r-- | assemble.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -1636,22 +1636,32 @@ static void gencode(int32_t segment, int64_t offset, int bits, break; case 0320: - if (bits != 16) { + { + enum prefixes pfx = ins->prefixes[PPS_OSIZE]; + if (pfx != P_O16 && pfx != P_none) + nasm_error(ERR_WARNING, "Invalid operand size prefix"); + if (pfx != P_O16 && bits != 16) { + ins->prefixes[PPS_OSIZE] = P_O16; *bytes = 0x66; out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG); offset += 1; - } else - offset += 0; + } break; + } case 0321: - if (bits == 16) { + { + enum prefixes pfx = ins->prefixes[PPS_OSIZE]; + if (pfx != P_O32 && pfx != P_none) + nasm_error(ERR_WARNING, "Invalid operand size prefix"); + if (pfx != P_O32 && bits == 16) { + ins->prefixes[PPS_OSIZE] = P_O32; *bytes = 0x66; out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG); offset += 1; - } else - offset += 0; + } break; + } case 0322: case 0323: |