Remove tests that are bogus (they trigger for legitimate instructions.)
The failure cases are okay anyway since they will be trapped by the
REX generation logic.
Remove a bogus check for 64-bit operands. If appropriate, we will
detect this during REX generation and will bail then. However, there
are other instructions (floating point, MMX, ...) which are legitimately
64 bits in non-64-bit mode.
Get rid of magic open-coded register numbers. We now keep track of
a total of three different kinds of register numbers: the register
enumeration (regs.h), the x86 register value, and the register flags.
That has all the information we need.
Additionally, do massive revamping of the EA generation code and the
REX generation logic.
- MOV gpr,CRx or MOV CRx,gpr can access high control registers with a LOCK
prefix; handle that in both the assembler and disassembler.
- Get a saner error message when trying to access high resources in
non-64-bit mode.
The assembler doesn't seem to care, but for the disassembler, it's
vitally important that we get our operand-size hints correctly. We
probably need to audit insns.dat for this kinds of errors.
64-bit support for ndisasm. This is very much an initial attempt, and
there are guaranteed to be bugs in the code. However, some *very*
preliminary testing seems to indicate it's not completely off-base.
64-bit support required some major changes to regs.dat; clean some of
it up (re-introduce patterns, where appropriate) and allow a single
register to belong to multiple disassembly classes; also keep track
of the x86 register number again.
CR8 is not special in any way as far as the assembler is concerned. It's
listed as having a special form in the Intel documentation, but that is
only because there are no other CRs which require a REX prefix.
MOV to CR8 is special in the sense that it's a non-serializing
instruction, but that's irrelevant to the assembler.
Furthermore, it's totally unclear how TRs should be handled in long mode;
there are no CPUs which uses TRs which also have long mode, so the easiest
is to simply mark those instructions NOLONG.
Finally, add PRIV to some privileged instructions.
We can actually test for the options being accepted, rather than try
to test for gcc; this handles differences between gcc versions as well
as compilers with a similar command line set.