use Paulo's reduced version
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1853 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
3678ad8e38
commit
8b0356c2c9
|
@ -50,8 +50,8 @@ int run_bios_int(int num)
|
||||||
X86_CS = MEM_RW((num << 2) + 2);
|
X86_CS = MEM_RW((num << 2) + 2);
|
||||||
X86_IP = MEM_RW(num << 2);
|
X86_IP = MEM_RW(num << 2);
|
||||||
|
|
||||||
//printf("%s: INT %x CS:IP = %x:%x\n", __FUNCTION__,
|
printf("%s: INT %x CS:IP = %x:%x\n", __FUNCTION__,
|
||||||
// num, MEM_RW((num << 2) + 2), MEM_RW(num << 2));
|
num, MEM_RW((num << 2) + 2), MEM_RW(num << 2));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ u8 x_inb(u16 port)
|
||||||
|
|
||||||
val = inb(port);
|
val = inb(port);
|
||||||
|
|
||||||
//printf("inb(0x%04x) = 0x%02x\n", port, val);
|
printf("inb(0x%04x) = 0x%02x\n", port, val);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ u16 x_inw(u16 port)
|
||||||
|
|
||||||
val = inw(port);
|
val = inw(port);
|
||||||
|
|
||||||
//printf("inw(0x%04x) = 0x%04x\n", port, val);
|
printf("inw(0x%04x) = 0x%04x\n", port, val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,25 +149,26 @@ u32 x_inl(u16 port)
|
||||||
|
|
||||||
val = inl(port);
|
val = inl(port);
|
||||||
|
|
||||||
//printf("inl(0x%04x) = 0x%08x\n", port, val);
|
printf("inl(0x%04x) = 0x%08x\n", port, val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void x_outb(u16 port, u8 val)
|
void x_outb(u16 port, u8 val)
|
||||||
{
|
{
|
||||||
//printf("outb(0x%02x, 0x%04x)\n", val, port);
|
printf("outb(0x%02x, 0x%04x)\n",
|
||||||
|
val, port);
|
||||||
outb(val, port);
|
outb(val, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void x_outw(u16 port, u16 val)
|
void x_outw(u16 port, u16 val)
|
||||||
{
|
{
|
||||||
//printf("outw(0x%04x, 0x%04x)\n", val, port);
|
printf("outw(0x%04x, 0x%04x)\n", val, port);
|
||||||
outw(val, port);
|
outw(val, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void x_outl(u16 port, u32 val)
|
void x_outl(u16 port, u32 val)
|
||||||
{
|
{
|
||||||
//printf("outl(0x%08x, 0x%04x)\n", val, port);
|
printf("outl(0x%08x, 0x%04x)\n", val, port);
|
||||||
outl(val, port);
|
outl(val, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ extern int verbose;
|
||||||
*/
|
*/
|
||||||
int int42_handler()
|
int int42_handler()
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if (verbose && X86_AH != 0x0e) {
|
if (verbose && X86_AH != 0x0e) {
|
||||||
printf("int%x\n", current->num);
|
printf("int%x\n", current->num);
|
||||||
x86emu_dump_xregs();
|
x86emu_dump_xregs();
|
||||||
|
@ -472,7 +472,7 @@ int int42_handler()
|
||||||
/* Ignored */
|
/* Ignored */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,7 +6,7 @@ void x86emu_dump_xregs();
|
||||||
int int15_handler(void)
|
int int15_handler(void)
|
||||||
{
|
{
|
||||||
printf("\nint15 encountered.\n");
|
printf("\nint15 encountered.\n");
|
||||||
x86emu_dump_xregs();
|
//x86emu_dump_xregs();
|
||||||
X86_EAX = 0;
|
X86_EAX = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ int int1A_handler()
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf("\nint1a encountered.\n");
|
printf("\nint1a encountered.\n");
|
||||||
x86emu_dump_xregs();
|
//x86emu_dump_xregs();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (X86_AX) {
|
switch (X86_AX) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ PCITAG findPci(unsigned short bx)
|
||||||
tag->slot = slot;
|
tag->slot = slot;
|
||||||
tag->func = func;
|
tag->func = func;
|
||||||
|
|
||||||
if (pci_get_dev(pacc, bus, slot, func))
|
if (pci_get_dev(pacc, 0, bus, slot, func))
|
||||||
return tag;
|
return tag;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -58,7 +58,7 @@ u32 pciSlotBX(PCITAG tag)
|
||||||
u8 pciReadByte(PCITAG tag, u32 idx)
|
u8 pciReadByte(PCITAG tag, u32 idx)
|
||||||
{
|
{
|
||||||
struct pci_dev *d;
|
struct pci_dev *d;
|
||||||
if ((d = pci_get_dev(pacc, tag->bus, tag->slot, tag->func)))
|
if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
|
||||||
return pci_read_byte(d, idx);
|
return pci_read_byte(d, idx);
|
||||||
#ifdef DEBUG_PCI
|
#ifdef DEBUG_PCI
|
||||||
printf("PCI: device not found while read byte (%x:%x.%x)\n",
|
printf("PCI: device not found while read byte (%x:%x.%x)\n",
|
||||||
|
@ -70,7 +70,7 @@ u8 pciReadByte(PCITAG tag, u32 idx)
|
||||||
u16 pciReadWord(PCITAG tag, u32 idx)
|
u16 pciReadWord(PCITAG tag, u32 idx)
|
||||||
{
|
{
|
||||||
struct pci_dev *d;
|
struct pci_dev *d;
|
||||||
if ((d = pci_get_dev(pacc, tag->bus, tag->slot, tag->func)))
|
if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
|
||||||
return pci_read_word(d, idx);
|
return pci_read_word(d, idx);
|
||||||
#ifdef DEBUG_PCI
|
#ifdef DEBUG_PCI
|
||||||
printf("PCI: device not found while read word (%x:%x.%x)\n",
|
printf("PCI: device not found while read word (%x:%x.%x)\n",
|
||||||
|
@ -82,7 +82,7 @@ u16 pciReadWord(PCITAG tag, u32 idx)
|
||||||
u32 pciReadLong(PCITAG tag, u32 idx)
|
u32 pciReadLong(PCITAG tag, u32 idx)
|
||||||
{
|
{
|
||||||
struct pci_dev *d;
|
struct pci_dev *d;
|
||||||
if ((d = pci_get_dev(pacc, tag->bus, tag->slot, tag->func)))
|
if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
|
||||||
return pci_read_long(d, idx);
|
return pci_read_long(d, idx);
|
||||||
#ifdef DEBUG_PCI
|
#ifdef DEBUG_PCI
|
||||||
printf("PCI: device not found while read long (%x:%x.%x)\n",
|
printf("PCI: device not found while read long (%x:%x.%x)\n",
|
||||||
|
@ -95,7 +95,7 @@ u32 pciReadLong(PCITAG tag, u32 idx)
|
||||||
void pciWriteLong(PCITAG tag, u32 idx, u32 data)
|
void pciWriteLong(PCITAG tag, u32 idx, u32 data)
|
||||||
{
|
{
|
||||||
struct pci_dev *d;
|
struct pci_dev *d;
|
||||||
if ((d = pci_get_dev(pacc, tag->bus, tag->slot, tag->func)))
|
if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
|
||||||
pci_write_long(d, idx, data);
|
pci_write_long(d, idx, data);
|
||||||
#ifdef DEBUG_PCI
|
#ifdef DEBUG_PCI
|
||||||
else
|
else
|
||||||
|
@ -107,7 +107,7 @@ void pciWriteLong(PCITAG tag, u32 idx, u32 data)
|
||||||
void pciWriteWord(PCITAG tag, u32 idx, u16 data)
|
void pciWriteWord(PCITAG tag, u32 idx, u16 data)
|
||||||
{
|
{
|
||||||
struct pci_dev *d;
|
struct pci_dev *d;
|
||||||
if ((d = pci_get_dev(pacc, tag->bus, tag->slot, tag->func)))
|
if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
|
||||||
pci_write_word(d, idx, data);
|
pci_write_word(d, idx, data);
|
||||||
#ifdef DEBUG_PCI
|
#ifdef DEBUG_PCI
|
||||||
else
|
else
|
||||||
|
@ -120,7 +120,7 @@ void pciWriteWord(PCITAG tag, u32 idx, u16 data)
|
||||||
void pciWriteByte(PCITAG tag, u32 idx, u8 data)
|
void pciWriteByte(PCITAG tag, u32 idx, u8 data)
|
||||||
{
|
{
|
||||||
struct pci_dev *d;
|
struct pci_dev *d;
|
||||||
if ((d = pci_get_dev(pacc, tag->bus, tag->slot, tag->func)))
|
if ((d = pci_get_dev(pacc, 0, tag->bus, tag->slot, tag->func)))
|
||||||
pci_write_long(d, idx, data);
|
pci_write_long(d, idx, data);
|
||||||
#ifdef DEBUG_PCI
|
#ifdef DEBUG_PCI
|
||||||
else
|
else
|
||||||
|
|
|
@ -76,7 +76,7 @@ void do_int(int num)
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
printf("\nint%x: not implemented\n", num);
|
printf("\nint%x: not implemented\n", num);
|
||||||
x86emu_dump_xregs();
|
//x86emu_dump_xregs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,10 +317,10 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (trace) {
|
if (trace) {
|
||||||
printf("Switching to single step mode.\n");
|
printf("Switching to single step mode.\n");
|
||||||
X86EMU_trace_on();
|
//X86EMU_trace_on();
|
||||||
}
|
}
|
||||||
if (debugflag) {
|
if (debugflag) {
|
||||||
X86EMU_set_debug(debugflag);
|
//X86EMU_set_debug(debugflag);
|
||||||
}
|
}
|
||||||
X86EMU_exec();
|
X86EMU_exec();
|
||||||
/* Cleaning up */
|
/* Cleaning up */
|
||||||
|
|
|
@ -181,6 +181,8 @@ void X86EMU_halt_sys(void);
|
||||||
#define DEBUG_TRACECALL_REGS_F 0x004000
|
#define DEBUG_TRACECALL_REGS_F 0x004000
|
||||||
#define DEBUG_DECODE_NOPRINT_F 0x008000
|
#define DEBUG_DECODE_NOPRINT_F 0x008000
|
||||||
#define DEBUG_SAVE_IP_CS_F 0x010000
|
#define DEBUG_SAVE_IP_CS_F 0x010000
|
||||||
|
#define DEBUG_EXIT 0x020000
|
||||||
|
#define DEBUG_SAVE_CS_IP 0x040000
|
||||||
#define DEBUG_SYS_F (DEBUG_SVC_F|DEBUG_FS_F|DEBUG_PROC_F)
|
#define DEBUG_SYS_F (DEBUG_SVC_F|DEBUG_FS_F|DEBUG_PROC_F)
|
||||||
|
|
||||||
void X86EMU_trace_regs(void);
|
void X86EMU_trace_regs(void);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Realmode X86 Emulator Library
|
* Realmode X86 Emulator Library
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||||
* Copyright (C) David Mosberger-Tang
|
* Copyright (C) David Mosberger-Tang
|
||||||
* Copyright (C) 1999 Egbert Eich
|
* Copyright (C) 1999 Egbert Eich
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
|
@ -28,444 +28,398 @@
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Language: ANSI C
|
* Language: ANSI C
|
||||||
* Environment: Any
|
* Environment: Any
|
||||||
* Developer: Kendall Bennett
|
* Developer: Kendall Bennett
|
||||||
*
|
*
|
||||||
* Description: This file contains the code to handle debugging of the
|
* Description: This file contains the code to handle debugging of the
|
||||||
* emulator.
|
* emulator.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* $XFree86: xc/extras/x86emu/src/x86emu/debug.c,v 1.4 2000/04/17 16:29:45 eich Exp $ */
|
|
||||||
|
|
||||||
#include "x86emu/x86emui.h"
|
#include "x86emu/x86emui.h"
|
||||||
#ifdef IN_MODULE
|
|
||||||
#include "xf86_ansic.h"
|
|
||||||
#else
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*----------------------------- Implementation ----------------------------*/
|
/*----------------------------- Implementation ----------------------------*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
static void print_encoded_bytes(u16 s, u16 o);
|
static void print_encoded_bytes (u16 s, u16 o);
|
||||||
static void print_decoded_instruction(void);
|
static void print_decoded_instruction (void);
|
||||||
static int parse_line(char *s, int *ps, int *n);
|
static int parse_line (char *s, int *ps, int *n);
|
||||||
|
|
||||||
/* should look something like debug's output. */
|
/* should look something like debug's output. */
|
||||||
void X86EMU_trace_regs(void)
|
void X86EMU_trace_regs (void)
|
||||||
{
|
{
|
||||||
if (DEBUG_TRACE()) {
|
if (DEBUG_TRACE()) {
|
||||||
x86emu_dump_regs();
|
x86emu_dump_regs();
|
||||||
}
|
}
|
||||||
if (DEBUG_DECODE() && !DEBUG_DECODE_NOPRINT()) {
|
if (DEBUG_DECODE() && ! DEBUG_DECODE_NOPRINT()) {
|
||||||
printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
|
printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
|
||||||
print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
|
print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
|
||||||
print_decoded_instruction();
|
print_decoded_instruction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void X86EMU_trace_xregs(void)
|
void X86EMU_trace_xregs (void)
|
||||||
{
|
{
|
||||||
if (DEBUG_TRACE()) {
|
if (DEBUG_TRACE()) {
|
||||||
x86emu_dump_xregs();
|
x86emu_dump_xregs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_just_disassemble(void)
|
void x86emu_just_disassemble (void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This routine called if the flag DEBUG_DISASSEMBLE is set kind
|
* This routine called if the flag DEBUG_DISASSEMBLE is set kind
|
||||||
* of a hack!
|
* of a hack!
|
||||||
*/
|
*/
|
||||||
printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
|
printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
|
||||||
print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
|
print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
|
||||||
print_decoded_instruction();
|
print_decoded_instruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disassemble_forward(u16 seg, u16 off, int n)
|
static void disassemble_forward (u16 seg, u16 off, int n)
|
||||||
{
|
{
|
||||||
X86EMU_sysEnv tregs;
|
X86EMU_sysEnv tregs;
|
||||||
int i;
|
int i;
|
||||||
u8 op1;
|
u8 op1;
|
||||||
/*
|
/*
|
||||||
* hack, hack, hack. What we do is use the exact machinery set up
|
* hack, hack, hack. What we do is use the exact machinery set up
|
||||||
* for execution, except that now there is an additional state
|
* for execution, except that now there is an additional state
|
||||||
* flag associated with the "execution", and we are using a copy
|
* flag associated with the "execution", and we are using a copy
|
||||||
* of the register struct. All the major opcodes, once fully
|
* of the register struct. All the major opcodes, once fully
|
||||||
* decoded, have the following two steps: TRACE_REGS(r,m);
|
* decoded, have the following two steps: TRACE_REGS(r,m);
|
||||||
* SINGLE_STEP(r,m); which disappear if DEBUG is not defined to
|
* SINGLE_STEP(r,m); which disappear if DEBUG is not defined to
|
||||||
* the preprocessor. The TRACE_REGS macro expands to:
|
* the preprocessor. The TRACE_REGS macro expands to:
|
||||||
*
|
*
|
||||||
* if (debug&DEBUG_DISASSEMBLE)
|
* if (debug&DEBUG_DISASSEMBLE)
|
||||||
* {just_disassemble(); goto EndOfInstruction;}
|
* {just_disassemble(); goto EndOfInstruction;}
|
||||||
* if (debug&DEBUG_TRACE) trace_regs(r,m);
|
* if (debug&DEBUG_TRACE) trace_regs(r,m);
|
||||||
*
|
*
|
||||||
* ...... and at the last line of the routine.
|
* ...... and at the last line of the routine.
|
||||||
*
|
*
|
||||||
* EndOfInstruction: end_instr();
|
* EndOfInstruction: end_instr();
|
||||||
*
|
*
|
||||||
* Up to the point where TRACE_REG is expanded, NO modifications
|
* Up to the point where TRACE_REG is expanded, NO modifications
|
||||||
* are done to any register EXCEPT the IP register, for fetch and
|
* are done to any register EXCEPT the IP register, for fetch and
|
||||||
* decoding purposes.
|
* decoding purposes.
|
||||||
*
|
*
|
||||||
* This was done for an entirely different reason, but makes a
|
* This was done for an entirely different reason, but makes a
|
||||||
* nice way to get the system to help debug codes.
|
* nice way to get the system to help debug codes.
|
||||||
*/
|
*/
|
||||||
tregs = M;
|
tregs = M;
|
||||||
tregs.x86.R_IP = off;
|
tregs.x86.R_IP = off;
|
||||||
tregs.x86.R_CS = seg;
|
tregs.x86.R_CS = seg;
|
||||||
|
|
||||||
/* reset the decoding buffers */
|
/* reset the decoding buffers */
|
||||||
tregs.x86.enc_str_pos = 0;
|
tregs.x86.enc_str_pos = 0;
|
||||||
tregs.x86.enc_pos = 0;
|
tregs.x86.enc_pos = 0;
|
||||||
|
|
||||||
/* turn on the "disassemble only, no execute" flag */
|
/* turn on the "disassemble only, no execute" flag */
|
||||||
tregs.x86.debug |= DEBUG_DISASSEMBLE_F;
|
tregs.x86.debug |= DEBUG_DISASSEMBLE_F;
|
||||||
|
|
||||||
/* DUMP NEXT n instructions to screen in straight_line fashion */
|
/* DUMP NEXT n instructions to screen in straight_line fashion */
|
||||||
/*
|
/*
|
||||||
* This looks like the regular instruction fetch stream, except
|
* This looks like the regular instruction fetch stream, except
|
||||||
* that when this occurs, each fetched opcode, upon seeing the
|
* that when this occurs, each fetched opcode, upon seeing the
|
||||||
* DEBUG_DISASSEMBLE flag set, exits immediately after decoding
|
* DEBUG_DISASSEMBLE flag set, exits immediately after decoding
|
||||||
* the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!!
|
* the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!!
|
||||||
* Note the use of a copy of the register structure...
|
* Note the use of a copy of the register structure...
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < n; i++) {
|
for (i=0; i<n; i++) {
|
||||||
op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
|
op1 = (*sys_rdb)(((u32)M.x86.R_CS<<4) + (M.x86.R_IP++));
|
||||||
(x86emu_optab[op1]) (op1);
|
(x86emu_optab[op1])(op1);
|
||||||
}
|
}
|
||||||
/* end major hack mode. */
|
/* end major hack mode. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_check_ip_access(void)
|
void x86emu_check_ip_access (void)
|
||||||
{
|
{
|
||||||
/* NULL as of now */
|
/* NULL as of now */
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_check_sp_access(void)
|
void x86emu_check_sp_access (void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_check_mem_access(u32 dummy)
|
void x86emu_check_mem_access (u32 dummy)
|
||||||
{
|
{
|
||||||
/* check bounds, etc */
|
/* check bounds, etc */
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_check_data_access(uint dummy1, uint dummy2)
|
void x86emu_check_data_access (uint dummy1, uint dummy2)
|
||||||
{
|
{
|
||||||
/* check bounds, etc */
|
/* check bounds, etc */
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_inc_decoded_inst_len(int x)
|
void x86emu_inc_decoded_inst_len (int x)
|
||||||
{
|
{
|
||||||
M.x86.enc_pos += x;
|
M.x86.enc_pos += x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_decode_printf(char *x)
|
void x86emu_decode_printf (char *x)
|
||||||
{
|
{
|
||||||
sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", x);
|
sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",x);
|
||||||
M.x86.enc_str_pos += strlen(x);
|
M.x86.enc_str_pos += strlen(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_decode_printf2(char *x, int y)
|
void x86emu_decode_printf2 (char *x, int y)
|
||||||
{
|
{
|
||||||
char temp[100];
|
char temp[100];
|
||||||
sprintf(temp, x, y);
|
sprintf(temp,x,y);
|
||||||
sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", temp);
|
sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",temp);
|
||||||
M.x86.enc_str_pos += strlen(temp);
|
M.x86.enc_str_pos += strlen(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_end_instr(void)
|
void x86emu_end_instr (void)
|
||||||
{
|
{
|
||||||
M.x86.enc_str_pos = 0;
|
M.x86.enc_str_pos = 0;
|
||||||
M.x86.enc_pos = 0;
|
M.x86.enc_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_encoded_bytes(u16 s, u16 o)
|
static void print_encoded_bytes (u16 s, u16 o)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char buf1[64];
|
char buf1[64];
|
||||||
for (i = 0; i < M.x86.enc_pos; i++) {
|
for (i=0; i< M.x86.enc_pos; i++) {
|
||||||
sprintf(buf1 + 2 * i, "%02x", fetch_data_byte_abs(s, o + i));
|
sprintf(buf1+2*i,"%02x", fetch_data_byte_abs(s,o+i));
|
||||||
}
|
}
|
||||||
printk("%-20s", buf1);
|
printk("%-20s",buf1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_decoded_instruction(void)
|
static void print_decoded_instruction (void)
|
||||||
{
|
{
|
||||||
printk("%s", M.x86.decoded_buf);
|
printk("%s", M.x86.decoded_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_print_int_vect(u16 iv)
|
void x86emu_print_int_vect (u16 iv)
|
||||||
{
|
{
|
||||||
u16 seg, off;
|
u16 seg,off;
|
||||||
|
|
||||||
if (iv > 256)
|
if (iv > 256) return;
|
||||||
return;
|
seg = fetch_data_word_abs(0,iv*4);
|
||||||
seg = fetch_data_word_abs(0, iv * 4);
|
off = fetch_data_word_abs(0,iv*4+2);
|
||||||
off = fetch_data_word_abs(0, iv * 4 + 2);
|
printk("%04x:%04x ", seg, off);
|
||||||
printk("%04x:%04x ", seg, off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void X86EMU_dump_memory(u16 seg, u16 off, u32 amt)
|
void X86EMU_dump_memory (u16 seg, u16 off, u32 amt)
|
||||||
{
|
{
|
||||||
u32 start = off & 0xfffffff0;
|
u32 start = off & 0xfffffff0;
|
||||||
u32 end = (off + 16) & 0xfffffff0;
|
u32 end = (off+16) & 0xfffffff0;
|
||||||
u32 i;
|
u32 i;
|
||||||
u32 current;
|
u32 current;
|
||||||
|
|
||||||
current = start;
|
current = start;
|
||||||
while (end <= off + amt) {
|
while (end <= off + amt) {
|
||||||
printk("%04x:%04x ", seg, start);
|
printk("%04x:%04x ", seg, start);
|
||||||
for (i = start; i < off; i++)
|
for (i=start; i< off; i++)
|
||||||
printk(" ");
|
printk(" ");
|
||||||
for (; i < end; i++)
|
for ( ; i< end; i++)
|
||||||
printk("%02x ", fetch_data_byte_abs(seg, i));
|
printk("%02x ", fetch_data_byte_abs(seg,i));
|
||||||
printk("\n");
|
printk("\n");
|
||||||
start = end;
|
start = end;
|
||||||
end = start + 16;
|
end = start + 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86emu_single_step(void)
|
void x86emu_single_step (void)
|
||||||
{
|
{
|
||||||
char s[1024];
|
char s[1024];
|
||||||
int ps[10];
|
int ps[10];
|
||||||
int ntok;
|
int ntok;
|
||||||
int cmd;
|
int cmd;
|
||||||
int done;
|
int done;
|
||||||
int segment;
|
int segment;
|
||||||
int offset;
|
int offset;
|
||||||
static int breakpoint;
|
static int breakpoint;
|
||||||
static int noDecode = 1;
|
static int noDecode = 1;
|
||||||
|
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (DEBUG_BREAK()) {
|
if (DEBUG_BREAK()) {
|
||||||
if (M.x86.saved_ip != breakpoint) {
|
if (M.x86.saved_ip != breakpoint) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
|
M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
|
||||||
M.x86.debug |= DEBUG_TRACE_F;
|
M.x86.debug |= DEBUG_TRACE_F;
|
||||||
M.x86.debug &= ~DEBUG_BREAK_F;
|
M.x86.debug &= ~DEBUG_BREAK_F;
|
||||||
print_decoded_instruction();
|
print_decoded_instruction ();
|
||||||
X86EMU_trace_regs();
|
X86EMU_trace_regs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
done = 0;
|
done=0;
|
||||||
offset = M.x86.saved_ip;
|
offset = M.x86.saved_ip;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
printk("%x:%x -", M.x86.saved_cs, offset);
|
printk("-");
|
||||||
p = fgets(s, 1023, stdin);
|
p = fgets(s, 1023, stdin);
|
||||||
cmd = parse_line(s, ps, &ntok);
|
cmd = parse_line(s, ps, &ntok);
|
||||||
switch (cmd) {
|
switch(cmd) {
|
||||||
case 'u':
|
case 'u':
|
||||||
disassemble_forward(M.x86.saved_cs, (u16) offset, 10);
|
disassemble_forward(M.x86.saved_cs,(u16)offset,10);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
if (ntok == 2) {
|
if (ntok == 2) {
|
||||||
segment = M.x86.saved_cs;
|
segment = M.x86.saved_cs;
|
||||||
offset = ps[1];
|
offset = ps[1];
|
||||||
X86EMU_dump_memory(segment, (u16) offset, 16);
|
X86EMU_dump_memory(segment,(u16)offset,16);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
} else if (ntok == 3) {
|
} else if (ntok == 3) {
|
||||||
segment = ps[1];
|
segment = ps[1];
|
||||||
offset = ps[2];
|
offset = ps[2];
|
||||||
X86EMU_dump_memory(segment, (u16) offset, 16);
|
X86EMU_dump_memory(segment,(u16)offset,16);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
} else {
|
} else {
|
||||||
segment = M.x86.saved_cs;
|
segment = M.x86.saved_cs;
|
||||||
X86EMU_dump_memory(segment, (u16) offset, 16);
|
X86EMU_dump_memory(segment,(u16)offset,16);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
M.x86.debug ^= DEBUG_TRACECALL_F;
|
M.x86.debug ^= DEBUG_TRACECALL_F;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
|
M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
X86EMU_trace_regs();
|
X86EMU_trace_regs();
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
X86EMU_trace_xregs();
|
X86EMU_trace_xregs();
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
if (ntok == 2) {
|
if (ntok == 2) {
|
||||||
breakpoint = ps[1];
|
breakpoint = ps[1];
|
||||||
if (noDecode) {
|
if (noDecode) {
|
||||||
M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
|
M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
|
||||||
} else {
|
} else {
|
||||||
M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
|
M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
|
||||||
}
|
}
|
||||||
M.x86.debug &= ~DEBUG_TRACE_F;
|
M.x86.debug &= ~DEBUG_TRACE_F;
|
||||||
M.x86.debug |= DEBUG_BREAK_F;
|
M.x86.debug |= DEBUG_BREAK_F;
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
exit(1);
|
M.x86.debug |= DEBUG_EXIT;
|
||||||
case 'P':
|
return;
|
||||||
noDecode = (noDecode) ? 0 : 1;
|
case 'P':
|
||||||
printk("Toggled decoding to %s\n", (noDecode) ? "FALSE" : "TRUE");
|
noDecode = (noDecode)?0:1;
|
||||||
break;
|
printk("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE");
|
||||||
case 't':
|
break;
|
||||||
case 0:
|
case 't':
|
||||||
done = 1;
|
case 0:
|
||||||
break;
|
done = 1;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int X86EMU_trace_on(void)
|
int X86EMU_trace_on(void)
|
||||||
{
|
{
|
||||||
return M.x86.debug |= /*DEBUG_STEP_F | */ DEBUG_DECODE_F | DEBUG_TRACE_F;
|
return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F;
|
||||||
}
|
}
|
||||||
|
|
||||||
int X86EMU_trace_off(void)
|
int X86EMU_trace_off(void)
|
||||||
{
|
{
|
||||||
return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F);
|
return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F);
|
||||||
}
|
}
|
||||||
|
|
||||||
int X86EMU_set_debug(int debug)
|
static int parse_line (char *s, int *ps, int *n)
|
||||||
{
|
{
|
||||||
return M.x86.debug = debug;
|
int cmd;
|
||||||
|
|
||||||
|
*n = 0;
|
||||||
|
while(*s == ' ' || *s == '\t') s++;
|
||||||
|
ps[*n] = *s;
|
||||||
|
switch (*s) {
|
||||||
|
case '\n':
|
||||||
|
*n += 1;
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
cmd = *s;
|
||||||
|
*n += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
while (*s != ' ' && *s != '\t' && *s != '\n') s++;
|
||||||
|
|
||||||
|
if (*s == '\n')
|
||||||
|
return cmd;
|
||||||
|
|
||||||
|
while(*s == ' ' || *s == '\t') s++;
|
||||||
|
|
||||||
|
sscanf(s,"%x",&ps[*n]);
|
||||||
|
*n += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_line(char *s, int *ps, int *n)
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
void x86emu_dump_regs (void)
|
||||||
{
|
{
|
||||||
int cmd;
|
printk("\tAX=%04x ", M.x86.R_AX );
|
||||||
|
printk("BX=%04x ", M.x86.R_BX );
|
||||||
*n = 0;
|
printk("CX=%04x ", M.x86.R_CX );
|
||||||
while (*s == ' ' || *s == '\t')
|
printk("DX=%04x ", M.x86.R_DX );
|
||||||
s++;
|
printk("SP=%04x ", M.x86.R_SP );
|
||||||
ps[*n] = *s;
|
printk("BP=%04x ", M.x86.R_BP );
|
||||||
switch (*s) {
|
printk("SI=%04x ", M.x86.R_SI );
|
||||||
case '\n':
|
printk("DI=%04x\n", M.x86.R_DI );
|
||||||
*n += 1;
|
printk("\tDS=%04x ", M.x86.R_DS );
|
||||||
return 0;
|
printk("ES=%04x ", M.x86.R_ES );
|
||||||
default:
|
printk("SS=%04x ", M.x86.R_SS );
|
||||||
cmd = *s;
|
printk("CS=%04x ", M.x86.R_CS );
|
||||||
*n += 1;
|
printk("IP=%04x ", M.x86.R_IP );
|
||||||
}
|
if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
|
||||||
|
else printk("NV ");
|
||||||
while (1) {
|
if (ACCESS_FLAG(F_DF)) printk("DN ");
|
||||||
while (*s != ' ' && *s != '\t' && *s != '\n')
|
else printk("UP ");
|
||||||
s++;
|
if (ACCESS_FLAG(F_IF)) printk("EI ");
|
||||||
|
else printk("DI ");
|
||||||
if (*s == '\n')
|
if (ACCESS_FLAG(F_SF)) printk("NG ");
|
||||||
return cmd;
|
else printk("PL ");
|
||||||
|
if (ACCESS_FLAG(F_ZF)) printk("ZR ");
|
||||||
while (*s == ' ' || *s == '\t')
|
else printk("NZ ");
|
||||||
s++;
|
if (ACCESS_FLAG(F_AF)) printk("AC ");
|
||||||
|
else printk("NA ");
|
||||||
sscanf(s, "%x", &ps[*n]);
|
if (ACCESS_FLAG(F_PF)) printk("PE ");
|
||||||
*n += 1;
|
else printk("PO ");
|
||||||
}
|
if (ACCESS_FLAG(F_CF)) printk("CY ");
|
||||||
|
else printk("NC ");
|
||||||
|
printk("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* DEBUG */
|
void x86emu_dump_xregs (void)
|
||||||
|
|
||||||
void x86emu_dump_regs(void)
|
|
||||||
{
|
{
|
||||||
printk("\tAX=%04x ", M.x86.R_AX);
|
printk("\tEAX=%08x ", M.x86.R_EAX );
|
||||||
printk("BX=%04x ", M.x86.R_BX);
|
printk("EBX=%08x ", M.x86.R_EBX );
|
||||||
printk("CX=%04x ", M.x86.R_CX);
|
printk("ECX=%08x ", M.x86.R_ECX );
|
||||||
printk("DX=%04x ", M.x86.R_DX);
|
printk("EDX=%08x \n", M.x86.R_EDX );
|
||||||
printk("SP=%04x ", M.x86.R_SP);
|
printk("\tESP=%08x ", M.x86.R_ESP );
|
||||||
printk("BP=%04x ", M.x86.R_BP);
|
printk("EBP=%08x ", M.x86.R_EBP );
|
||||||
printk("SI=%04x ", M.x86.R_SI);
|
printk("ESI=%08x ", M.x86.R_ESI );
|
||||||
printk("DI=%04x\n", M.x86.R_DI);
|
printk("EDI=%08x\n", M.x86.R_EDI );
|
||||||
printk("\tDS=%04x ", M.x86.R_DS);
|
printk("\tDS=%04x ", M.x86.R_DS );
|
||||||
printk("ES=%04x ", M.x86.R_ES);
|
printk("ES=%04x ", M.x86.R_ES );
|
||||||
printk("SS=%04x ", M.x86.R_SS);
|
printk("SS=%04x ", M.x86.R_SS );
|
||||||
printk("CS=%04x ", M.x86.R_CS);
|
printk("CS=%04x ", M.x86.R_CS );
|
||||||
printk("IP=%04x ", M.x86.R_IP);
|
printk("EIP=%08x\n\t", M.x86.R_EIP );
|
||||||
if (ACCESS_FLAG(F_OF))
|
if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
|
||||||
printk("OV "); /* CHECKED... */
|
else printk("NV ");
|
||||||
else
|
if (ACCESS_FLAG(F_DF)) printk("DN ");
|
||||||
printk("NV ");
|
else printk("UP ");
|
||||||
if (ACCESS_FLAG(F_DF))
|
if (ACCESS_FLAG(F_IF)) printk("EI ");
|
||||||
printk("DN ");
|
else printk("DI ");
|
||||||
else
|
if (ACCESS_FLAG(F_SF)) printk("NG ");
|
||||||
printk("UP ");
|
else printk("PL ");
|
||||||
if (ACCESS_FLAG(F_IF))
|
if (ACCESS_FLAG(F_ZF)) printk("ZR ");
|
||||||
printk("EI ");
|
else printk("NZ ");
|
||||||
else
|
if (ACCESS_FLAG(F_AF)) printk("AC ");
|
||||||
printk("DI ");
|
else printk("NA ");
|
||||||
if (ACCESS_FLAG(F_SF))
|
if (ACCESS_FLAG(F_PF)) printk("PE ");
|
||||||
printk("NG ");
|
else printk("PO ");
|
||||||
else
|
if (ACCESS_FLAG(F_CF)) printk("CY ");
|
||||||
printk("PL ");
|
else printk("NC ");
|
||||||
if (ACCESS_FLAG(F_ZF))
|
printk("\n");
|
||||||
printk("ZR ");
|
|
||||||
else
|
|
||||||
printk("NZ ");
|
|
||||||
if (ACCESS_FLAG(F_AF))
|
|
||||||
printk("AC ");
|
|
||||||
else
|
|
||||||
printk("NA ");
|
|
||||||
if (ACCESS_FLAG(F_PF))
|
|
||||||
printk("PE ");
|
|
||||||
else
|
|
||||||
printk("PO ");
|
|
||||||
if (ACCESS_FLAG(F_CF))
|
|
||||||
printk("CY ");
|
|
||||||
else
|
|
||||||
printk("NC ");
|
|
||||||
printk("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void x86emu_dump_xregs(void)
|
|
||||||
{
|
|
||||||
printk("\tEAX=%08x ", M.x86.R_EAX);
|
|
||||||
printk("EBX=%08x ", M.x86.R_EBX);
|
|
||||||
printk("ECX=%08x ", M.x86.R_ECX);
|
|
||||||
printk("EDX=%08x \n", M.x86.R_EDX);
|
|
||||||
printk("\tESP=%08x ", M.x86.R_ESP);
|
|
||||||
printk("EBP=%08x ", M.x86.R_EBP);
|
|
||||||
printk("ESI=%08x ", M.x86.R_ESI);
|
|
||||||
printk("EDI=%08x\n", M.x86.R_EDI);
|
|
||||||
printk("\tDS=%04x ", M.x86.R_DS);
|
|
||||||
printk("ES=%04x ", M.x86.R_ES);
|
|
||||||
printk("SS=%04x ", M.x86.R_SS);
|
|
||||||
printk("CS=%04x ", M.x86.R_CS);
|
|
||||||
printk("EIP=%08x\n\t", M.x86.R_EIP);
|
|
||||||
if (ACCESS_FLAG(F_OF))
|
|
||||||
printk("OV "); /* CHECKED... */
|
|
||||||
else
|
|
||||||
printk("NV ");
|
|
||||||
if (ACCESS_FLAG(F_DF))
|
|
||||||
printk("DN ");
|
|
||||||
else
|
|
||||||
printk("UP ");
|
|
||||||
if (ACCESS_FLAG(F_IF))
|
|
||||||
printk("EI ");
|
|
||||||
else
|
|
||||||
printk("DI ");
|
|
||||||
if (ACCESS_FLAG(F_SF))
|
|
||||||
printk("NG ");
|
|
||||||
else
|
|
||||||
printk("PL ");
|
|
||||||
if (ACCESS_FLAG(F_ZF))
|
|
||||||
printk("ZR ");
|
|
||||||
else
|
|
||||||
printk("NZ ");
|
|
||||||
if (ACCESS_FLAG(F_AF))
|
|
||||||
printk("AC ");
|
|
||||||
else
|
|
||||||
printk("NA ");
|
|
||||||
if (ACCESS_FLAG(F_PF))
|
|
||||||
printk("PE ");
|
|
||||||
else
|
|
||||||
printk("PO ");
|
|
||||||
if (ACCESS_FLAG(F_CF))
|
|
||||||
printk("CY ");
|
|
||||||
else
|
|
||||||
printk("NC ");
|
|
||||||
printk("\n");
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# Realmode X86 Emulator Library
|
# Realmode X86 Emulator Library
|
||||||
#
|
#
|
||||||
# Copyright (C) 1996-1999 SciTech Software, Inc.
|
# Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||||
#
|
#
|
||||||
# ========================================================================
|
# ========================================================================
|
||||||
#
|
#
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
TARGETLIB = libx86emu.a
|
TARGETLIB = libx86emu.a
|
||||||
|
TARGETDEBUGLIB =libx86emud.a
|
||||||
|
|
||||||
OBJS=\
|
OBJS=\
|
||||||
debug.o \
|
|
||||||
decode.o \
|
decode.o \
|
||||||
fpu.o \
|
fpu.o \
|
||||||
ops.o \
|
ops.o \
|
||||||
|
@ -41,20 +41,40 @@ ops2.o \
|
||||||
prim_ops.o \
|
prim_ops.o \
|
||||||
sys.o
|
sys.o
|
||||||
|
|
||||||
|
DEBUGOBJS=debug.d \
|
||||||
|
decode.d \
|
||||||
|
fpu.d \
|
||||||
|
ops.d \
|
||||||
|
ops2.d \
|
||||||
|
prim_ops.d \
|
||||||
|
sys.d
|
||||||
|
|
||||||
|
.SUFFIXES: .d
|
||||||
|
|
||||||
|
all: $(TARGETLIB) $(TARGETDEBUGLIB)
|
||||||
|
|
||||||
$(TARGETLIB): $(OBJS)
|
$(TARGETLIB): $(OBJS)
|
||||||
ar rv $(TARGETLIB) $(OBJS)
|
ar rv $(TARGETLIB) $(OBJS)
|
||||||
|
|
||||||
INCS = -I. -Ix86emu -I../../include
|
$(TARGETDEBUGLIB): $(DEBUGOBJS)
|
||||||
CFLAGS = -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG -DDEBUG
|
ar rv $(TARGETDEBUGLIB) $(DEBUGOBJS)
|
||||||
|
|
||||||
|
INCS = -I. -I../../include -I../../include/x86emu
|
||||||
|
#CFLAGS = -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG
|
||||||
|
CFLAGS = -D__DRIVER__ -DFORCE_POST
|
||||||
|
CDEBUGFLAGS = -DDEBUG
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
gcc -g -O -Wall -c $(CFLAGS) $(INCS) $*.c
|
gcc -g -Os -Wall -c $(CFLAGS) $(INCS) $*.c
|
||||||
|
|
||||||
|
.c.d:
|
||||||
|
gcc -g -O -Wall -c -o$*.d $(CFLAGS) $(CDEBUGFLAGS) $(INCS) $*.c
|
||||||
|
|
||||||
.cpp.o:
|
.cpp.o:
|
||||||
gcc -c $(CFLAGS) $(INCS) $*.cpp
|
gcc -c $(CFLAGS) $(INCS) $*.cpp
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.a *.o
|
rm -f *.a *.o *.d
|
||||||
|
|
||||||
validate: validate.o libx86emu.a
|
validate: validate.c libx86emu.a x86emu/prim_asm.h
|
||||||
gcc -o validate validate.o -lx86emu -L.
|
gcc $(CFLAGS) $(INCS) -Wall -O2 -o validate validate.c -lx86emu -L.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -198,7 +198,7 @@ u8 *mem_ptr(u32 addr, int size)
|
||||||
retaddr = (u8 *) (M.abseg + addr);
|
retaddr = (u8 *) (M.abseg + addr);
|
||||||
//printk("retaddr now 0x%p\n", retaddr);
|
//printk("retaddr now 0x%p\n", retaddr);
|
||||||
} else if (addr < 0x200) {
|
} else if (addr < 0x200) {
|
||||||
//printk("updating int vector 0x%x\n", addr >> 2);
|
printk("updating int vector 0x%x\n", addr >> 2);
|
||||||
retaddr = (u8 *) (M.mem_base + addr);
|
retaddr = (u8 *) (M.mem_base + addr);
|
||||||
} else {
|
} else {
|
||||||
retaddr = (u8 *) (M.mem_base + addr);
|
retaddr = (u8 *) (M.mem_base + addr);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Realmode X86 Emulator Library
|
* Realmode X86 Emulator Library
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||||
* Copyright (C) David Mosberger-Tang
|
* Copyright (C) David Mosberger-Tang
|
||||||
* Copyright (C) 1999 Egbert Eich
|
* Copyright (C) 1999 Egbert Eich
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
|
@ -47,20 +47,28 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "x86emu.h"
|
#include "x86emu.h"
|
||||||
#include "x86emu/prim_asm.h"
|
#include "x86emu/prim_asm.h"
|
||||||
|
#include "x86emu/prim_ops.h"
|
||||||
|
|
||||||
/*-------------------------- Implementation -------------------------------*/
|
/*-------------------------- Implementation -------------------------------*/
|
||||||
|
|
||||||
#define true 1
|
#define true 1
|
||||||
#define false 0
|
#define false 0
|
||||||
|
|
||||||
|
u32 cur_flags_mask = 0;
|
||||||
|
|
||||||
|
int flags_are_different(u32 flags1, u32 flags2)
|
||||||
|
{
|
||||||
|
return (flags1&cur_flags_mask) != (flags2&cur_flags_mask);
|
||||||
|
}
|
||||||
|
|
||||||
#define ALL_FLAGS (F_CF | F_PF | F_AF | F_ZF | F_SF | F_OF)
|
#define ALL_FLAGS (F_CF | F_PF | F_AF | F_ZF | F_SF | F_OF)
|
||||||
|
|
||||||
#define VAL_START_BINARY(parm_type,res_type,dmax,smax,dincr,sincr) \
|
#define VAL_START_BINARY(parm_type,res_type,dmax,smax,dincr,sincr) \
|
||||||
{ \
|
{ \
|
||||||
parm_type d,s; \
|
parm_type d,s; \
|
||||||
res_type r,r_asm; \
|
res_type r,r_asm; \
|
||||||
ulong flags,inflags; \
|
u32 flags,inflags; \
|
||||||
int f,failed = false; \
|
int f,failed = false; \
|
||||||
char buf1[80],buf2[80]; \
|
char buf1[80],buf2[80]; \
|
||||||
for (d = 0; d < dmax; d += dincr) { \
|
for (d = 0; d < dmax; d += dincr) { \
|
||||||
for (s = 0; s < smax; s += sincr) { \
|
for (s = 0; s < smax; s += sincr) { \
|
||||||
|
@ -70,7 +78,7 @@
|
||||||
#define VAL_TEST_BINARY(name) \
|
#define VAL_TEST_BINARY(name) \
|
||||||
r_asm = name##_asm(&flags,d,s); \
|
r_asm = name##_asm(&flags,d,s); \
|
||||||
r = name(d,s); \
|
r = name(d,s); \
|
||||||
if (r != r_asm || M.x86.R_EFLG != flags) \
|
if (r != r_asm || flags_are_different(M.x86.R_EFLG, flags)) \
|
||||||
failed = true; \
|
failed = true; \
|
||||||
if (failed || trace) {
|
if (failed || trace) {
|
||||||
|
|
||||||
|
@ -78,7 +86,7 @@
|
||||||
name##_asm(&flags,d,s); \
|
name##_asm(&flags,d,s); \
|
||||||
name(d,s); \
|
name(d,s); \
|
||||||
r = r_asm = 0; \
|
r = r_asm = 0; \
|
||||||
if (M.x86.R_EFLG != flags) \
|
if (flags_are_different(M.x86.R_EFLG, flags)) \
|
||||||
failed = true; \
|
failed = true; \
|
||||||
if (failed || trace) {
|
if (failed || trace) {
|
||||||
|
|
||||||
|
@ -190,7 +198,7 @@
|
||||||
parm_type d,s; \
|
parm_type d,s; \
|
||||||
res_type r,r_asm; \
|
res_type r,r_asm; \
|
||||||
u8 shift; \
|
u8 shift; \
|
||||||
u32 flags,inflags; \
|
u32 flags,inflags; \
|
||||||
int f,failed = false; \
|
int f,failed = false; \
|
||||||
char buf1[80],buf2[80]; \
|
char buf1[80],buf2[80]; \
|
||||||
for (d = 0; d < dmax; d += dincr) { \
|
for (d = 0; d < dmax; d += dincr) { \
|
||||||
|
@ -202,7 +210,7 @@
|
||||||
#define VAL_TEST_TERNARY(name) \
|
#define VAL_TEST_TERNARY(name) \
|
||||||
r_asm = name##_asm(&flags,d,s,shift); \
|
r_asm = name##_asm(&flags,d,s,shift); \
|
||||||
r = name(d,s,shift); \
|
r = name(d,s,shift); \
|
||||||
if (r != r_asm || M.x86.R_EFLG != flags) \
|
if (r != r_asm || flags_are_different(M.x86.R_EFLG, flags)) \
|
||||||
failed = true; \
|
failed = true; \
|
||||||
if (failed || trace) {
|
if (failed || trace) {
|
||||||
|
|
||||||
|
@ -258,7 +266,7 @@
|
||||||
#define VAL_START_UNARY(parm_type,max,incr) \
|
#define VAL_START_UNARY(parm_type,max,incr) \
|
||||||
{ \
|
{ \
|
||||||
parm_type d,r,r_asm; \
|
parm_type d,r,r_asm; \
|
||||||
u32 flags,inflags; \
|
u32 flags,inflags; \
|
||||||
int f,failed = false; \
|
int f,failed = false; \
|
||||||
char buf1[80],buf2[80]; \
|
char buf1[80],buf2[80]; \
|
||||||
for (d = 0; d < max; d += incr) { \
|
for (d = 0; d < max; d += incr) { \
|
||||||
|
@ -268,7 +276,7 @@
|
||||||
#define VAL_TEST_UNARY(name) \
|
#define VAL_TEST_UNARY(name) \
|
||||||
r_asm = name##_asm(&flags,d); \
|
r_asm = name##_asm(&flags,d); \
|
||||||
r = name(d); \
|
r = name(d); \
|
||||||
if (r != r_asm || M.x86.R_EFLG != flags) { \
|
if (r != r_asm || flags_are_different(M.x86.R_EFLG, flags)) { \
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
#define VAL_FAIL_BYTE_UNARY(name) \
|
#define VAL_FAIL_BYTE_UNARY(name) \
|
||||||
|
@ -338,7 +346,7 @@
|
||||||
{ \
|
{ \
|
||||||
u8 d,s; \
|
u8 d,s; \
|
||||||
u16 r,r_asm; \
|
u16 r,r_asm; \
|
||||||
u32 flags,inflags; \
|
u32 flags,inflags; \
|
||||||
int f,failed = false; \
|
int f,failed = false; \
|
||||||
char buf1[80],buf2[80]; \
|
char buf1[80],buf2[80]; \
|
||||||
for (d = 0; d < 0xFF; d += 1) { \
|
for (d = 0; d < 0xFF; d += 1) { \
|
||||||
|
@ -349,7 +357,7 @@
|
||||||
M.x86.R_AL = d; \
|
M.x86.R_AL = d; \
|
||||||
name(s); \
|
name(s); \
|
||||||
r = M.x86.R_AX; \
|
r = M.x86.R_AX; \
|
||||||
if (r != r_asm || M.x86.R_EFLG != flags) \
|
if (r != r_asm || flags_are_different(M.x86.R_EFLG, flags)) \
|
||||||
failed = true; \
|
failed = true; \
|
||||||
if (failed || trace) { \
|
if (failed || trace) { \
|
||||||
if (failed) \
|
if (failed) \
|
||||||
|
@ -379,7 +387,7 @@
|
||||||
u16 d,s; \
|
u16 d,s; \
|
||||||
u16 r_lo,r_asm_lo; \
|
u16 r_lo,r_asm_lo; \
|
||||||
u16 r_hi,r_asm_hi; \
|
u16 r_hi,r_asm_hi; \
|
||||||
u32 flags,inflags; \
|
u32 flags,inflags; \
|
||||||
int f,failed = false; \
|
int f,failed = false; \
|
||||||
char buf1[80],buf2[80]; \
|
char buf1[80],buf2[80]; \
|
||||||
for (d = 0; d < 0xFF00; d += 0x100) { \
|
for (d = 0; d < 0xFF00; d += 0x100) { \
|
||||||
|
@ -391,7 +399,7 @@
|
||||||
name(s); \
|
name(s); \
|
||||||
r_lo = M.x86.R_AX; \
|
r_lo = M.x86.R_AX; \
|
||||||
r_hi = M.x86.R_DX; \
|
r_hi = M.x86.R_DX; \
|
||||||
if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\
|
if (r_lo != r_asm_lo || r_hi != r_asm_hi || flags_are_different(M.x86.R_EFLG, flags))\
|
||||||
failed = true; \
|
failed = true; \
|
||||||
if (failed || trace) { \
|
if (failed || trace) { \
|
||||||
if (failed) \
|
if (failed) \
|
||||||
|
@ -421,7 +429,7 @@
|
||||||
u32 d,s; \
|
u32 d,s; \
|
||||||
u32 r_lo,r_asm_lo; \
|
u32 r_lo,r_asm_lo; \
|
||||||
u32 r_hi,r_asm_hi; \
|
u32 r_hi,r_asm_hi; \
|
||||||
u32 flags,inflags; \
|
u32 flags,inflags; \
|
||||||
int f,failed = false; \
|
int f,failed = false; \
|
||||||
char buf1[80],buf2[80]; \
|
char buf1[80],buf2[80]; \
|
||||||
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
|
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
|
||||||
|
@ -433,7 +441,7 @@
|
||||||
name(s); \
|
name(s); \
|
||||||
r_lo = M.x86.R_EAX; \
|
r_lo = M.x86.R_EAX; \
|
||||||
r_hi = M.x86.R_EDX; \
|
r_hi = M.x86.R_EDX; \
|
||||||
if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\
|
if (r_lo != r_asm_lo || r_hi != r_asm_hi || flags_are_different(M.x86.R_EFLG, flags))\
|
||||||
failed = true; \
|
failed = true; \
|
||||||
if (failed || trace) { \
|
if (failed || trace) { \
|
||||||
if (failed) \
|
if (failed) \
|
||||||
|
@ -462,7 +470,7 @@
|
||||||
{ \
|
{ \
|
||||||
u16 d,s; \
|
u16 d,s; \
|
||||||
u8 r_quot,r_rem,r_asm_quot,r_asm_rem; \
|
u8 r_quot,r_rem,r_asm_quot,r_asm_rem; \
|
||||||
u32 flags,inflags; \
|
u32 flags,inflags; \
|
||||||
int f,failed = false; \
|
int f,failed = false; \
|
||||||
char buf1[80],buf2[80]; \
|
char buf1[80],buf2[80]; \
|
||||||
for (d = 0; d < 0xFF00; d += 0x100) { \
|
for (d = 0; d < 0xFF00; d += 0x100) { \
|
||||||
|
@ -477,7 +485,7 @@
|
||||||
if (M.x86.intr & INTR_SYNCH) \
|
if (M.x86.intr & INTR_SYNCH) \
|
||||||
continue; \
|
continue; \
|
||||||
name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,s); \
|
name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,s); \
|
||||||
if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
|
if (r_quot != r_asm_quot || r_rem != r_asm_rem || flags_are_different(M.x86.R_EFLG, flags)) \
|
||||||
failed = true; \
|
failed = true; \
|
||||||
if (failed || trace) { \
|
if (failed || trace) { \
|
||||||
if (failed) \
|
if (failed) \
|
||||||
|
@ -506,7 +514,7 @@
|
||||||
{ \
|
{ \
|
||||||
u32 d,s; \
|
u32 d,s; \
|
||||||
u16 r_quot,r_rem,r_asm_quot,r_asm_rem; \
|
u16 r_quot,r_rem,r_asm_quot,r_asm_rem; \
|
||||||
u32 flags,inflags; \
|
u32 flags,inflags; \
|
||||||
int f,failed = false; \
|
int f,failed = false; \
|
||||||
char buf1[80],buf2[80]; \
|
char buf1[80],buf2[80]; \
|
||||||
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
|
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
|
||||||
|
@ -522,7 +530,7 @@
|
||||||
if (M.x86.intr & INTR_SYNCH) \
|
if (M.x86.intr & INTR_SYNCH) \
|
||||||
continue; \
|
continue; \
|
||||||
name##_asm(&flags,&r_asm_quot,&r_asm_rem,d & 0xFFFF,d >> 16,s);\
|
name##_asm(&flags,&r_asm_quot,&r_asm_rem,d & 0xFFFF,d >> 16,s);\
|
||||||
if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
|
if (r_quot != r_asm_quot || r_rem != r_asm_rem || flags_are_different(M.x86.R_EFLG, flags)) \
|
||||||
failed = true; \
|
failed = true; \
|
||||||
if (failed || trace) { \
|
if (failed || trace) { \
|
||||||
if (failed) \
|
if (failed) \
|
||||||
|
@ -551,7 +559,7 @@
|
||||||
{ \
|
{ \
|
||||||
u32 d,s; \
|
u32 d,s; \
|
||||||
u32 r_quot,r_rem,r_asm_quot,r_asm_rem; \
|
u32 r_quot,r_rem,r_asm_quot,r_asm_rem; \
|
||||||
u32 flags,inflags; \
|
u32 flags,inflags; \
|
||||||
int f,failed = false; \
|
int f,failed = false; \
|
||||||
char buf1[80],buf2[80]; \
|
char buf1[80],buf2[80]; \
|
||||||
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
|
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
|
||||||
|
@ -567,7 +575,7 @@
|
||||||
if (M.x86.intr & INTR_SYNCH) \
|
if (M.x86.intr & INTR_SYNCH) \
|
||||||
continue; \
|
continue; \
|
||||||
name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,0,s); \
|
name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,0,s); \
|
||||||
if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
|
if (r_quot != r_asm_quot || r_rem != r_asm_rem || flags_are_different(M.x86.R_EFLG, flags)) \
|
||||||
failed = true; \
|
failed = true; \
|
||||||
if (failed || trace) { \
|
if (failed || trace) { \
|
||||||
if (failed) \
|
if (failed) \
|
||||||
|
@ -593,173 +601,189 @@
|
||||||
|
|
||||||
void printk(const char *fmt, ...)
|
void printk(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
vfprintf(stdout, fmt, argptr);
|
vfprintf(stdout, fmt, argptr);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *print_flags(char *buf, ulong flags)
|
char * print_flags(char *buf,ulong flags)
|
||||||
{
|
{
|
||||||
char *separator = "";
|
char *separator = "";
|
||||||
|
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
if (flags & F_CF) {
|
if (flags & F_CF) {
|
||||||
strcat(buf, separator);
|
strcat(buf,separator);
|
||||||
strcat(buf, "CF");
|
strcat(buf,"CF");
|
||||||
separator = ",";
|
separator = ",";
|
||||||
}
|
}
|
||||||
if (flags & F_PF) {
|
if (flags & F_PF) {
|
||||||
strcat(buf, separator);
|
strcat(buf,separator);
|
||||||
strcat(buf, "PF");
|
strcat(buf,"PF");
|
||||||
separator = ",";
|
separator = ",";
|
||||||
}
|
}
|
||||||
if (flags & F_AF) {
|
if (flags & F_AF) {
|
||||||
strcat(buf, separator);
|
strcat(buf,separator);
|
||||||
strcat(buf, "AF");
|
strcat(buf,"AF");
|
||||||
separator = ",";
|
separator = ",";
|
||||||
}
|
}
|
||||||
if (flags & F_ZF) {
|
if (flags & F_ZF) {
|
||||||
strcat(buf, separator);
|
strcat(buf,separator);
|
||||||
strcat(buf, "ZF");
|
strcat(buf,"ZF");
|
||||||
separator = ",";
|
separator = ",";
|
||||||
}
|
}
|
||||||
if (flags & F_SF) {
|
if (flags & F_SF) {
|
||||||
strcat(buf, separator);
|
strcat(buf,separator);
|
||||||
strcat(buf, "SF");
|
strcat(buf,"SF");
|
||||||
separator = ",";
|
separator = ",";
|
||||||
}
|
}
|
||||||
if (flags & F_OF) {
|
if (flags & F_OF) {
|
||||||
strcat(buf, separator);
|
strcat(buf,separator);
|
||||||
strcat(buf, "OF");
|
strcat(buf,"OF");
|
||||||
separator = ",";
|
separator = ",";
|
||||||
}
|
}
|
||||||
if (separator[0] == 0)
|
if (separator[0] == 0)
|
||||||
strcpy(buf, "None");
|
strcpy(buf,"None");
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc)
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
ulong def_flags;
|
u32 def_flags;
|
||||||
int trace = false;
|
int trace = false;
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
trace = true;
|
trace = true;
|
||||||
memset(&M, 0, sizeof(M));
|
memset(&M, 0, sizeof(M));
|
||||||
def_flags = get_flags_asm() & ~ALL_FLAGS;
|
def_flags = get_flags_asm() & ~ALL_FLAGS;
|
||||||
|
|
||||||
VAL_WORD_UNARY(aaa_word);
|
cur_flags_mask = F_AF | F_CF;
|
||||||
VAL_WORD_UNARY(aas_word);
|
VAL_WORD_UNARY(aaa_word);
|
||||||
|
VAL_WORD_UNARY(aas_word);
|
||||||
|
|
||||||
VAL_WORD_UNARY(aad_word);
|
cur_flags_mask = F_SF | F_ZF | F_PF;
|
||||||
VAL_WORD_UNARY(aam_word);
|
VAL_WORD_UNARY(aad_word);
|
||||||
|
VAL_WORD_UNARY(aam_word);
|
||||||
|
|
||||||
VAL_BYTE_BYTE_BINARY(adc_byte);
|
cur_flags_mask = ALL_FLAGS;
|
||||||
VAL_WORD_WORD_BINARY(adc_word);
|
VAL_BYTE_BYTE_BINARY(adc_byte);
|
||||||
VAL_LONG_LONG_BINARY(adc_long);
|
VAL_WORD_WORD_BINARY(adc_word);
|
||||||
|
VAL_LONG_LONG_BINARY(adc_long);
|
||||||
|
|
||||||
VAL_BYTE_BYTE_BINARY(add_byte);
|
VAL_BYTE_BYTE_BINARY(add_byte);
|
||||||
VAL_WORD_WORD_BINARY(add_word);
|
VAL_WORD_WORD_BINARY(add_word);
|
||||||
VAL_LONG_LONG_BINARY(add_long);
|
VAL_LONG_LONG_BINARY(add_long);
|
||||||
|
|
||||||
VAL_BYTE_BYTE_BINARY(and_byte);
|
cur_flags_mask = ALL_FLAGS & (~F_AF);
|
||||||
VAL_WORD_WORD_BINARY(and_word);
|
VAL_BYTE_BYTE_BINARY(and_byte);
|
||||||
VAL_LONG_LONG_BINARY(and_long);
|
VAL_WORD_WORD_BINARY(and_word);
|
||||||
|
VAL_LONG_LONG_BINARY(and_long);
|
||||||
|
|
||||||
VAL_BYTE_BYTE_BINARY(cmp_byte);
|
cur_flags_mask = ALL_FLAGS;
|
||||||
VAL_WORD_WORD_BINARY(cmp_word);
|
VAL_BYTE_BYTE_BINARY(cmp_byte);
|
||||||
VAL_LONG_LONG_BINARY(cmp_long);
|
VAL_WORD_WORD_BINARY(cmp_word);
|
||||||
|
VAL_LONG_LONG_BINARY(cmp_long);
|
||||||
|
|
||||||
VAL_BYTE_UNARY(daa_byte);
|
cur_flags_mask = ALL_FLAGS & (~F_OF);
|
||||||
VAL_BYTE_UNARY(das_byte); // Fails for 0x9A (out of range anyway)
|
VAL_BYTE_UNARY(daa_byte);
|
||||||
|
VAL_BYTE_UNARY(das_byte); // Fails for 0x9A (out of range anyway)
|
||||||
|
|
||||||
VAL_BYTE_UNARY(dec_byte);
|
cur_flags_mask = ALL_FLAGS;
|
||||||
VAL_WORD_UNARY(dec_word);
|
VAL_BYTE_UNARY(dec_byte);
|
||||||
VAL_LONG_UNARY(dec_long);
|
VAL_WORD_UNARY(dec_word);
|
||||||
|
VAL_LONG_UNARY(dec_long);
|
||||||
|
|
||||||
VAL_BYTE_UNARY(inc_byte);
|
VAL_BYTE_UNARY(inc_byte);
|
||||||
VAL_WORD_UNARY(inc_word);
|
VAL_WORD_UNARY(inc_word);
|
||||||
VAL_LONG_UNARY(inc_long);
|
VAL_LONG_UNARY(inc_long);
|
||||||
|
|
||||||
VAL_BYTE_BYTE_BINARY(or_byte);
|
cur_flags_mask = ALL_FLAGS & (~F_AF);
|
||||||
VAL_WORD_WORD_BINARY(or_word);
|
VAL_BYTE_BYTE_BINARY(or_byte);
|
||||||
VAL_LONG_LONG_BINARY(or_long);
|
VAL_WORD_WORD_BINARY(or_word);
|
||||||
|
VAL_LONG_LONG_BINARY(or_long);
|
||||||
|
|
||||||
VAL_BYTE_UNARY(neg_byte);
|
cur_flags_mask = ALL_FLAGS;
|
||||||
VAL_WORD_UNARY(neg_word);
|
VAL_BYTE_UNARY(neg_byte);
|
||||||
VAL_LONG_UNARY(neg_long);
|
VAL_WORD_UNARY(neg_word);
|
||||||
|
VAL_LONG_UNARY(neg_long);
|
||||||
|
|
||||||
VAL_BYTE_UNARY(not_byte);
|
VAL_BYTE_UNARY(not_byte);
|
||||||
VAL_WORD_UNARY(not_word);
|
VAL_WORD_UNARY(not_word);
|
||||||
VAL_LONG_UNARY(not_long);
|
VAL_LONG_UNARY(not_long);
|
||||||
|
|
||||||
VAL_BYTE_ROTATE(rcl_byte);
|
cur_flags_mask = ALL_FLAGS & (~F_OF);
|
||||||
VAL_WORD_ROTATE(rcl_word);
|
VAL_BYTE_ROTATE(rcl_byte);
|
||||||
VAL_LONG_ROTATE(rcl_long);
|
VAL_WORD_ROTATE(rcl_word);
|
||||||
|
VAL_LONG_ROTATE(rcl_long);
|
||||||
|
|
||||||
VAL_BYTE_ROTATE(rcr_byte);
|
VAL_BYTE_ROTATE(rcr_byte);
|
||||||
VAL_WORD_ROTATE(rcr_word);
|
VAL_WORD_ROTATE(rcr_word);
|
||||||
VAL_LONG_ROTATE(rcr_long);
|
VAL_LONG_ROTATE(rcr_long);
|
||||||
|
|
||||||
VAL_BYTE_ROTATE(rol_byte);
|
VAL_BYTE_ROTATE(rol_byte);
|
||||||
VAL_WORD_ROTATE(rol_word);
|
VAL_WORD_ROTATE(rol_word);
|
||||||
VAL_LONG_ROTATE(rol_long);
|
VAL_LONG_ROTATE(rol_long);
|
||||||
|
|
||||||
VAL_BYTE_ROTATE(ror_byte);
|
VAL_BYTE_ROTATE(ror_byte);
|
||||||
VAL_WORD_ROTATE(ror_word);
|
VAL_WORD_ROTATE(ror_word);
|
||||||
VAL_LONG_ROTATE(ror_long);
|
VAL_LONG_ROTATE(ror_long);
|
||||||
|
|
||||||
VAL_BYTE_ROTATE(shl_byte);
|
cur_flags_mask = ALL_FLAGS & (~(F_AF | F_OF));
|
||||||
VAL_WORD_ROTATE(shl_word);
|
VAL_BYTE_ROTATE(shl_byte);
|
||||||
VAL_LONG_ROTATE(shl_long);
|
VAL_WORD_ROTATE(shl_word);
|
||||||
|
VAL_LONG_ROTATE(shl_long);
|
||||||
|
|
||||||
VAL_BYTE_ROTATE(shr_byte);
|
VAL_BYTE_ROTATE(shr_byte);
|
||||||
VAL_WORD_ROTATE(shr_word);
|
VAL_WORD_ROTATE(shr_word);
|
||||||
VAL_LONG_ROTATE(shr_long);
|
VAL_LONG_ROTATE(shr_long);
|
||||||
|
|
||||||
VAL_BYTE_ROTATE(sar_byte);
|
VAL_BYTE_ROTATE(sar_byte);
|
||||||
VAL_WORD_ROTATE(sar_word);
|
VAL_WORD_ROTATE(sar_word);
|
||||||
VAL_LONG_ROTATE(sar_long);
|
VAL_LONG_ROTATE(sar_long);
|
||||||
|
|
||||||
VAL_WORD_ROTATE_DBL(shld_word);
|
cur_flags_mask = ALL_FLAGS & (~(F_AF | F_OF));
|
||||||
VAL_LONG_ROTATE_DBL(shld_long);
|
VAL_WORD_ROTATE_DBL(shld_word);
|
||||||
|
VAL_LONG_ROTATE_DBL(shld_long);
|
||||||
|
|
||||||
VAL_WORD_ROTATE_DBL(shrd_word);
|
VAL_WORD_ROTATE_DBL(shrd_word);
|
||||||
VAL_LONG_ROTATE_DBL(shrd_long);
|
VAL_LONG_ROTATE_DBL(shrd_long);
|
||||||
|
|
||||||
VAL_BYTE_BYTE_BINARY(sbb_byte);
|
cur_flags_mask = ALL_FLAGS;
|
||||||
VAL_WORD_WORD_BINARY(sbb_word);
|
VAL_BYTE_BYTE_BINARY(sbb_byte);
|
||||||
VAL_LONG_LONG_BINARY(sbb_long);
|
VAL_WORD_WORD_BINARY(sbb_word);
|
||||||
|
VAL_LONG_LONG_BINARY(sbb_long);
|
||||||
|
|
||||||
VAL_BYTE_BYTE_BINARY(sub_byte);
|
VAL_BYTE_BYTE_BINARY(sub_byte);
|
||||||
VAL_WORD_WORD_BINARY(sub_word);
|
VAL_WORD_WORD_BINARY(sub_word);
|
||||||
VAL_LONG_LONG_BINARY(sub_long);
|
VAL_LONG_LONG_BINARY(sub_long);
|
||||||
|
|
||||||
VAL_BYTE_BYTE_BINARY(xor_byte);
|
cur_flags_mask = ALL_FLAGS & (~F_AF);
|
||||||
VAL_WORD_WORD_BINARY(xor_word);
|
VAL_BYTE_BYTE_BINARY(xor_byte);
|
||||||
VAL_LONG_LONG_BINARY(xor_long);
|
VAL_WORD_WORD_BINARY(xor_word);
|
||||||
|
VAL_LONG_LONG_BINARY(xor_long);
|
||||||
|
|
||||||
VAL_VOID_BYTE_BINARY(test_byte);
|
VAL_VOID_BYTE_BINARY(test_byte);
|
||||||
VAL_VOID_WORD_BINARY(test_word);
|
VAL_VOID_WORD_BINARY(test_word);
|
||||||
VAL_VOID_LONG_BINARY(test_long);
|
VAL_VOID_LONG_BINARY(test_long);
|
||||||
|
|
||||||
VAL_BYTE_MUL(imul_byte);
|
cur_flags_mask = F_CF | F_OF;
|
||||||
VAL_WORD_MUL(imul_word);
|
VAL_BYTE_MUL(imul_byte);
|
||||||
VAL_LONG_MUL(imul_long);
|
VAL_WORD_MUL(imul_word);
|
||||||
|
VAL_LONG_MUL(imul_long);
|
||||||
|
|
||||||
VAL_BYTE_MUL(mul_byte);
|
VAL_BYTE_MUL(mul_byte);
|
||||||
VAL_WORD_MUL(mul_word);
|
VAL_WORD_MUL(mul_word);
|
||||||
VAL_LONG_MUL(mul_long);
|
VAL_LONG_MUL(mul_long);
|
||||||
|
|
||||||
VAL_BYTE_DIV(idiv_byte);
|
cur_flags_mask = 0;
|
||||||
VAL_WORD_DIV(idiv_word);
|
VAL_BYTE_DIV(idiv_byte);
|
||||||
VAL_LONG_DIV(idiv_long);
|
VAL_WORD_DIV(idiv_word);
|
||||||
|
VAL_LONG_DIV(idiv_long);
|
||||||
|
|
||||||
VAL_BYTE_DIV(div_byte);
|
VAL_BYTE_DIV(div_byte);
|
||||||
VAL_WORD_DIV(div_word);
|
VAL_WORD_DIV(div_word);
|
||||||
VAL_LONG_DIV(div_long);
|
VAL_LONG_DIV(div_long);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Realmode X86 Emulator Library
|
* Realmode X86 Emulator Library
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||||
* Copyright (C) David Mosberger-Tang
|
* Copyright (C) David Mosberger-Tang
|
||||||
* Copyright (C) 1999 Egbert Eich
|
* Copyright (C) 1999 Egbert Eich
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
|
@ -28,14 +28,13 @@
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Language: ANSI C
|
* Language: ANSI C
|
||||||
* Environment: Any
|
* Environment: Any
|
||||||
* Developer: Kendall Bennett
|
* Developer: Kendall Bennett
|
||||||
*
|
*
|
||||||
* Description: Header file for debug definitions.
|
* Description: Header file for debug definitions.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/debug.h,v 1.4 2000/11/21 23:10:27 tsi Exp $ */
|
|
||||||
|
|
||||||
#ifndef __X86EMU_DEBUG_H
|
#ifndef __X86EMU_DEBUG_H
|
||||||
#define __X86EMU_DEBUG_H
|
#define __X86EMU_DEBUG_H
|
||||||
|
@ -50,10 +49,10 @@
|
||||||
#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset*/
|
#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F)
|
# define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F)
|
||||||
# define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F)
|
# define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F)
|
||||||
# define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
|
# define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
|
||||||
# define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
|
# define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
|
||||||
#else
|
#else
|
||||||
# define CHECK_IP_FETCH()
|
# define CHECK_IP_FETCH()
|
||||||
# define CHECK_SP_ACCESS()
|
# define CHECK_SP_ACCESS()
|
||||||
|
@ -62,50 +61,50 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
|
# define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
|
||||||
# define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
|
# define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
|
||||||
# define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
|
# define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
|
||||||
# define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
|
# define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
|
||||||
# define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
|
# define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
|
||||||
# define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
|
# define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
|
||||||
# define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
|
# define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
|
||||||
# define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F)
|
# define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_CS_IP)
|
||||||
|
|
||||||
# define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
|
# define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
|
||||||
# define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
|
# define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
|
||||||
# define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
|
# define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
|
||||||
# define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
|
# define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
|
||||||
# define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
|
# define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
|
||||||
# define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F)
|
# define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F)
|
||||||
# define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F)
|
# define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F)
|
||||||
# define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F)
|
# define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F)
|
||||||
# define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
|
# define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
|
||||||
#else
|
#else
|
||||||
# define DEBUG_INSTRUMENT() 0
|
# define DEBUG_INSTRUMENT() 0
|
||||||
# define DEBUG_DECODE() 0
|
# define DEBUG_DECODE() 0
|
||||||
# define DEBUG_TRACE() 0
|
# define DEBUG_TRACE() 0
|
||||||
# define DEBUG_STEP() 0
|
# define DEBUG_STEP() 0
|
||||||
# define DEBUG_DISASSEMBLE() 0
|
# define DEBUG_DISASSEMBLE() 0
|
||||||
# define DEBUG_BREAK() 0
|
# define DEBUG_BREAK() 0
|
||||||
# define DEBUG_SVC() 0
|
# define DEBUG_SVC() 0
|
||||||
# define DEBUG_SAVE_IP_CS() 0
|
# define DEBUG_SAVE_IP_CS() 0
|
||||||
# define DEBUG_FS() 0
|
# define DEBUG_FS() 0
|
||||||
# define DEBUG_PROC() 0
|
# define DEBUG_PROC() 0
|
||||||
# define DEBUG_SYSINT() 0
|
# define DEBUG_SYSINT() 0
|
||||||
# define DEBUG_TRACECALL() 0
|
# define DEBUG_TRACECALL() 0
|
||||||
# define DEBUG_TRACECALLREGS() 0
|
# define DEBUG_TRACECALLREGS() 0
|
||||||
# define DEBUG_SYS() 0
|
# define DEBUG_SYS() 0
|
||||||
# define DEBUG_MEM_TRACE() 0
|
# define DEBUG_MEM_TRACE() 0
|
||||||
# define DEBUG_IO_TRACE() 0
|
# define DEBUG_IO_TRACE() 0
|
||||||
# define DEBUG_DECODE_NOPRINT() 0
|
# define DEBUG_DECODE_NOPRINT() 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
# define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
|
# define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
|
||||||
x86emu_decode_printf(x)
|
x86emu_decode_printf(x)
|
||||||
# define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
|
# define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
|
||||||
x86emu_decode_printf2(x,y)
|
x86emu_decode_printf2(x,y)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following allow us to look at the bytes of an instruction. The
|
* The following allow us to look at the bytes of an instruction. The
|
||||||
|
@ -113,16 +112,16 @@
|
||||||
* the decoding process. The SAVE_IP_CS is called initially when the
|
* the decoding process. The SAVE_IP_CS is called initially when the
|
||||||
* major opcode of the instruction is accessed.
|
* major opcode of the instruction is accessed.
|
||||||
*/
|
*/
|
||||||
#define INC_DECODED_INST_LEN(x) \
|
#define INC_DECODED_INST_LEN(x) \
|
||||||
if (DEBUG_DECODE()) \
|
if (DEBUG_DECODE()) \
|
||||||
x86emu_inc_decoded_inst_len(x)
|
x86emu_inc_decoded_inst_len(x)
|
||||||
|
|
||||||
#define SAVE_IP_CS(x,y) \
|
#define SAVE_IP_CS(x,y) \
|
||||||
if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \
|
if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \
|
||||||
| DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \
|
| DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \
|
||||||
M.x86.saved_cs = x; \
|
M.x86.saved_cs = x; \
|
||||||
M.x86.saved_ip = y; \
|
M.x86.saved_ip = y; \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define INC_DECODED_INST_LEN(x)
|
# define INC_DECODED_INST_LEN(x)
|
||||||
# define DECODE_PRINTF(x)
|
# define DECODE_PRINTF(x)
|
||||||
|
@ -131,30 +130,30 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define TRACE_REGS() \
|
#define TRACE_REGS() \
|
||||||
if (DEBUG_DISASSEMBLE()) { \
|
if (DEBUG_DISASSEMBLE()) { \
|
||||||
x86emu_just_disassemble(); \
|
x86emu_just_disassemble(); \
|
||||||
goto EndOfTheInstructionProcedure; \
|
goto EndOfTheInstructionProcedure; \
|
||||||
} \
|
} \
|
||||||
if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
|
if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
|
||||||
#else
|
#else
|
||||||
# define TRACE_REGS()
|
# define TRACE_REGS()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
|
# define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
|
||||||
#else
|
#else
|
||||||
# define SINGLE_STEP()
|
# define SINGLE_STEP()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TRACE_AND_STEP() \
|
#define TRACE_AND_STEP() \
|
||||||
TRACE_REGS(); \
|
TRACE_REGS(); \
|
||||||
SINGLE_STEP()
|
SINGLE_STEP()
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# define START_OF_INSTR()
|
# define START_OF_INSTR()
|
||||||
# define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
|
# define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
|
||||||
# define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
|
# define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
|
||||||
#else
|
#else
|
||||||
# define START_OF_INSTR()
|
# define START_OF_INSTR()
|
||||||
# define END_OF_INSTR()
|
# define END_OF_INSTR()
|
||||||
|
@ -163,30 +162,30 @@
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# define CALL_TRACE(u,v,w,x,s) \
|
# define CALL_TRACE(u,v,w,x,s) \
|
||||||
if (DEBUG_TRACECALLREGS()) \
|
if (DEBUG_TRACECALLREGS()) \
|
||||||
x86emu_dump_regs(); \
|
x86emu_dump_regs(); \
|
||||||
if (DEBUG_TRACECALL()) \
|
if (DEBUG_TRACECALL()) \
|
||||||
printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
|
printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
|
||||||
# define RETURN_TRACE(n,u,v) \
|
# define RETURN_TRACE(n,u,v) \
|
||||||
if (DEBUG_TRACECALLREGS()) \
|
if (DEBUG_TRACECALLREGS()) \
|
||||||
x86emu_dump_regs(); \
|
x86emu_dump_regs(); \
|
||||||
if (DEBUG_TRACECALL()) \
|
if (DEBUG_TRACECALL()) \
|
||||||
printk("%04x:%04x: %s\n",u,v,n);
|
printk("%04x:%04x: %s\n",u,v,n);
|
||||||
#else
|
#else
|
||||||
# define CALL_TRACE(u,v,w,x,s)
|
# define CALL_TRACE(u,v,w,x,s)
|
||||||
# define RETURN_TRACE(n,u,v)
|
# define RETURN_TRACE(n,u,v)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define DB(x) x
|
#define DB(x) x
|
||||||
#else
|
#else
|
||||||
#define DB(x)
|
#define DB(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-------------------------- Function Prototypes --------------------------*/
|
/*-------------------------- Function Prototypes --------------------------*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void x86emu_inc_decoded_inst_len (int x);
|
extern void x86emu_inc_decoded_inst_len (int x);
|
||||||
|
@ -205,7 +204,7 @@ extern void x86emu_check_mem_access (u32 p);
|
||||||
extern void x86emu_check_data_access (uint s, uint o);
|
extern void x86emu_check_data_access (uint s, uint o);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* End of "C" linkage for C++ */
|
} /* End of "C" linkage for C++ */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __X86EMU_DEBUG_H */
|
#endif /* __X86EMU_DEBUG_H */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Realmode X86 Emulator Library
|
* Realmode X86 Emulator Library
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||||
* Copyright (C) David Mosberger-Tang
|
* Copyright (C) David Mosberger-Tang
|
||||||
* Copyright (C) 1999 Egbert Eich
|
* Copyright (C) 1999 Egbert Eich
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Language: ANSI C
|
* Language: ANSI C
|
||||||
* Environment: Any
|
* Environment: Any
|
||||||
* Developer: Kendall Bennett
|
* Developer: Kendall Bennett
|
||||||
*
|
*
|
||||||
* Description: Header file for instruction decoding logic.
|
* Description: Header file for instruction decoding logic.
|
||||||
|
@ -43,19 +43,19 @@
|
||||||
|
|
||||||
/* Instruction Decoding Stuff */
|
/* Instruction Decoding Stuff */
|
||||||
|
|
||||||
#define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&mod,&rh,&rl)
|
#define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&mod,&rh,&rl)
|
||||||
#define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register(r)
|
#define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register(r)
|
||||||
#define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register(r)
|
#define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register(r)
|
||||||
#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r)
|
#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r)
|
||||||
#define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK
|
#define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK
|
||||||
|
|
||||||
/*-------------------------- Function Prototypes --------------------------*/
|
/*-------------------------- Function Prototypes --------------------------*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void x86emu_intr_raise (u8 type);
|
void x86emu_intr_raise (u8 type);
|
||||||
void fetch_decode_modrm (int *mod,int *regh,int *regl);
|
void fetch_decode_modrm (int *mod,int *regh,int *regl);
|
||||||
u8 fetch_byte_imm (void);
|
u8 fetch_byte_imm (void);
|
||||||
u16 fetch_word_imm (void);
|
u16 fetch_word_imm (void);
|
||||||
|
@ -72,16 +72,17 @@ void store_data_word (uint offset, u16 val);
|
||||||
void store_data_word_abs (uint segment, uint offset, u16 val);
|
void store_data_word_abs (uint segment, uint offset, u16 val);
|
||||||
void store_data_long (uint offset, u32 val);
|
void store_data_long (uint offset, u32 val);
|
||||||
void store_data_long_abs (uint segment, uint offset, u32 val);
|
void store_data_long_abs (uint segment, uint offset, u32 val);
|
||||||
u8* decode_rm_byte_register(int reg);
|
u8* decode_rm_byte_register(int reg);
|
||||||
u16* decode_rm_word_register(int reg);
|
u16* decode_rm_word_register(int reg);
|
||||||
u32* decode_rm_long_register(int reg);
|
u32* decode_rm_long_register(int reg);
|
||||||
u16* decode_rm_seg_register(int reg);
|
u16* decode_rm_seg_register(int reg);
|
||||||
unsigned decode_rm00_address(int rm);
|
unsigned decode_rm00_address(int rm);
|
||||||
unsigned decode_rm01_address(int rm);
|
unsigned decode_rm01_address(int rm);
|
||||||
unsigned decode_rm10_address(int rm);
|
unsigned decode_rm10_address(int rm);
|
||||||
|
unsigned decode_rmXX_address(int mod, int rm);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* End of "C" linkage for C++ */
|
} /* End of "C" linkage for C++ */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __X86EMU_DECODE_H */
|
#endif /* __X86EMU_DECODE_H */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Realmode X86 Emulator Library
|
* Realmode X86 Emulator Library
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||||
* Copyright (C) David Mosberger-Tang
|
* Copyright (C) David Mosberger-Tang
|
||||||
* Copyright (C) 1999 Egbert Eich
|
* Copyright (C) 1999 Egbert Eich
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Language: ANSI C
|
* Language: ANSI C
|
||||||
* Environment: Any
|
* Environment: Any
|
||||||
* Developer: Kendall Bennett
|
* Developer: Kendall Bennett
|
||||||
*
|
*
|
||||||
* Description: Header file for FPU instruction decoding.
|
* Description: Header file for FPU instruction decoding.
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
#define __X86EMU_FPU_H
|
#define __X86EMU_FPU_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* these have to be defined, whether 8087 support compiled in or not. */
|
/* these have to be defined, whether 8087 support compiled in or not. */
|
||||||
|
@ -55,7 +55,7 @@ extern void x86emuOp_esc_coprocess_de (u8 op1);
|
||||||
extern void x86emuOp_esc_coprocess_df (u8 op1);
|
extern void x86emuOp_esc_coprocess_df (u8 op1);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* End of "C" linkage for C++ */
|
} /* End of "C" linkage for C++ */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __X86EMU_FPU_H */
|
#endif /* __X86EMU_FPU_H */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Realmode X86 Emulator Library
|
* Realmode X86 Emulator Library
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||||
* Copyright (C) David Mosberger-Tang
|
* Copyright (C) David Mosberger-Tang
|
||||||
* Copyright (C) 1999 Egbert Eich
|
* Copyright (C) 1999 Egbert Eich
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Language: ANSI C
|
* Language: ANSI C
|
||||||
* Environment: Any
|
* Environment: Any
|
||||||
* Developer: Kendall Bennett
|
* Developer: Kendall Bennett
|
||||||
*
|
*
|
||||||
* Description: Header file for operand decoding functions.
|
* Description: Header file for operand decoding functions.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,10 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Realmode X86 Emulator Library
|
* Realmode X86 Emulator Library
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||||
* Copyright (C) David Mosberger-Tang
|
* Copyright (C) David Mosberger-Tang
|
||||||
* Copyright (C) 1999 Egbert Eich
|
* Copyright (C) 1999 Egbert Eich
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Language: ANSI C
|
* Language: ANSI C
|
||||||
* Environment: Any
|
* Environment: Any
|
||||||
* Developer: Kendall Bennett
|
* Developer: Kendall Bennett
|
||||||
*
|
*
|
||||||
* Description: Header file for primitive operation functions.
|
* Description: Header file for primitive operation functions.
|
||||||
|
@ -39,10 +39,8 @@
|
||||||
#ifndef __X86EMU_PRIM_OPS_H
|
#ifndef __X86EMU_PRIM_OPS_H
|
||||||
#define __X86EMU_PRIM_OPS_H
|
#define __X86EMU_PRIM_OPS_H
|
||||||
|
|
||||||
#include "x86emu/prim_asm.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u16 aaa_word (u16 d);
|
u16 aaa_word (u16 d);
|
||||||
|
@ -118,7 +116,7 @@ u32 xor_long (u32 d, u32 s);
|
||||||
void imul_byte (u8 s);
|
void imul_byte (u8 s);
|
||||||
void imul_word (u16 s);
|
void imul_word (u16 s);
|
||||||
void imul_long (u32 s);
|
void imul_long (u32 s);
|
||||||
void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s);
|
void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s);
|
||||||
void mul_byte (u8 s);
|
void mul_byte (u8 s);
|
||||||
void mul_word (u16 s);
|
void mul_word (u16 s);
|
||||||
void mul_long (u32 s);
|
void mul_long (u32 s);
|
||||||
|
@ -134,98 +132,11 @@ u16 mem_access_word (int addr);
|
||||||
void push_word (u16 w);
|
void push_word (u16 w);
|
||||||
void push_long (u32 w);
|
void push_long (u32 w);
|
||||||
u16 pop_word (void);
|
u16 pop_word (void);
|
||||||
u32 pop_long (void);
|
u32 pop_long (void);
|
||||||
|
|
||||||
#if defined(__HAVE_INLINE_ASSEMBLER__) && !defined(PRIM_OPS_NO_REDEFINE_ASM)
|
|
||||||
|
|
||||||
#define aaa_word(d) aaa_word_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define aas_word(d) aas_word_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define aad_word(d) aad_word_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define aam_word(d) aam_word_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define adc_byte(d,s) adc_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define adc_word(d,s) adc_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define adc_long(d,s) adc_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define add_byte(d,s) add_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define add_word(d,s) add_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define add_long(d,s) add_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define and_byte(d,s) and_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define and_word(d,s) and_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define and_long(d,s) and_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define cmp_byte(d,s) cmp_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define cmp_word(d,s) cmp_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define cmp_long(d,s) cmp_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define daa_byte(d) daa_byte_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define das_byte(d) das_byte_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define dec_byte(d) dec_byte_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define dec_word(d) dec_word_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define dec_long(d) dec_long_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define inc_byte(d) inc_byte_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define inc_word(d) inc_word_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define inc_long(d) inc_long_asm(&M.x86.R_EFLG,d)
|
|
||||||
#define or_byte(d,s) or_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define or_word(d,s) or_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define or_long(d,s) or_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define neg_byte(s) neg_byte_asm(&M.x86.R_EFLG,s)
|
|
||||||
#define neg_word(s) neg_word_asm(&M.x86.R_EFLG,s)
|
|
||||||
#define neg_long(s) neg_long_asm(&M.x86.R_EFLG,s)
|
|
||||||
#define not_byte(s) not_byte_asm(&M.x86.R_EFLG,s)
|
|
||||||
#define not_word(s) not_word_asm(&M.x86.R_EFLG,s)
|
|
||||||
#define not_long(s) not_long_asm(&M.x86.R_EFLG,s)
|
|
||||||
#define rcl_byte(d,s) rcl_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define rcl_word(d,s) rcl_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define rcl_long(d,s) rcl_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define rcr_byte(d,s) rcr_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define rcr_word(d,s) rcr_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define rcr_long(d,s) rcr_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define rol_byte(d,s) rol_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define rol_word(d,s) rol_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define rol_long(d,s) rol_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define ror_byte(d,s) ror_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define ror_word(d,s) ror_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define ror_long(d,s) ror_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define shl_byte(d,s) shl_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define shl_word(d,s) shl_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define shl_long(d,s) shl_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define shr_byte(d,s) shr_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define shr_word(d,s) shr_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define shr_long(d,s) shr_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define sar_byte(d,s) sar_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define sar_word(d,s) sar_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define sar_long(d,s) sar_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define shld_word(d,fill,s) shld_word_asm(&M.x86.R_EFLG,d,fill,s)
|
|
||||||
#define shld_long(d,fill,s) shld_long_asm(&M.x86.R_EFLG,d,fill,s)
|
|
||||||
#define shrd_word(d,fill,s) shrd_word_asm(&M.x86.R_EFLG,d,fill,s)
|
|
||||||
#define shrd_long(d,fill,s) shrd_long_asm(&M.x86.R_EFLG,d,fill,s)
|
|
||||||
#define sbb_byte(d,s) sbb_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define sbb_word(d,s) sbb_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define sbb_long(d,s) sbb_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define sub_byte(d,s) sub_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define sub_word(d,s) sub_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define sub_long(d,s) sub_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define test_byte(d,s) test_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define test_word(d,s) test_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define test_long(d,s) test_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define xor_byte(d,s) xor_byte_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define xor_word(d,s) xor_word_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define xor_long(d,s) xor_long_asm(&M.x86.R_EFLG,d,s)
|
|
||||||
#define imul_byte(s) imul_byte_asm(&M.x86.R_EFLG,&M.x86.R_AX,M.x86.R_AL,s)
|
|
||||||
#define imul_word(s) imul_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,s)
|
|
||||||
#define imul_long(s) imul_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s)
|
|
||||||
#define imul_long_direct(res_lo,res_hi,d,s) imul_long_asm(&M.x86.R_EFLG,res_lo,res_hi,d,s)
|
|
||||||
#define mul_byte(s) mul_byte_asm(&M.x86.R_EFLG,&M.x86.R_AX,M.x86.R_AL,s)
|
|
||||||
#define mul_word(s) mul_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,s)
|
|
||||||
#define mul_long(s) mul_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s)
|
|
||||||
#define idiv_byte(s) idiv_byte_asm(&M.x86.R_EFLG,&M.x86.R_AL,&M.x86.R_AH,M.x86.R_AX,s)
|
|
||||||
#define idiv_word(s) idiv_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,M.x86.R_DX,s)
|
|
||||||
#define idiv_long(s) idiv_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,M.x86.R_EDX,s)
|
|
||||||
#define div_byte(s) div_byte_asm(&M.x86.R_EFLG,&M.x86.R_AL,&M.x86.R_AH,M.x86.R_AX,s)
|
|
||||||
#define div_word(s) div_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,M.x86.R_DX,s)
|
|
||||||
#define div_long(s) div_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,M.x86.R_EDX,s)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* End of "C" linkage for C++ */
|
} /* End of "C" linkage for C++ */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __X86EMU_PRIM_OPS_H */
|
#endif /* __X86EMU_PRIM_OPS_H */
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Realmode X86 Emulator Library
|
* Realmode X86 Emulator Library
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||||
* Copyright (C) David Mosberger-Tang
|
* Copyright (C) David Mosberger-Tang
|
||||||
* Copyright (C) 1999 Egbert Eich
|
* Copyright (C) 1999 Egbert Eich
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
|
@ -28,18 +28,16 @@
|
||||||
*
|
*
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
*
|
*
|
||||||
* Language: ANSI C
|
* Language: ANSI C
|
||||||
* Environment: Any
|
* Environment: Any
|
||||||
* Developer: Kendall Bennett
|
* Developer: Kendall Bennett
|
||||||
*
|
*
|
||||||
* Description: Header file for system specific functions. These functions
|
* Description: Header file for system specific functions. These functions
|
||||||
* are always compiled and linked in the OS depedent libraries,
|
* are always compiled and linked in the OS depedent libraries,
|
||||||
* and never in a binary portable driver.
|
* and never in a binary portable driver.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/x86emui.h,v 1.4 2001/04/01 13:59:58 tsi Exp $ */
|
|
||||||
|
|
||||||
#ifndef __X86EMU_X86EMUI_H
|
#ifndef __X86EMU_X86EMUI_H
|
||||||
#define __X86EMU_X86EMUI_H
|
#define __X86EMU_X86EMUI_H
|
||||||
|
|
||||||
|
@ -48,18 +46,18 @@
|
||||||
* dramatically in this case).
|
* dramatically in this case).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(_NO_INLINE)
|
#if defined(__cplusplus) && !defined(_NO_INLINE)
|
||||||
#define _INLINE inline
|
#define _INLINE inline
|
||||||
#else
|
#else
|
||||||
#define _INLINE static
|
#define _INLINE static
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Get rid of unused parameters in C++ compilation mode */
|
/* Get rid of unused parameters in C++ compilation mode */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define X86EMU_UNUSED(v)
|
#define X86EMU_UNUSED(v)
|
||||||
#else
|
#else
|
||||||
#define X86EMU_UNUSED(v) v
|
#define X86EMU_UNUSED(v) v
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "x86emu.h"
|
#include "x86emu.h"
|
||||||
|
@ -70,36 +68,34 @@
|
||||||
#include "x86emu/prim_ops.h"
|
#include "x86emu/prim_ops.h"
|
||||||
#include "x86emu/fpu.h"
|
#include "x86emu/fpu.h"
|
||||||
#include "x86emu/fpu_regs.h"
|
#include "x86emu/fpu_regs.h"
|
||||||
|
#ifndef __KERNEL__
|
||||||
#ifdef IN_MODULE
|
|
||||||
#include <xf86_ansic.h>
|
|
||||||
#else
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------------- Inline Functions ----------------------------*/
|
/*--------------------------- Inline Functions ----------------------------*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern u8 (X86APIP sys_rdb)(u32 addr);
|
extern u8 (X86APIP sys_rdb)(u32 addr);
|
||||||
extern u16 (X86APIP sys_rdw)(u32 addr);
|
extern u16 (X86APIP sys_rdw)(u32 addr);
|
||||||
extern u32 (X86APIP sys_rdl)(u32 addr);
|
extern u32 (X86APIP sys_rdl)(u32 addr);
|
||||||
extern void (X86APIP sys_wrb)(u32 addr,u8 val);
|
extern void (X86APIP sys_wrb)(u32 addr,u8 val);
|
||||||
extern void (X86APIP sys_wrw)(u32 addr,u16 val);
|
extern void (X86APIP sys_wrw)(u32 addr,u16 val);
|
||||||
extern void (X86APIP sys_wrl)(u32 addr,u32 val);
|
extern void (X86APIP sys_wrl)(u32 addr,u32 val);
|
||||||
|
|
||||||
extern u8 (X86APIP sys_inb)(X86EMU_pioAddr addr);
|
extern u8 (X86APIP sys_inb)(X86EMU_pioAddr addr);
|
||||||
extern u16 (X86APIP sys_inw)(X86EMU_pioAddr addr);
|
extern u16 (X86APIP sys_inw)(X86EMU_pioAddr addr);
|
||||||
extern u32 (X86APIP sys_inl)(X86EMU_pioAddr addr);
|
extern u32 (X86APIP sys_inl)(X86EMU_pioAddr addr);
|
||||||
extern void (X86APIP sys_outb)(X86EMU_pioAddr addr,u8 val);
|
extern void (X86APIP sys_outb)(X86EMU_pioAddr addr,u8 val);
|
||||||
extern void (X86APIP sys_outw)(X86EMU_pioAddr addr,u16 val);
|
extern void (X86APIP sys_outw)(X86EMU_pioAddr addr,u16 val);
|
||||||
extern void (X86APIP sys_outl)(X86EMU_pioAddr addr,u32 val);
|
extern void (X86APIP sys_outl)(X86EMU_pioAddr addr,u32 val);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* End of "C" linkage for C++ */
|
} /* End of "C" linkage for C++ */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __X86EMU_X86EMUI_H */
|
#endif /* __X86EMU_X86EMUI_H */
|
||||||
|
|
Loading…
Reference in New Issue