From: H. Peter Anvin <hpa@zy...> - 2007-04-21 01:22:58
Okay, I have been staring at the new NASM code for way too long, and I
have to say I am a bit unhappy about changing "regvals" into something
that pretty much duplicates the regflags concept, but open-codes all the
predicates. This seems ugly.
Anyway, I went looking through the code to see if regflags can be
adjusted to service all the needs (e.g. being able to tell extended
8-bit registers from legacy 8-bit registers), and found that some of the
bitmasks are distinctly suspect.
#define REGNORM 0x00201000L /* 'normal' reg, qualifies as EA */
#define REG8 0x00201001L
#define XMMREG 0x00201011L /* XMM Katmai reg */
This means that a register with type XMMREG will pass the bitmask test
for an 8-bit normal register!
I think some cleanup here is definitely in order. I would like to do
- Fix said bitmasks;
- Discontinue the "new" meaning of regvals and go back to them being
true x86 values; this is also what the disassembler needs;
- Use regflags masks to generate REX prefixes;
- Move the generation of REX prefixes, which is currently duplicated
code in a number of places, into functions (I've already experimented
As always, opinions and/or assistance welcome...