From 19e201053689be68d0e45077fa86e9538d74daa1 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 18 Sep 2007 15:08:20 -0700 Subject: Speed up the disassembler by allowing prefixed instruction tables Modify the disassembler so that we can have separate instruction tables for prefixed instructions. As it was, all instructions which started with 0F were linearly searched, and that is by now more than half the instruction set. --- insns.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'insns.h') diff --git a/insns.h b/insns.h index b5d6caf..b025c7a 100644 --- a/insns.h +++ b/insns.h @@ -26,9 +26,18 @@ struct itemplate { uint32_t flags; /* some flags */ }; +/* Disassembler table structure */ +/* If n == -1, then p points to another table of 256 + struct disasm_index, otherwise p points to a list of n + struct itemplates to consider. */ +struct disasm_index { + const void *p; + int n; +}; + /* Tables for the assembler and disassembler, respectively */ extern const struct itemplate * const nasm_instructions[]; -extern const struct itemplate * const * const itable[]; +extern const struct disasm_index itable[256]; /* * this define is used to signify the end of an itemplate -- cgit v1.2.3