summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2009-11-03 14:59:43 +0000
committerStefan Reinauer <stepan@openbios.org>2009-11-03 14:59:43 +0000
commit7110d40fbf27b1fafe70e3cd560f53ca7be094a5 (patch)
tree685956a463cfa1033a4dfca7b326c4e5b371f55c /util
parent8429de75a6cd6c6fbc13e0b85cbe9fba49dad211 (diff)
downloadcoreboot-7110d40fbf27b1fafe70e3cd560f53ca7be094a5.tar.xz
x86emu: Add support for the following opcodes:
* SMSW * INVD/WBINVD * RDMSR/WRMSR * CPUID The implementation is kept very simple (mostly dummies) but it should get us successfully through the Poulsbo VGA OPROM code in order to determine further requirements. Also, fix up a lot of warnings (mostly about missing prototypes for functions that should be static anyways) This version adds a break in smsw that was missing in the patch that was sent to the list. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4906 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util')
-rw-r--r--util/x86emu/include/x86emu/x86emu.h3
-rw-r--r--util/x86emu/x86emu/decode.c4
-rw-r--r--util/x86emu/x86emu/ops.c282
-rw-r--r--util/x86emu/x86emu/ops.h2
-rw-r--r--util/x86emu/x86emu/ops2.c209
-rw-r--r--util/x86emu/x86emu/prim_ops.c46
-rw-r--r--util/x86emu/x86emu/prim_ops.h3
-rw-r--r--util/x86emu/x86emu/sys.c2
8 files changed, 362 insertions, 189 deletions
diff --git a/util/x86emu/include/x86emu/x86emu.h b/util/x86emu/include/x86emu/x86emu.h
index 823f49772b..04381627c7 100644
--- a/util/x86emu/include/x86emu/x86emu.h
+++ b/util/x86emu/include/x86emu/x86emu.h
@@ -44,6 +44,7 @@
/* FIXME: redefine printk for the moment */
#ifdef CONFIG_COREBOOT_V2
+#include <stddef.h>
#include <console/console.h>
#undef printk
#define printk(x...) do_printk(BIOS_DEBUG, x)
@@ -160,7 +161,7 @@ void X86EMU_setupPioFuncs(X86EMU_pioFuncs *funcs);
void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]);
void X86EMU_prepareForInt(int num);
-//void X86EMU_setMemBase(void *base, size_t size);
+void X86EMU_setMemBase(void *base, size_t size);
/* decode.c */
diff --git a/util/x86emu/x86emu/decode.c b/util/x86emu/x86emu/decode.c
index 8e42e5d683..0d878b9c5f 100644
--- a/util/x86emu/x86emu/decode.c
+++ b/util/x86emu/x86emu/decode.c
@@ -735,7 +735,7 @@ REMARKS:
Decodes scale/index of SIB byte and returns relevant offset part of
effective address.
****************************************************************************/
-unsigned decode_sib_si(
+static unsigned decode_sib_si(
int scale,
int index)
{
@@ -785,7 +785,7 @@ Offset in memory for the address decoding
REMARKS:
Decodes SIB addressing byte and returns calculated effective address.
****************************************************************************/
-unsigned decode_sib_address(
+static unsigned decode_sib_address(
int mod)
{
int sib = fetch_byte_imm();
diff --git a/util/x86emu/x86emu/ops.c b/util/x86emu/x86emu/ops.c
index a22faf9fd3..71a155f349 100644
--- a/util/x86emu/x86emu/ops.c
+++ b/util/x86emu/x86emu/ops.c
@@ -171,7 +171,7 @@ op1 - Instruction op code
REMARKS:
Handles illegal opcodes.
****************************************************************************/
-void x86emuOp_illegal_op(
+static void x86emuOp_illegal_op(
u8 op1)
{
START_OF_INSTR();
@@ -198,7 +198,7 @@ void x86emuOp_illegal_op(
REMARKS:
Handles opcodes 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38
****************************************************************************/
-void x86emuOp_genop_byte_RM_R(u8 op1)
+static void x86emuOp_genop_byte_RM_R(u8 op1)
{
int mod, rl, rh;
uint destoffset;
@@ -239,7 +239,7 @@ void x86emuOp_genop_byte_RM_R(u8 op1)
REMARKS:
Handles opcodes 0x01, 0x09, 0x11, 0x19, 0x21, 0x29, 0x31, 0x39
****************************************************************************/
-void x86emuOp_genop_word_RM_R(u8 op1)
+static void x86emuOp_genop_word_RM_R(u8 op1)
{
int mod, rl, rh;
uint destoffset;
@@ -307,7 +307,7 @@ void x86emuOp_genop_word_RM_R(u8 op1)
REMARKS:
Handles opcodes 0x02, 0x0a, 0x12, 0x1a, 0x22, 0x2a, 0x32, 0x3a
****************************************************************************/
-void x86emuOp_genop_byte_R_RM(u8 op1)
+static void x86emuOp_genop_byte_R_RM(u8 op1)
{
int mod, rl, rh;
u8 *destreg, *srcreg;
@@ -343,7 +343,7 @@ void x86emuOp_genop_byte_R_RM(u8 op1)
REMARKS:
Handles opcodes 0x03, 0x0b, 0x13, 0x1b, 0x23, 0x2b, 0x33, 0x3b
****************************************************************************/
-void x86emuOp_genop_word_R_RM(u8 op1)
+static void x86emuOp_genop_word_R_RM(u8 op1)
{
int mod, rl, rh;
uint srcoffset;
@@ -400,7 +400,7 @@ void x86emuOp_genop_word_R_RM(u8 op1)
REMARKS:
Handles opcodes 0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c
****************************************************************************/
-void x86emuOp_genop_byte_AL_IMM(u8 op1)
+static void x86emuOp_genop_byte_AL_IMM(u8 op1)
{
u8 srcval;
@@ -421,7 +421,7 @@ void x86emuOp_genop_byte_AL_IMM(u8 op1)
REMARKS:
Handles opcodes 0x05, 0x0d, 0x15, 0x1d, 0x25, 0x2d, 0x35, 0x3d
****************************************************************************/
-void x86emuOp_genop_word_AX_IMM(u8 op1)
+static void x86emuOp_genop_word_AX_IMM(u8 op1)
{
u32 srcval;
@@ -452,7 +452,7 @@ void x86emuOp_genop_word_AX_IMM(u8 op1)
REMARKS:
Handles opcode 0x06
****************************************************************************/
-void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("PUSH\tES\n");
@@ -466,7 +466,7 @@ void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x07
****************************************************************************/
-void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("POP\tES\n");
@@ -480,7 +480,7 @@ void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x0e
****************************************************************************/
-void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("PUSH\tCS\n");
@@ -494,7 +494,7 @@ void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x0f. Escape for two-byte opcode (286 or better)
****************************************************************************/
-void x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
{
u8 op2 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
INC_DECODED_INST_LEN(1);
@@ -505,7 +505,7 @@ void x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x16
****************************************************************************/
-void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("PUSH\tSS\n");
@@ -519,7 +519,7 @@ void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x17
****************************************************************************/
-void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("POP\tSS\n");
@@ -533,7 +533,7 @@ void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x1e
****************************************************************************/
-void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("PUSH\tDS\n");
@@ -547,7 +547,7 @@ void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x1f
****************************************************************************/
-void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("POP\tDS\n");
@@ -561,7 +561,7 @@ void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x26
****************************************************************************/
-void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("ES:\n");
@@ -578,7 +578,7 @@ void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x27
****************************************************************************/
-void x86emuOp_daa(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_daa(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("DAA\n");
@@ -592,7 +592,7 @@ void x86emuOp_daa(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x2e
****************************************************************************/
-void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("CS:\n");
@@ -606,7 +606,7 @@ void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x2f
****************************************************************************/
-void x86emuOp_das(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_das(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("DAS\n");
@@ -620,7 +620,7 @@ void x86emuOp_das(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x36
****************************************************************************/
-void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("SS:\n");
@@ -634,7 +634,7 @@ void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x37
****************************************************************************/
-void x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("AAA\n");
@@ -648,7 +648,7 @@ void x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x3e
****************************************************************************/
-void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("DS:\n");
@@ -662,7 +662,7 @@ void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x3f
****************************************************************************/
-void x86emuOp_aas(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_aas(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("AAS\n");
@@ -676,7 +676,7 @@ void x86emuOp_aas(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x40 - 0x47
****************************************************************************/
-void x86emuOp_inc_register(u8 op1)
+static void x86emuOp_inc_register(u8 op1)
{
START_OF_INSTR();
op1 &= 0x7;
@@ -702,7 +702,7 @@ void x86emuOp_inc_register(u8 op1)
REMARKS:
Handles opcode 0x48 - 0x4F
****************************************************************************/
-void x86emuOp_dec_register(u8 op1)
+static void x86emuOp_dec_register(u8 op1)
{
START_OF_INSTR();
op1 &= 0x7;
@@ -728,7 +728,7 @@ void x86emuOp_dec_register(u8 op1)
REMARKS:
Handles opcode 0x50 - 0x57
****************************************************************************/
-void x86emuOp_push_register(u8 op1)
+static void x86emuOp_push_register(u8 op1)
{
START_OF_INSTR();
op1 &= 0x7;
@@ -754,7 +754,7 @@ void x86emuOp_push_register(u8 op1)
REMARKS:
Handles opcode 0x58 - 0x5F
****************************************************************************/
-void x86emuOp_pop_register(u8 op1)
+static void x86emuOp_pop_register(u8 op1)
{
START_OF_INSTR();
op1 &= 0x7;
@@ -780,7 +780,7 @@ void x86emuOp_pop_register(u8 op1)
REMARKS:
Handles opcode 0x60
****************************************************************************/
-void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
@@ -820,7 +820,7 @@ void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x61
****************************************************************************/
-void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
@@ -859,7 +859,7 @@ void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x64
****************************************************************************/
-void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("FS:\n");
@@ -876,7 +876,7 @@ void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x65
****************************************************************************/
-void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("GS:\n");
@@ -893,7 +893,7 @@ void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x66 - prefix for 32-bit register
****************************************************************************/
-void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("DATA:\n");
@@ -907,7 +907,7 @@ void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x67 - prefix for 32-bit address
****************************************************************************/
-void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("ADDR:\n");
@@ -921,7 +921,7 @@ void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x68
****************************************************************************/
-void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
{
u32 imm;
@@ -946,7 +946,7 @@ void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x69
****************************************************************************/
-void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint srcoffset;
@@ -1053,7 +1053,7 @@ void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x6a
****************************************************************************/
-void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
{
s16 imm;
@@ -1074,7 +1074,7 @@ void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x6b
****************************************************************************/
-void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint srcoffset;
@@ -1179,7 +1179,7 @@ void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x6c
****************************************************************************/
-void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("INSB\n");
@@ -1193,7 +1193,7 @@ void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x6d
****************************************************************************/
-void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
@@ -1212,7 +1212,7 @@ void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x6e
****************************************************************************/
-void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("OUTSB\n");
@@ -1226,7 +1226,7 @@ void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x6f
****************************************************************************/
-void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
@@ -1245,9 +1245,7 @@ void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x70 - 0x7F
****************************************************************************/
-int x86emu_check_jump_condition(u8 op);
-
-void x86emuOp_jump_near_cond(u8 op1)
+static void x86emuOp_jump_near_cond(u8 op1)
{
s8 offset;
u16 target;
@@ -1272,7 +1270,7 @@ void x86emuOp_jump_near_cond(u8 op1)
REMARKS:
Handles opcode 0x80
****************************************************************************/
-void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg;
@@ -1351,7 +1349,7 @@ void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x81
****************************************************************************/
-void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -1457,7 +1455,7 @@ void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x82
****************************************************************************/
-void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg;
@@ -1534,7 +1532,7 @@ void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x83
****************************************************************************/
-void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -1635,7 +1633,7 @@ void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x84
****************************************************************************/
-void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg, *srcreg;
@@ -1669,7 +1667,7 @@ void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x85
****************************************************************************/
-void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -1729,7 +1727,7 @@ void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x86
****************************************************************************/
-void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg, *srcreg;
@@ -1769,7 +1767,7 @@ void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x87
****************************************************************************/
-void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -1840,7 +1838,7 @@ void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x88
****************************************************************************/
-void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg, *srcreg;
@@ -1872,7 +1870,7 @@ void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x89
****************************************************************************/
-void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -1928,7 +1926,7 @@ void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x8a
****************************************************************************/
-void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg, *srcreg;
@@ -1962,7 +1960,7 @@ void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x8b
****************************************************************************/
-void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint srcoffset;
@@ -2023,7 +2021,7 @@ void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x8c
****************************************************************************/
-void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u16 *destreg, *srcreg;
@@ -2057,7 +2055,7 @@ void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x8d
****************************************************************************/
-void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u16 *srcreg;
@@ -2089,7 +2087,7 @@ void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x8e
****************************************************************************/
-void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u16 *destreg, *srcreg;
@@ -2129,7 +2127,7 @@ void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x8f
****************************************************************************/
-void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -2183,7 +2181,7 @@ void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x90
****************************************************************************/
-void x86emuOp_nop(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_nop(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("NOP\n");
@@ -2196,7 +2194,7 @@ void x86emuOp_nop(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x91-0x97
****************************************************************************/
-void x86emuOp_xchg_word_AX_register(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_xchg_word_AX_register(u8 X86EMU_UNUSED(op1))
{
u32 tmp;
@@ -2231,7 +2229,7 @@ void x86emuOp_xchg_word_AX_register(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x98
****************************************************************************/
-void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
@@ -2261,7 +2259,7 @@ void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x99
****************************************************************************/
-void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
@@ -2292,7 +2290,7 @@ void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x9a
****************************************************************************/
-void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
{
u16 farseg, faroff;
@@ -2323,7 +2321,7 @@ void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x9b
****************************************************************************/
-void x86emuOp_wait(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_wait(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("WAIT");
@@ -2337,7 +2335,7 @@ void x86emuOp_wait(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x9c
****************************************************************************/
-void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
{
u32 flags;
@@ -2364,7 +2362,7 @@ void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x9d
****************************************************************************/
-void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
@@ -2386,7 +2384,7 @@ void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x9e
****************************************************************************/
-void x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("SAHF\n");
@@ -2403,7 +2401,7 @@ void x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0x9f
****************************************************************************/
-void x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("LAHF\n");
@@ -2420,7 +2418,7 @@ void x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa0
****************************************************************************/
-void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
{
u16 offset;
@@ -2438,7 +2436,7 @@ void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa1
****************************************************************************/
-void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
{
u16 offset;
@@ -2463,7 +2461,7 @@ void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa2
****************************************************************************/
-void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
{
u16 offset;
@@ -2481,7 +2479,7 @@ void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa3
****************************************************************************/
-void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
{
u16 offset;
@@ -2506,7 +2504,7 @@ void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa4
****************************************************************************/
-void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
{
u8 val;
u32 count;
@@ -2545,7 +2543,7 @@ void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa5
****************************************************************************/
-void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
{
u32 val;
int inc;
@@ -2597,7 +2595,7 @@ void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa6
****************************************************************************/
-void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
{
s8 val1, val2;
int inc;
@@ -2644,7 +2642,7 @@ void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa7
****************************************************************************/
-void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
{
u32 val1,val2;
int inc;
@@ -2707,7 +2705,7 @@ void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa8
****************************************************************************/
-void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
{
int imm;
@@ -2725,7 +2723,7 @@ void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xa9
****************************************************************************/
-void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
{
u32 srcval;
@@ -2752,7 +2750,7 @@ void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xaa
****************************************************************************/
-void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
{
int inc;
@@ -2789,7 +2787,7 @@ void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xab
****************************************************************************/
-void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
{
int inc;
u32 count;
@@ -2837,7 +2835,7 @@ void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xac
****************************************************************************/
-void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
{
int inc;
@@ -2874,7 +2872,7 @@ void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xad
****************************************************************************/
-void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
{
int inc;
u32 count;
@@ -2922,7 +2920,7 @@ void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xae
****************************************************************************/
-void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
{
s8 val2;
int inc;
@@ -2981,7 +2979,7 @@ void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xaf
****************************************************************************/
-void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
{
int inc;
u32 val;
@@ -3063,7 +3061,7 @@ void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xb0 - 0xb7
****************************************************************************/
-void x86emuOp_mov_byte_register_IMM(u8 op1)
+static void x86emuOp_mov_byte_register_IMM(u8 op1)
{
u8 imm, *ptr;
@@ -3083,7 +3081,7 @@ void x86emuOp_mov_byte_register_IMM(u8 op1)
REMARKS:
Handles opcode 0xb8 - 0xbf
****************************************************************************/
-void x86emuOp_mov_word_register_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_word_register_IMM(u8 X86EMU_UNUSED(op1))
{
u32 srcval;
@@ -3114,7 +3112,7 @@ void x86emuOp_mov_word_register_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc0
****************************************************************************/
-void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg;
@@ -3191,7 +3189,7 @@ void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc1
****************************************************************************/
-void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -3292,7 +3290,7 @@ void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc2
****************************************************************************/
-void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
{
u16 imm;
@@ -3312,7 +3310,7 @@ void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc3
****************************************************************************/
-void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("RET\n");
@@ -3327,7 +3325,7 @@ void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc4
****************************************************************************/
-void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rh, rl;
u16 *dstreg;
@@ -3355,7 +3353,7 @@ void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc5
****************************************************************************/
-void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rh, rl;
u16 *dstreg;
@@ -3382,7 +3380,7 @@ void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc6
****************************************************************************/
-void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg;
@@ -3418,7 +3416,7 @@ void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc7
****************************************************************************/
-void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -3479,7 +3477,7 @@ void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc8
****************************************************************************/
-void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
{
u16 local,frame_pointer;
u8 nesting;
@@ -3510,7 +3508,7 @@ void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xc9
****************************************************************************/
-void x86emuOp_leave(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_leave(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("LEAVE\n");
@@ -3525,7 +3523,7 @@ void x86emuOp_leave(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xca
****************************************************************************/
-void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
{
u16 imm;
@@ -3546,7 +3544,7 @@ void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xcb
****************************************************************************/
-void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("RETF\n");
@@ -3562,7 +3560,7 @@ void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xcc
****************************************************************************/
-void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
{
u16 tmp;
@@ -3590,7 +3588,7 @@ void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xcd
****************************************************************************/
-void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
{
u16 tmp;
u8 intnum;
@@ -3620,7 +3618,7 @@ void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xce
****************************************************************************/
-void x86emuOp_into(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_into(u8 X86EMU_UNUSED(op1))
{
u16 tmp;
@@ -3649,7 +3647,7 @@ void x86emuOp_into(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xcf
****************************************************************************/
-void x86emuOp_iret(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_iret(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("IRET\n");
@@ -3667,7 +3665,7 @@ void x86emuOp_iret(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xd0
****************************************************************************/
-void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg;
@@ -3740,7 +3738,7 @@ void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xd1
****************************************************************************/
-void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -3839,7 +3837,7 @@ void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xd2
****************************************************************************/
-void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg;
@@ -3914,7 +3912,7 @@ void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xd3
****************************************************************************/
-void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -4011,7 +4009,7 @@ void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xd4
****************************************************************************/
-void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
{
u8 a;
@@ -4034,7 +4032,7 @@ void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xd5
****************************************************************************/
-void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
{
u8 a;
@@ -4053,7 +4051,7 @@ void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xd7
****************************************************************************/
-void x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
{
u16 addr;
@@ -4072,7 +4070,7 @@ void x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe0
****************************************************************************/
-void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
{
s16 ip;
@@ -4096,7 +4094,7 @@ void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe1
****************************************************************************/
-void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
{
s16 ip;
@@ -4120,7 +4118,7 @@ void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe2
****************************************************************************/
-void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
{
s16 ip;
@@ -4144,7 +4142,7 @@ void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe3
****************************************************************************/
-void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
{
u16 target;
s8 offset;
@@ -4168,7 +4166,7 @@ void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe4
****************************************************************************/
-void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
{
u8 port;
@@ -4186,7 +4184,7 @@ void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe5
****************************************************************************/
-void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
{
u8 port;
@@ -4212,7 +4210,7 @@ void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe6
****************************************************************************/
-void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
{
u8 port;
@@ -4230,7 +4228,7 @@ void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe7
****************************************************************************/
-void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
{
u8 port;
@@ -4256,7 +4254,7 @@ void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe8
****************************************************************************/
-void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
{
s16 ip;
@@ -4277,7 +4275,7 @@ void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xe9
****************************************************************************/
-void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
{
int ip;
@@ -4297,7 +4295,7 @@ void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xea
****************************************************************************/
-void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
{
u16 cs, ip;
@@ -4319,7 +4317,7 @@ void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xeb
****************************************************************************/
-void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
{
u16 target;
s8 offset;
@@ -4340,7 +4338,7 @@ void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xec
****************************************************************************/
-void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("IN\tAL,DX\n");
@@ -4354,7 +4352,7 @@ void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xed
****************************************************************************/
-void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
@@ -4376,7 +4374,7 @@ void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xee
****************************************************************************/
-void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("OUT\tDX,AL\n");
@@ -4390,7 +4388,7 @@ void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xef
****************************************************************************/
-void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
@@ -4412,7 +4410,7 @@ void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xf0
****************************************************************************/
-void x86emuOp_lock(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_lock(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("LOCK:\n");
@@ -4427,7 +4425,7 @@ void x86emuOp_lock(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xf2
****************************************************************************/
-void x86emuOp_repne(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_repne(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("REPNE\n");
@@ -4443,7 +4441,7 @@ void x86emuOp_repne(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xf3
****************************************************************************/
-void x86emuOp_repe(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_repe(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("REPE\n");
@@ -4459,7 +4457,7 @@ void x86emuOp_repe(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xf4
****************************************************************************/
-void x86emuOp_halt(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_halt(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("HALT\n");
@@ -4473,7 +4471,7 @@ void x86emuOp_halt(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xf5
****************************************************************************/
-void x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
{
/* complement the carry flag. */
START_OF_INSTR();
@@ -4488,7 +4486,7 @@ void x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xf6
****************************************************************************/
-void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
u8 *destreg;
@@ -4604,7 +4602,7 @@ void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xf7
****************************************************************************/
-void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset;
@@ -4830,7 +4828,7 @@ void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xf8
****************************************************************************/
-void x86emuOp_clc(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_clc(u8 X86EMU_UNUSED(op1))
{
/* clear the carry flag. */
START_OF_INSTR();
@@ -4845,7 +4843,7 @@ void x86emuOp_clc(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xf9
****************************************************************************/
-void x86emuOp_stc(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_stc(u8 X86EMU_UNUSED(op1))
{
/* set the carry flag. */
START_OF_INSTR();
@@ -4860,7 +4858,7 @@ void x86emuOp_stc(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xfa
****************************************************************************/
-void x86emuOp_cli(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_cli(u8 X86EMU_UNUSED(op1))
{
/* clear interrupts. */
START_OF_INSTR();
@@ -4875,7 +4873,7 @@ void x86emuOp_cli(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xfb
****************************************************************************/
-void x86emuOp_sti(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_sti(u8 X86EMU_UNUSED(op1))
{
/* enable interrupts. */
START_OF_INSTR();
@@ -4890,7 +4888,7 @@ void x86emuOp_sti(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xfc
****************************************************************************/
-void x86emuOp_cld(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_cld(u8 X86EMU_UNUSED(op1))
{
/* clear interrupts. */
START_OF_INSTR();
@@ -4905,7 +4903,7 @@ void x86emuOp_cld(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xfd
****************************************************************************/
-void x86emuOp_std(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_std(u8 X86EMU_UNUSED(op1))
{
/* clear interrupts. */
START_OF_INSTR();
@@ -4920,7 +4918,7 @@ void x86emuOp_std(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xfe
****************************************************************************/
-void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
{
int mod, rh, rl;
u8 destval;
@@ -4984,7 +4982,7 @@ void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
REMARKS:
Handles opcode 0xff
****************************************************************************/
-void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
{
int mod, rh, rl;
uint destoffset = 0;
diff --git a/util/x86emu/x86emu/ops.h b/util/x86emu/x86emu/ops.h
index 65ea676543..825b9eadd1 100644
--- a/util/x86emu/x86emu/ops.h
+++ b/util/x86emu/x86emu/ops.h
@@ -42,4 +42,6 @@
extern void (*x86emu_optab[0x100])(u8 op1);
extern void (*x86emu_optab2[0x100])(u8 op2);
+int x86emu_check_jump_condition(u8 op);
+
#endif /* __X86EMU_OPS_H */
diff --git a/util/x86emu/x86emu/ops2.c b/util/x86emu/x86emu/ops2.c
index 53a777697e..a749b59525 100644
--- a/util/x86emu/x86emu/ops2.c
+++ b/util/x86emu/x86emu/ops2.c
@@ -49,18 +49,129 @@ op1 - Instruction op code
REMARKS:
Handles illegal opcodes.
****************************************************************************/
-void x86emuOp2_illegal_op(
- u8 op2)
+static void x86emuOp2_illegal_op(u8 op2)
{
START_OF_INSTR();
DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
TRACE_REGS();
printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
- M.x86.R_CS, M.x86.R_IP-2,op2);
+ M.x86.R_CS, M.x86.R_IP-2, op2);
HALT_SYS();
END_OF_INSTR();
}
+/****************************************************************************
+ * REMARKS:
+ * Handles opcode 0x0f,0x01
+ * ****************************************************************************/
+
+static void x86emuOp2_opc_01(u8 op2)
+{
+ int mod, rl, rh;
+ u16 *destreg;
+ uint destoffset;
+
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+
+ switch(rh) {
+ case 4: // SMSW (Store Machine Status Word)
+ // Decode the mod byte to find the addressing
+ // Dummy implementation: Always returns 0x10 (initial value as per intel manual volume 3, figure 8-1)
+#define SMSW_INITIAL_VALUE 0x10
+ DECODE_PRINTF("SMSW\t");
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ store_data_word(destoffset, SMSW_INITIAL_VALUE);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ store_data_word(destoffset, SMSW_INITIAL_VALUE);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ store_data_word(destoffset, SMSW_INITIAL_VALUE);
+ break;
+ case 3:
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ *destreg = SMSW_INITIAL_VALUE;
+ break;
+ }
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ DECODE_PRINTF("\n");
+ break;
+ default:
+ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE IN 0F 01\n");
+ TRACE_REGS();
+ printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
+ M.x86.R_CS, M.x86.R_IP-2, op2);
+ HALT_SYS();
+ break;
+ }
+
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+ * REMARKS:
+ * Handles opcode 0x0f,0x08
+ * ****************************************************************************/
+static void x86emuOp2_invd(u8 op2)
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("INVD\n");
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+ * REMARKS:
+ * Handles opcode 0x0f,0x09
+ * ****************************************************************************/
+static void x86emuOp2_wbinvd(u8 op2)
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("WBINVD\n");
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+ * REMARKS:
+ * Handles opcode 0x0f,0x30
+ * ****************************************************************************/
+static void x86emuOp2_wrmsr(u8 op2)
+{
+ /* dummy implementation, does nothing */
+
+ START_OF_INSTR();
+ DECODE_PRINTF("WRMSR\n");
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+ * REMARKS:
+ * Handles opcode 0x0f,0x32
+ * ****************************************************************************/
+static void x86emuOp2_rdmsr(u8 op2)
+{
+ /* dummy implementation, always return 0 */
+
+ START_OF_INSTR();
+ DECODE_PRINTF("RDMSR\n");
+ TRACE_AND_STEP();
+ M.x86.R_EDX = 0;
+ M.x86.R_EAX = 0;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
#define xorl(a,b) (((a) && !(b)) || (!(a) && (b)))
/****************************************************************************
@@ -137,7 +248,7 @@ int x86emu_check_jump_condition(u8 op)
}
}
-void x86emuOp2_long_jump(u8 op2)
+static void x86emuOp2_long_jump(u8 op2)
{
s32 target;
int cond;
@@ -161,18 +272,18 @@ void x86emuOp2_long_jump(u8 op2)
REMARKS:
Handles opcode 0x0f,0xC8-0xCF
****************************************************************************/
-s32 x86emu_bswap(s32 reg)
+static s32 x86emu_bswap(s32 reg)
{
// perform the byte swap
s32 temp = reg;
- reg = (temp & 0xFF000000) >> 24;
- reg |= (temp & 0xFF0000) >> 8;
- reg |= (temp & 0xFF00) << 8;
- reg |= (temp & 0xFF) << 24;
+ reg = (temp & 0xFF000000) >> 24 |
+ (temp & 0xFF0000) >> 8 |
+ (temp & 0xFF00) << 8 |
+ (temp & 0xFF) << 24;
return reg;
}
-void x86emuOp2_bswap(u8 op2)
+static void x86emuOp2_bswap(u8 op2)
{
/* byte swap 32 bit register */
START_OF_INSTR();
@@ -220,12 +331,12 @@ void x86emuOp2_bswap(u8 op2)
REMARKS:
Handles opcode 0x0f,0x90-0x9F
****************************************************************************/
-void x86emuOp2_set_byte(u8 op2)
+static void x86emuOp2_set_byte(u8 op2)
{
int mod, rl, rh;
uint destoffset;
u8 *destreg;
- char *name = 0;
+ const char *name = 0;
int cond = 0;
START_OF_INSTR();
@@ -316,7 +427,7 @@ void x86emuOp2_set_byte(u8 op2)
REMARKS:
Handles opcode 0x0f,0xa0
****************************************************************************/
-void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("PUSH\tFS\n");
@@ -330,7 +441,7 @@ void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa1
****************************************************************************/
-void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("POP\tFS\n");
@@ -341,10 +452,24 @@ void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
}
/****************************************************************************
+REMARKS: CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
+Handles opcode 0x0f,0xa2
+****************************************************************************/
+static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("CPUID\n");
+ TRACE_AND_STEP();
+ x86emu_cpuid();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
REMARKS:
Handles opcode 0x0f,0xa3
****************************************************************************/
-void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -407,7 +532,7 @@ void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa4
****************************************************************************/
-void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint destoffset;
@@ -478,7 +603,7 @@ void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa5
****************************************************************************/
-void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint destoffset;
@@ -540,7 +665,7 @@ void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa8
****************************************************************************/
-void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("PUSH\tGS\n");
@@ -554,7 +679,7 @@ void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa9
****************************************************************************/
-void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("POP\tGS\n");
@@ -568,7 +693,7 @@ void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xaa
****************************************************************************/
-void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -641,7 +766,7 @@ void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xac
****************************************************************************/
-void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint destoffset;
@@ -712,7 +837,7 @@ void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xad
****************************************************************************/
-void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint destoffset;
@@ -773,7 +898,7 @@ void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xaf
****************************************************************************/
-void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -865,7 +990,7 @@ void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb2
****************************************************************************/
-void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
{
int mod, rh, rl;
u16 *dstreg;
@@ -894,7 +1019,7 @@ void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb3
****************************************************************************/
-void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -966,7 +1091,7 @@ void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb4
****************************************************************************/
-void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
{
int mod, rh, rl;
u16 *dstreg;
@@ -995,7 +1120,7 @@ void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb5
****************************************************************************/
-void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
{
int mod, rh, rl;
u16 *dstreg;
@@ -1024,7 +1149,7 @@ void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb6
****************************************************************************/
-void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1087,7 +1212,7 @@ void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb7
****************************************************************************/
-void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1122,7 +1247,7 @@ void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xba
****************************************************************************/
-void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1258,7 +1383,7 @@ void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbb
****************************************************************************/
-void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1330,7 +1455,7 @@ void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbc
****************************************************************************/
-void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1391,7 +1516,7 @@ void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbd
****************************************************************************/
-void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1452,7 +1577,7 @@ void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbe
****************************************************************************/
-void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1515,7 +1640,7 @@ void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbf
****************************************************************************/
-void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
+static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1552,15 +1677,15 @@ void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
void (*x86emu_optab2[256])(u8) =
{
/* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */
-/* 0x01 */ x86emuOp2_illegal_op, /* Group G (ring 0 PM) */
+/* 0x01 */ x86emuOp2_opc_01, /* Group G (ring 0 PM) */
/* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */
/* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */
/* 0x04 */ x86emuOp2_illegal_op,
/* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
/* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */
/* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
-/* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */
-/* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */
+/* 0x08 */ x86emuOp2_invd, /* invd (ring 0 PM) */
+/* 0x09 */ x86emuOp2_wbinvd, /* wbinvd (ring 0 PM) */
/* 0x0a */ x86emuOp2_illegal_op,
/* 0x0b */ x86emuOp2_illegal_op,
/* 0x0c */ x86emuOp2_illegal_op,
@@ -1602,9 +1727,9 @@ void (*x86emu_optab2[256])(u8) =
/* 0x2e */ x86emuOp2_illegal_op,
/* 0x2f */ x86emuOp2_illegal_op,
-/* 0x30 */ x86emuOp2_illegal_op,
+/* 0x30 */ x86emuOp2_wrmsr,
/* 0x31 */ x86emuOp2_illegal_op,
-/* 0x32 */ x86emuOp2_illegal_op,
+/* 0x32 */ x86emuOp2_rdmsr,
/* 0x33 */ x86emuOp2_illegal_op,
/* 0x34 */ x86emuOp2_illegal_op,
/* 0x35 */ x86emuOp2_illegal_op,
@@ -1723,7 +1848,7 @@ void (*x86emu_optab2[256])(u8) =
/* 0xa0 */ x86emuOp2_push_FS,
/* 0xa1 */ x86emuOp2_pop_FS,
-/* 0xa2 */ x86emuOp2_illegal_op,
+/* 0xa2 */ x86emuOp2_cpuid,
/* 0xa3 */ x86emuOp2_bt_R,
/* 0xa4 */ x86emuOp2_shld_IMM,
/* 0xa5 */ x86emuOp2_shld_CL,
@@ -1732,7 +1857,7 @@ void (*x86emu_optab2[256])(u8) =
/* 0xa8 */ x86emuOp2_push_GS,
/* 0xa9 */ x86emuOp2_pop_GS,
/* 0xaa */ x86emuOp2_illegal_op,
-/* 0xab */ x86emuOp2_bt_R,
+/* 0xab */ x86emuOp2_bts_R,
/* 0xac */ x86emuOp2_shrd_IMM,
/* 0xad */ x86emuOp2_shrd_CL,
/* 0xae */ x86emuOp2_illegal_op,
diff --git a/util/x86emu/x86emu/prim_ops.c b/util/x86emu/x86emu/prim_ops.c
index a4a46a20ee..20e75978e5 100644
--- a/util/x86emu/x86emu/prim_ops.c
+++ b/util/x86emu/x86emu/prim_ops.c
@@ -2448,3 +2448,49 @@ DB( if (CHECK_SP_ACCESS())
return res;
}
+/****************************************************************************
+REMARKS:
+CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
+****************************************************************************/
+void x86emu_cpuid(void)
+{
+ u32 feature = M.x86.R_EAX;
+
+ switch (feature) {
+ case 0:
+ /* Regardless if we have real data from the hardware, the emulator
+ * will only support upto feature 1, which we set in register EAX.
+ * Registers EBX:EDX:ECX contain a string identifying the CPU.
+ */
+ M.x86.R_EAX = 1;
+ /* EBX:EDX:ECX = "GenuineIntel" */
+ M.x86.R_EBX = 0x756e6547;
+ M.x86.R_EDX = 0x49656e69;
+ M.x86.R_ECX = 0x6c65746e;
+ break;
+ case 1:
+ /* If we don't have x86 compatible hardware, we return values from an
+ * Intel 486dx4; which was one of the first processors to have CPUID.
+ */
+ M.x86.R_EAX = 0x00000480;
+ M.x86.R_EBX = 0x00000000;
+ M.x86.R_ECX = 0x00000000;
+ M.x86.R_EDX = 0x00000002; /* VME */
+ /* In the case that we have hardware CPUID instruction, we make sure
+ * that the features reported are limited to TSC and VME.
+ */
+ M.x86.R_EDX &= 0x00000012;
+ break;
+ default:
+ /* Finally, we don't support any additional features. Most CPUs
+ * return all zeros when queried for invalid or unsupported feature
+ * numbers.
+ */
+ M.x86.R_EAX = 0;
+ M.x86.R_EBX = 0;
+ M.x86.R_ECX = 0;
+ M.x86.R_EDX = 0;
+ break;
+ }
+}
+
diff --git a/util/x86emu/x86emu/prim_ops.h b/util/x86emu/x86emu/prim_ops.h
index f9f87eb43c..7230a71e5d 100644
--- a/util/x86emu/x86emu/prim_ops.h
+++ b/util/x86emu/x86emu/prim_ops.h
@@ -134,7 +134,8 @@ u16 mem_access_word (int addr);
void push_word (u16 w);
void push_long (u32 w);
u16 pop_word (void);
-u32 pop_long (void);
+u32 pop_long (void);
+void x86emu_cpuid (void);
#if defined(__HAVE_INLINE_ASSEMBLER__) && !defined(PRIM_OPS_NO_REDEFINE_ASM)
diff --git a/util/x86emu/x86emu/sys.c b/util/x86emu/x86emu/sys.c
index 31f8a28047..ffdfe90da9 100644
--- a/util/x86emu/x86emu/sys.c
+++ b/util/x86emu/x86emu/sys.c
@@ -68,7 +68,7 @@ X86EMU_intrFuncs _X86EMU_intrTab[256];
/*----------------------------- Implementation ----------------------------*/
/* compute a pointer. This replaces code scattered all over the place! */
-u8 *mem_ptr(u32 addr, int size)
+static u8 *mem_ptr(u32 addr, int size)
{
u8 *retaddr = 0;