diff options
author | H. Peter Anvin <hpa@zytor.com> | 2017-05-01 20:28:29 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2017-05-01 21:13:15 -0700 |
commit | 3e458a89d8c985527313305b55d5725cf382e862 (patch) | |
tree | 3b1ec93afc10e5e389ce1c74cb32f28a743ac52a /common | |
parent | 5810c594c9eeed4d809b29c9e073af76dfcd3249 (diff) | |
download | nasm-3e458a89d8c985527313305b55d5725cf382e862.tar.gz |
a) Fix handling of DZ/ZWORD; b) don't crash on TIMES JMP
a) Fix a number of missing instances of DZ and ZWORD.
b) NASM would crash if TIMES was used on an instruction which varies
in size, e.g. JMP. Fix this by moving the handling of TIMES at a
higher level, so we generate the instruction "de novo" for each
iteration. The exception is INCBIN, so we can avoid reading the
included file over and over.
c) When using the RESx instructions, just fold TIMES into the reserved
space size; there is absolutely no point to iterate over it.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/common.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/common/common.c b/common/common.c index 9c91f910..5a546207 100644 --- a/common/common.c +++ b/common/common.c @@ -91,3 +91,32 @@ int idata_bytes(int opcode) return 0; } } + +/* + * Uninitialized data bytes length from opcode + */ +int resv_bytes(int opcode) +{ + switch (opcode) { + case I_RESB: + return 1; + case I_RESW: + return 2; + case I_RESD: + return 4; + case I_RESQ: + return 8; + case I_REST: + return 10; + case I_RESO: + return 16; + case I_RESY: + return 32; + case I_RESZ: + return 64; + case I_none: + return -1; + default: + return 0; + } +} |