summaryrefslogtreecommitdiff
path: root/disasm.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-22 21:49:51 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-22 21:49:51 -0700
commitc5b9ce0a843f8541138e1e72c9ca473faee610ee (patch)
treee465b7309f5dc07f5dd11feec177e3851bec835b /disasm.c
parentf04031bbd7811dc5621867d4a416962420ba9e08 (diff)
downloadnasm-c5b9ce0a843f8541138e1e72c9ca473faee610ee.tar.gz
nasm-c5b9ce0a843f8541138e1e72c9ca473faee610ee.tar.bz2
nasm-c5b9ce0a843f8541138e1e72c9ca473faee610ee.zip
Auto-generate 0x67 prefixes without the need for \30x codes
Auto-generate 0x67 prefixes without the need for \30x codes; the prefix is automatically added when there is a memory operand with address size differing from the current address size (and impossible combinations checked for.)
Diffstat (limited to 'disasm.c')
-rw-r--r--disasm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/disasm.c b/disasm.c
index a6c1c72..724d0bf 100644
--- a/disasm.c
+++ b/disasm.c
@@ -561,8 +561,6 @@ static int matches(const struct itemplate *t, uint8_t *data,
&ins->oprs[(c >> 3) & 07], ins);
if (!data)
return FALSE;
- } else if (c >= 0300 && c <= 0303) {
- a_used = TRUE;
} else if (c == 0310) {
if (asize != 16)
return FALSE;
@@ -652,6 +650,11 @@ static int matches(const struct itemplate *t, uint8_t *data,
/*
* Check for unused rep or a/o prefixes.
*/
+ for (i = 0; i < t->operands; i++) {
+ if (ins->oprs[i].segment != SEG_RMREG)
+ a_used = TRUE;
+ }
+
ins->nprefix = 0;
if (lock)
ins->prefixes[ins->nprefix++] = P_LOCK;