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_IP = MEM_RW(num << 2);
|
||||
|
||||
//printf("%s: INT %x CS:IP = %x:%x\n", __FUNCTION__,
|
||||
// num, MEM_RW((num << 2) + 2), MEM_RW(num << 2));
|
||||
printf("%s: INT %x CS:IP = %x:%x\n", __FUNCTION__,
|
||||
num, MEM_RW((num << 2) + 2), MEM_RW(num << 2));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ u8 x_inb(u16 port)
|
|||
|
||||
val = inb(port);
|
||||
|
||||
//printf("inb(0x%04x) = 0x%02x\n", port, val);
|
||||
printf("inb(0x%04x) = 0x%02x\n", port, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ u16 x_inw(u16 port)
|
|||
|
||||
val = inw(port);
|
||||
|
||||
//printf("inw(0x%04x) = 0x%04x\n", port, val);
|
||||
printf("inw(0x%04x) = 0x%04x\n", port, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -149,25 +149,26 @@ u32 x_inl(u16 port)
|
|||
|
||||
val = inl(port);
|
||||
|
||||
//printf("inl(0x%04x) = 0x%08x\n", port, val);
|
||||
printf("inl(0x%04x) = 0x%08x\n", port, val);
|
||||
return 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ extern int verbose;
|
|||
*/
|
||||
int int42_handler()
|
||||
{
|
||||
|
||||
#if 0
|
||||
if (verbose && X86_AH != 0x0e) {
|
||||
printf("int%x\n", current->num);
|
||||
x86emu_dump_xregs();
|
||||
|
@ -472,7 +472,7 @@ int int42_handler()
|
|||
/* Ignored */
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,7 @@ void x86emu_dump_xregs();
|
|||
int int15_handler(void)
|
||||
{
|
||||
printf("\nint15 encountered.\n");
|
||||
x86emu_dump_xregs();
|
||||
//x86emu_dump_xregs();
|
||||
X86_EAX = 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ int int1A_handler()
|
|||
|
||||
if (verbose) {
|
||||
printf("\nint1a encountered.\n");
|
||||
x86emu_dump_xregs();
|
||||
//x86emu_dump_xregs();
|
||||
}
|
||||
|
||||
switch (X86_AX) {
|
||||
|
|
|
@ -44,7 +44,7 @@ PCITAG findPci(unsigned short bx)
|
|||
tag->slot = slot;
|
||||
tag->func = func;
|
||||
|
||||
if (pci_get_dev(pacc, bus, slot, func))
|
||||
if (pci_get_dev(pacc, 0, bus, slot, func))
|
||||
return tag;
|
||||
|
||||
return NULL;
|
||||
|
@ -58,7 +58,7 @@ u32 pciSlotBX(PCITAG tag)
|
|||
u8 pciReadByte(PCITAG tag, u32 idx)
|
||||
{
|
||||
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);
|
||||
#ifdef DEBUG_PCI
|
||||
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)
|
||||
{
|
||||
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);
|
||||
#ifdef DEBUG_PCI
|
||||
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)
|
||||
{
|
||||
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);
|
||||
#ifdef DEBUG_PCI
|
||||
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)
|
||||
{
|
||||
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);
|
||||
#ifdef DEBUG_PCI
|
||||
else
|
||||
|
@ -107,7 +107,7 @@ void pciWriteLong(PCITAG tag, u32 idx, u32 data)
|
|||
void pciWriteWord(PCITAG tag, u32 idx, u16 data)
|
||||
{
|
||||
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);
|
||||
#ifdef DEBUG_PCI
|
||||
else
|
||||
|
@ -120,7 +120,7 @@ void pciWriteWord(PCITAG tag, u32 idx, u16 data)
|
|||
void pciWriteByte(PCITAG tag, u32 idx, u8 data)
|
||||
{
|
||||
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);
|
||||
#ifdef DEBUG_PCI
|
||||
else
|
||||
|
|
|
@ -76,7 +76,7 @@ void do_int(int num)
|
|||
|
||||
if (!ret) {
|
||||
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) {
|
||||
printf("Switching to single step mode.\n");
|
||||
X86EMU_trace_on();
|
||||
//X86EMU_trace_on();
|
||||
}
|
||||
if (debugflag) {
|
||||
X86EMU_set_debug(debugflag);
|
||||
//X86EMU_set_debug(debugflag);
|
||||
}
|
||||
X86EMU_exec();
|
||||
/* Cleaning up */
|
||||
|
|
|
@ -181,6 +181,8 @@ void X86EMU_halt_sys(void);
|
|||
#define DEBUG_TRACECALL_REGS_F 0x004000
|
||||
#define DEBUG_DECODE_NOPRINT_F 0x008000
|
||||
#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)
|
||||
|
||||
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) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
|
@ -28,444 +28,398 @@
|
|||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* 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"
|
||||
#ifdef IN_MODULE
|
||||
#include "xf86_ansic.h"
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/*----------------------------- Implementation ----------------------------*/
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
static void print_encoded_bytes(u16 s, u16 o);
|
||||
static void print_decoded_instruction(void);
|
||||
static int parse_line(char *s, int *ps, int *n);
|
||||
static void print_encoded_bytes (u16 s, u16 o);
|
||||
static void print_decoded_instruction (void);
|
||||
static int parse_line (char *s, int *ps, int *n);
|
||||
|
||||
/* should look something like debug's output. */
|
||||
void X86EMU_trace_regs(void)
|
||||
void X86EMU_trace_regs (void)
|
||||
{
|
||||
if (DEBUG_TRACE()) {
|
||||
x86emu_dump_regs();
|
||||
}
|
||||
if (DEBUG_DECODE() && !DEBUG_DECODE_NOPRINT()) {
|
||||
printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
|
||||
print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
|
||||
print_decoded_instruction();
|
||||
}
|
||||
if (DEBUG_TRACE()) {
|
||||
x86emu_dump_regs();
|
||||
}
|
||||
if (DEBUG_DECODE() && ! DEBUG_DECODE_NOPRINT()) {
|
||||
printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
|
||||
print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
|
||||
print_decoded_instruction();
|
||||
}
|
||||
}
|
||||
|
||||
void X86EMU_trace_xregs(void)
|
||||
void X86EMU_trace_xregs (void)
|
||||
{
|
||||
if (DEBUG_TRACE()) {
|
||||
x86emu_dump_xregs();
|
||||
}
|
||||
if (DEBUG_TRACE()) {
|
||||
x86emu_dump_xregs();
|
||||
}
|
||||
}
|
||||
|
||||
void x86emu_just_disassemble(void)
|
||||
void x86emu_just_disassemble (void)
|
||||
{
|
||||
/*
|
||||
* This routine called if the flag DEBUG_DISASSEMBLE is set kind
|
||||
* of a hack!
|
||||
*/
|
||||
printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
|
||||
print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
|
||||
print_decoded_instruction();
|
||||
/*
|
||||
* This routine called if the flag DEBUG_DISASSEMBLE is set kind
|
||||
* of a hack!
|
||||
*/
|
||||
printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
|
||||
print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
|
||||
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;
|
||||
int i;
|
||||
u8 op1;
|
||||
/*
|
||||
* hack, hack, hack. What we do is use the exact machinery set up
|
||||
* for execution, except that now there is an additional state
|
||||
* flag associated with the "execution", and we are using a copy
|
||||
* of the register struct. All the major opcodes, once fully
|
||||
* decoded, have the following two steps: TRACE_REGS(r,m);
|
||||
* SINGLE_STEP(r,m); which disappear if DEBUG is not defined to
|
||||
* the preprocessor. The TRACE_REGS macro expands to:
|
||||
*
|
||||
* if (debug&DEBUG_DISASSEMBLE)
|
||||
* {just_disassemble(); goto EndOfInstruction;}
|
||||
* if (debug&DEBUG_TRACE) trace_regs(r,m);
|
||||
*
|
||||
* ...... and at the last line of the routine.
|
||||
*
|
||||
* EndOfInstruction: end_instr();
|
||||
*
|
||||
* Up to the point where TRACE_REG is expanded, NO modifications
|
||||
* are done to any register EXCEPT the IP register, for fetch and
|
||||
* decoding purposes.
|
||||
*
|
||||
* This was done for an entirely different reason, but makes a
|
||||
* nice way to get the system to help debug codes.
|
||||
*/
|
||||
tregs = M;
|
||||
tregs.x86.R_IP = off;
|
||||
tregs.x86.R_CS = seg;
|
||||
X86EMU_sysEnv tregs;
|
||||
int i;
|
||||
u8 op1;
|
||||
/*
|
||||
* hack, hack, hack. What we do is use the exact machinery set up
|
||||
* for execution, except that now there is an additional state
|
||||
* flag associated with the "execution", and we are using a copy
|
||||
* of the register struct. All the major opcodes, once fully
|
||||
* decoded, have the following two steps: TRACE_REGS(r,m);
|
||||
* SINGLE_STEP(r,m); which disappear if DEBUG is not defined to
|
||||
* the preprocessor. The TRACE_REGS macro expands to:
|
||||
*
|
||||
* if (debug&DEBUG_DISASSEMBLE)
|
||||
* {just_disassemble(); goto EndOfInstruction;}
|
||||
* if (debug&DEBUG_TRACE) trace_regs(r,m);
|
||||
*
|
||||
* ...... and at the last line of the routine.
|
||||
*
|
||||
* EndOfInstruction: end_instr();
|
||||
*
|
||||
* Up to the point where TRACE_REG is expanded, NO modifications
|
||||
* are done to any register EXCEPT the IP register, for fetch and
|
||||
* decoding purposes.
|
||||
*
|
||||
* This was done for an entirely different reason, but makes a
|
||||
* nice way to get the system to help debug codes.
|
||||
*/
|
||||
tregs = M;
|
||||
tregs.x86.R_IP = off;
|
||||
tregs.x86.R_CS = seg;
|
||||
|
||||
/* reset the decoding buffers */
|
||||
tregs.x86.enc_str_pos = 0;
|
||||
tregs.x86.enc_pos = 0;
|
||||
/* reset the decoding buffers */
|
||||
tregs.x86.enc_str_pos = 0;
|
||||
tregs.x86.enc_pos = 0;
|
||||
|
||||
/* turn on the "disassemble only, no execute" flag */
|
||||
tregs.x86.debug |= DEBUG_DISASSEMBLE_F;
|
||||
/* turn on the "disassemble only, no execute" flag */
|
||||
tregs.x86.debug |= DEBUG_DISASSEMBLE_F;
|
||||
|
||||
/* DUMP NEXT n instructions to screen in straight_line fashion */
|
||||
/*
|
||||
* This looks like the regular instruction fetch stream, except
|
||||
* that when this occurs, each fetched opcode, upon seeing the
|
||||
* DEBUG_DISASSEMBLE flag set, exits immediately after decoding
|
||||
* the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!!
|
||||
* Note the use of a copy of the register structure...
|
||||
*/
|
||||
for (i = 0; i < n; i++) {
|
||||
op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
|
||||
(x86emu_optab[op1]) (op1);
|
||||
}
|
||||
/* end major hack mode. */
|
||||
/* DUMP NEXT n instructions to screen in straight_line fashion */
|
||||
/*
|
||||
* This looks like the regular instruction fetch stream, except
|
||||
* that when this occurs, each fetched opcode, upon seeing the
|
||||
* DEBUG_DISASSEMBLE flag set, exits immediately after decoding
|
||||
* the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!!
|
||||
* Note the use of a copy of the register structure...
|
||||
*/
|
||||
for (i=0; i<n; i++) {
|
||||
op1 = (*sys_rdb)(((u32)M.x86.R_CS<<4) + (M.x86.R_IP++));
|
||||
(x86emu_optab[op1])(op1);
|
||||
}
|
||||
/* 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);
|
||||
M.x86.enc_str_pos += strlen(x);
|
||||
sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",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];
|
||||
sprintf(temp, x, y);
|
||||
sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", temp);
|
||||
M.x86.enc_str_pos += strlen(temp);
|
||||
char temp[100];
|
||||
sprintf(temp,x,y);
|
||||
sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",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_pos = 0;
|
||||
M.x86.enc_str_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;
|
||||
char buf1[64];
|
||||
for (i = 0; i < M.x86.enc_pos; i++) {
|
||||
sprintf(buf1 + 2 * i, "%02x", fetch_data_byte_abs(s, o + i));
|
||||
}
|
||||
printk("%-20s", buf1);
|
||||
int i;
|
||||
char buf1[64];
|
||||
for (i=0; i< M.x86.enc_pos; i++) {
|
||||
sprintf(buf1+2*i,"%02x", fetch_data_byte_abs(s,o+i));
|
||||
}
|
||||
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)
|
||||
return;
|
||||
seg = fetch_data_word_abs(0, iv * 4);
|
||||
off = fetch_data_word_abs(0, iv * 4 + 2);
|
||||
printk("%04x:%04x ", seg, off);
|
||||
if (iv > 256) return;
|
||||
seg = fetch_data_word_abs(0,iv*4);
|
||||
off = fetch_data_word_abs(0,iv*4+2);
|
||||
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 end = (off + 16) & 0xfffffff0;
|
||||
u32 i;
|
||||
u32 current;
|
||||
u32 start = off & 0xfffffff0;
|
||||
u32 end = (off+16) & 0xfffffff0;
|
||||
u32 i;
|
||||
u32 current;
|
||||
|
||||
current = start;
|
||||
while (end <= off + amt) {
|
||||
printk("%04x:%04x ", seg, start);
|
||||
for (i = start; i < off; i++)
|
||||
printk(" ");
|
||||
for (; i < end; i++)
|
||||
printk("%02x ", fetch_data_byte_abs(seg, i));
|
||||
printk("\n");
|
||||
start = end;
|
||||
end = start + 16;
|
||||
}
|
||||
current = start;
|
||||
while (end <= off + amt) {
|
||||
printk("%04x:%04x ", seg, start);
|
||||
for (i=start; i< off; i++)
|
||||
printk(" ");
|
||||
for ( ; i< end; i++)
|
||||
printk("%02x ", fetch_data_byte_abs(seg,i));
|
||||
printk("\n");
|
||||
start = end;
|
||||
end = start + 16;
|
||||
}
|
||||
}
|
||||
|
||||
void x86emu_single_step(void)
|
||||
void x86emu_single_step (void)
|
||||
{
|
||||
char s[1024];
|
||||
int ps[10];
|
||||
int ntok;
|
||||
int cmd;
|
||||
int done;
|
||||
int segment;
|
||||
int offset;
|
||||
static int breakpoint;
|
||||
static int noDecode = 1;
|
||||
char s[1024];
|
||||
int ps[10];
|
||||
int ntok;
|
||||
int cmd;
|
||||
int done;
|
||||
int segment;
|
||||
int offset;
|
||||
static int breakpoint;
|
||||
static int noDecode = 1;
|
||||
|
||||
char *p;
|
||||
char *p;
|
||||
|
||||
if (DEBUG_BREAK()) {
|
||||
if (M.x86.saved_ip != breakpoint) {
|
||||
return;
|
||||
} else {
|
||||
M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
|
||||
M.x86.debug |= DEBUG_TRACE_F;
|
||||
M.x86.debug &= ~DEBUG_BREAK_F;
|
||||
print_decoded_instruction();
|
||||
X86EMU_trace_regs();
|
||||
}
|
||||
}
|
||||
done = 0;
|
||||
offset = M.x86.saved_ip;
|
||||
while (!done) {
|
||||
printk("%x:%x -", M.x86.saved_cs, offset);
|
||||
p = fgets(s, 1023, stdin);
|
||||
cmd = parse_line(s, ps, &ntok);
|
||||
switch (cmd) {
|
||||
case 'u':
|
||||
disassemble_forward(M.x86.saved_cs, (u16) offset, 10);
|
||||
break;
|
||||
case 'd':
|
||||
if (ntok == 2) {
|
||||
segment = M.x86.saved_cs;
|
||||
offset = ps[1];
|
||||
X86EMU_dump_memory(segment, (u16) offset, 16);
|
||||
offset += 16;
|
||||
} else if (ntok == 3) {
|
||||
segment = ps[1];
|
||||
offset = ps[2];
|
||||
X86EMU_dump_memory(segment, (u16) offset, 16);
|
||||
offset += 16;
|
||||
} else {
|
||||
segment = M.x86.saved_cs;
|
||||
X86EMU_dump_memory(segment, (u16) offset, 16);
|
||||
offset += 16;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
M.x86.debug ^= DEBUG_TRACECALL_F;
|
||||
break;
|
||||
case 's':
|
||||
M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
|
||||
break;
|
||||
case 'r':
|
||||
X86EMU_trace_regs();
|
||||
break;
|
||||
case 'x':
|
||||
X86EMU_trace_xregs();
|
||||
break;
|
||||
case 'g':
|
||||
if (ntok == 2) {
|
||||
breakpoint = ps[1];
|
||||
if (noDecode) {
|
||||
M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
|
||||
} else {
|
||||
M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
|
||||
}
|
||||
M.x86.debug &= ~DEBUG_TRACE_F;
|
||||
M.x86.debug |= DEBUG_BREAK_F;
|
||||
done = 1;
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
exit(1);
|
||||
case 'P':
|
||||
noDecode = (noDecode) ? 0 : 1;
|
||||
printk("Toggled decoding to %s\n", (noDecode) ? "FALSE" : "TRUE");
|
||||
break;
|
||||
case 't':
|
||||
case 0:
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (DEBUG_BREAK()) {
|
||||
if (M.x86.saved_ip != breakpoint) {
|
||||
return;
|
||||
} else {
|
||||
M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
|
||||
M.x86.debug |= DEBUG_TRACE_F;
|
||||
M.x86.debug &= ~DEBUG_BREAK_F;
|
||||
print_decoded_instruction ();
|
||||
X86EMU_trace_regs();
|
||||
}
|
||||
}
|
||||
done=0;
|
||||
offset = M.x86.saved_ip;
|
||||
while (!done) {
|
||||
printk("-");
|
||||
p = fgets(s, 1023, stdin);
|
||||
cmd = parse_line(s, ps, &ntok);
|
||||
switch(cmd) {
|
||||
case 'u':
|
||||
disassemble_forward(M.x86.saved_cs,(u16)offset,10);
|
||||
break;
|
||||
case 'd':
|
||||
if (ntok == 2) {
|
||||
segment = M.x86.saved_cs;
|
||||
offset = ps[1];
|
||||
X86EMU_dump_memory(segment,(u16)offset,16);
|
||||
offset += 16;
|
||||
} else if (ntok == 3) {
|
||||
segment = ps[1];
|
||||
offset = ps[2];
|
||||
X86EMU_dump_memory(segment,(u16)offset,16);
|
||||
offset += 16;
|
||||
} else {
|
||||
segment = M.x86.saved_cs;
|
||||
X86EMU_dump_memory(segment,(u16)offset,16);
|
||||
offset += 16;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
M.x86.debug ^= DEBUG_TRACECALL_F;
|
||||
break;
|
||||
case 's':
|
||||
M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
|
||||
break;
|
||||
case 'r':
|
||||
X86EMU_trace_regs();
|
||||
break;
|
||||
case 'x':
|
||||
X86EMU_trace_xregs();
|
||||
break;
|
||||
case 'g':
|
||||
if (ntok == 2) {
|
||||
breakpoint = ps[1];
|
||||
if (noDecode) {
|
||||
M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
|
||||
} else {
|
||||
M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
|
||||
}
|
||||
M.x86.debug &= ~DEBUG_TRACE_F;
|
||||
M.x86.debug |= DEBUG_BREAK_F;
|
||||
done = 1;
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
M.x86.debug |= DEBUG_EXIT;
|
||||
return;
|
||||
case 'P':
|
||||
noDecode = (noDecode)?0:1;
|
||||
printk("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE");
|
||||
break;
|
||||
case 't':
|
||||
case 0:
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
*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;
|
||||
}
|
||||
printk("\tAX=%04x ", M.x86.R_AX );
|
||||
printk("BX=%04x ", M.x86.R_BX );
|
||||
printk("CX=%04x ", M.x86.R_CX );
|
||||
printk("DX=%04x ", M.x86.R_DX );
|
||||
printk("SP=%04x ", M.x86.R_SP );
|
||||
printk("BP=%04x ", M.x86.R_BP );
|
||||
printk("SI=%04x ", M.x86.R_SI );
|
||||
printk("DI=%04x\n", M.x86.R_DI );
|
||||
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("IP=%04x ", M.x86.R_IP );
|
||||
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");
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
void x86emu_dump_regs(void)
|
||||
void x86emu_dump_xregs (void)
|
||||
{
|
||||
printk("\tAX=%04x ", M.x86.R_AX);
|
||||
printk("BX=%04x ", M.x86.R_BX);
|
||||
printk("CX=%04x ", M.x86.R_CX);
|
||||
printk("DX=%04x ", M.x86.R_DX);
|
||||
printk("SP=%04x ", M.x86.R_SP);
|
||||
printk("BP=%04x ", M.x86.R_BP);
|
||||
printk("SI=%04x ", M.x86.R_SI);
|
||||
printk("DI=%04x\n", M.x86.R_DI);
|
||||
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("IP=%04x ", M.x86.R_IP);
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
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
|
||||
#
|
||||
# Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
# Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||
#
|
||||
# ========================================================================
|
||||
#
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
#############################################################################
|
||||
|
||||
TARGETLIB = libx86emu.a
|
||||
TARGETDEBUGLIB =libx86emud.a
|
||||
|
||||
OBJS=\
|
||||
debug.o \
|
||||
decode.o \
|
||||
fpu.o \
|
||||
ops.o \
|
||||
|
@ -41,20 +41,40 @@ ops2.o \
|
|||
prim_ops.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)
|
||||
ar rv $(TARGETLIB) $(OBJS)
|
||||
|
||||
INCS = -I. -Ix86emu -I../../include
|
||||
CFLAGS = -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG -DDEBUG
|
||||
$(TARGETDEBUGLIB): $(DEBUGOBJS)
|
||||
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:
|
||||
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:
|
||||
gcc -c $(CFLAGS) $(INCS) $*.cpp
|
||||
|
||||
clean:
|
||||
rm -f *.a *.o
|
||||
rm -f *.a *.o *.d
|
||||
|
||||
validate: validate.o libx86emu.a
|
||||
gcc -o validate validate.o -lx86emu -L.
|
||||
validate: validate.c libx86emu.a x86emu/prim_asm.h
|
||||
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);
|
||||
//printk("retaddr now 0x%p\n", retaddr);
|
||||
} 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);
|
||||
} else {
|
||||
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) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
|
@ -47,20 +47,28 @@
|
|||
#include <stdarg.h>
|
||||
#include "x86emu.h"
|
||||
#include "x86emu/prim_asm.h"
|
||||
#include "x86emu/prim_ops.h"
|
||||
|
||||
/*-------------------------- Implementation -------------------------------*/
|
||||
|
||||
#define true 1
|
||||
#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 VAL_START_BINARY(parm_type,res_type,dmax,smax,dincr,sincr) \
|
||||
{ \
|
||||
parm_type d,s; \
|
||||
res_type r,r_asm; \
|
||||
ulong flags,inflags; \
|
||||
int f,failed = false; \
|
||||
u32 flags,inflags; \
|
||||
int f,failed = false; \
|
||||
char buf1[80],buf2[80]; \
|
||||
for (d = 0; d < dmax; d += dincr) { \
|
||||
for (s = 0; s < smax; s += sincr) { \
|
||||
|
@ -70,7 +78,7 @@
|
|||
#define VAL_TEST_BINARY(name) \
|
||||
r_asm = name##_asm(&flags,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; \
|
||||
if (failed || trace) {
|
||||
|
||||
|
@ -78,7 +86,7 @@
|
|||
name##_asm(&flags,d,s); \
|
||||
name(d,s); \
|
||||
r = r_asm = 0; \
|
||||
if (M.x86.R_EFLG != flags) \
|
||||
if (flags_are_different(M.x86.R_EFLG, flags)) \
|
||||
failed = true; \
|
||||
if (failed || trace) {
|
||||
|
||||
|
@ -190,7 +198,7 @@
|
|||
parm_type d,s; \
|
||||
res_type r,r_asm; \
|
||||
u8 shift; \
|
||||
u32 flags,inflags; \
|
||||
u32 flags,inflags; \
|
||||
int f,failed = false; \
|
||||
char buf1[80],buf2[80]; \
|
||||
for (d = 0; d < dmax; d += dincr) { \
|
||||
|
@ -202,7 +210,7 @@
|
|||
#define VAL_TEST_TERNARY(name) \
|
||||
r_asm = name##_asm(&flags,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; \
|
||||
if (failed || trace) {
|
||||
|
||||
|
@ -258,7 +266,7 @@
|
|||
#define VAL_START_UNARY(parm_type,max,incr) \
|
||||
{ \
|
||||
parm_type d,r,r_asm; \
|
||||
u32 flags,inflags; \
|
||||
u32 flags,inflags; \
|
||||
int f,failed = false; \
|
||||
char buf1[80],buf2[80]; \
|
||||
for (d = 0; d < max; d += incr) { \
|
||||
|
@ -268,7 +276,7 @@
|
|||
#define VAL_TEST_UNARY(name) \
|
||||
r_asm = name##_asm(&flags,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;
|
||||
|
||||
#define VAL_FAIL_BYTE_UNARY(name) \
|
||||
|
@ -338,7 +346,7 @@
|
|||
{ \
|
||||
u8 d,s; \
|
||||
u16 r,r_asm; \
|
||||
u32 flags,inflags; \
|
||||
u32 flags,inflags; \
|
||||
int f,failed = false; \
|
||||
char buf1[80],buf2[80]; \
|
||||
for (d = 0; d < 0xFF; d += 1) { \
|
||||
|
@ -349,7 +357,7 @@
|
|||
M.x86.R_AL = d; \
|
||||
name(s); \
|
||||
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; \
|
||||
if (failed || trace) { \
|
||||
if (failed) \
|
||||
|
@ -379,7 +387,7 @@
|
|||
u16 d,s; \
|
||||
u16 r_lo,r_asm_lo; \
|
||||
u16 r_hi,r_asm_hi; \
|
||||
u32 flags,inflags; \
|
||||
u32 flags,inflags; \
|
||||
int f,failed = false; \
|
||||
char buf1[80],buf2[80]; \
|
||||
for (d = 0; d < 0xFF00; d += 0x100) { \
|
||||
|
@ -391,7 +399,7 @@
|
|||
name(s); \
|
||||
r_lo = M.x86.R_AX; \
|
||||
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; \
|
||||
if (failed || trace) { \
|
||||
if (failed) \
|
||||
|
@ -421,7 +429,7 @@
|
|||
u32 d,s; \
|
||||
u32 r_lo,r_asm_lo; \
|
||||
u32 r_hi,r_asm_hi; \
|
||||
u32 flags,inflags; \
|
||||
u32 flags,inflags; \
|
||||
int f,failed = false; \
|
||||
char buf1[80],buf2[80]; \
|
||||
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
|
||||
|
@ -433,7 +441,7 @@
|
|||
name(s); \
|
||||
r_lo = M.x86.R_EAX; \
|
||||
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; \
|
||||
if (failed || trace) { \
|
||||
if (failed) \
|
||||
|
@ -462,7 +470,7 @@
|
|||
{ \
|
||||
u16 d,s; \
|
||||
u8 r_quot,r_rem,r_asm_quot,r_asm_rem; \
|
||||
u32 flags,inflags; \
|
||||
u32 flags,inflags; \
|
||||
int f,failed = false; \
|
||||
char buf1[80],buf2[80]; \
|
||||
for (d = 0; d < 0xFF00; d += 0x100) { \
|
||||
|
@ -477,7 +485,7 @@
|
|||
if (M.x86.intr & INTR_SYNCH) \
|
||||
continue; \
|
||||
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; \
|
||||
if (failed || trace) { \
|
||||
if (failed) \
|
||||
|
@ -506,7 +514,7 @@
|
|||
{ \
|
||||
u32 d,s; \
|
||||
u16 r_quot,r_rem,r_asm_quot,r_asm_rem; \
|
||||
u32 flags,inflags; \
|
||||
u32 flags,inflags; \
|
||||
int f,failed = false; \
|
||||
char buf1[80],buf2[80]; \
|
||||
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
|
||||
|
@ -522,7 +530,7 @@
|
|||
if (M.x86.intr & INTR_SYNCH) \
|
||||
continue; \
|
||||
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; \
|
||||
if (failed || trace) { \
|
||||
if (failed) \
|
||||
|
@ -551,7 +559,7 @@
|
|||
{ \
|
||||
u32 d,s; \
|
||||
u32 r_quot,r_rem,r_asm_quot,r_asm_rem; \
|
||||
u32 flags,inflags; \
|
||||
u32 flags,inflags; \
|
||||
int f,failed = false; \
|
||||
char buf1[80],buf2[80]; \
|
||||
for (d = 0; d < 0xFF000000; d += 0x1000000) { \
|
||||
|
@ -567,7 +575,7 @@
|
|||
if (M.x86.intr & INTR_SYNCH) \
|
||||
continue; \
|
||||
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; \
|
||||
if (failed || trace) { \
|
||||
if (failed) \
|
||||
|
@ -593,173 +601,189 @@
|
|||
|
||||
void printk(const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
vfprintf(stdout, fmt, argptr);
|
||||
fflush(stdout);
|
||||
va_end(argptr);
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
vfprintf(stdout, fmt, argptr);
|
||||
fflush(stdout);
|
||||
va_end(argptr);
|
||||
}
|
||||
|
||||
char *print_flags(char *buf, ulong flags)
|
||||
char * print_flags(char *buf,ulong flags)
|
||||
{
|
||||
char *separator = "";
|
||||
char *separator = "";
|
||||
|
||||
buf[0] = 0;
|
||||
if (flags & F_CF) {
|
||||
strcat(buf, separator);
|
||||
strcat(buf, "CF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_PF) {
|
||||
strcat(buf, separator);
|
||||
strcat(buf, "PF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_AF) {
|
||||
strcat(buf, separator);
|
||||
strcat(buf, "AF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_ZF) {
|
||||
strcat(buf, separator);
|
||||
strcat(buf, "ZF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_SF) {
|
||||
strcat(buf, separator);
|
||||
strcat(buf, "SF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_OF) {
|
||||
strcat(buf, separator);
|
||||
strcat(buf, "OF");
|
||||
separator = ",";
|
||||
}
|
||||
if (separator[0] == 0)
|
||||
strcpy(buf, "None");
|
||||
return buf;
|
||||
buf[0] = 0;
|
||||
if (flags & F_CF) {
|
||||
strcat(buf,separator);
|
||||
strcat(buf,"CF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_PF) {
|
||||
strcat(buf,separator);
|
||||
strcat(buf,"PF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_AF) {
|
||||
strcat(buf,separator);
|
||||
strcat(buf,"AF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_ZF) {
|
||||
strcat(buf,separator);
|
||||
strcat(buf,"ZF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_SF) {
|
||||
strcat(buf,separator);
|
||||
strcat(buf,"SF");
|
||||
separator = ",";
|
||||
}
|
||||
if (flags & F_OF) {
|
||||
strcat(buf,separator);
|
||||
strcat(buf,"OF");
|
||||
separator = ",";
|
||||
}
|
||||
if (separator[0] == 0)
|
||||
strcpy(buf,"None");
|
||||
return buf;
|
||||
}
|
||||
|
||||
int main(int argc)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
ulong def_flags;
|
||||
int trace = false;
|
||||
u32 def_flags;
|
||||
int trace = false;
|
||||
|
||||
if (argc > 1)
|
||||
trace = true;
|
||||
memset(&M, 0, sizeof(M));
|
||||
def_flags = get_flags_asm() & ~ALL_FLAGS;
|
||||
if (argc > 1)
|
||||
trace = true;
|
||||
memset(&M, 0, sizeof(M));
|
||||
def_flags = get_flags_asm() & ~ALL_FLAGS;
|
||||
|
||||
VAL_WORD_UNARY(aaa_word);
|
||||
VAL_WORD_UNARY(aas_word);
|
||||
cur_flags_mask = F_AF | F_CF;
|
||||
VAL_WORD_UNARY(aaa_word);
|
||||
VAL_WORD_UNARY(aas_word);
|
||||
|
||||
VAL_WORD_UNARY(aad_word);
|
||||
VAL_WORD_UNARY(aam_word);
|
||||
cur_flags_mask = F_SF | F_ZF | F_PF;
|
||||
VAL_WORD_UNARY(aad_word);
|
||||
VAL_WORD_UNARY(aam_word);
|
||||
|
||||
VAL_BYTE_BYTE_BINARY(adc_byte);
|
||||
VAL_WORD_WORD_BINARY(adc_word);
|
||||
VAL_LONG_LONG_BINARY(adc_long);
|
||||
cur_flags_mask = ALL_FLAGS;
|
||||
VAL_BYTE_BYTE_BINARY(adc_byte);
|
||||
VAL_WORD_WORD_BINARY(adc_word);
|
||||
VAL_LONG_LONG_BINARY(adc_long);
|
||||
|
||||
VAL_BYTE_BYTE_BINARY(add_byte);
|
||||
VAL_WORD_WORD_BINARY(add_word);
|
||||
VAL_LONG_LONG_BINARY(add_long);
|
||||
VAL_BYTE_BYTE_BINARY(add_byte);
|
||||
VAL_WORD_WORD_BINARY(add_word);
|
||||
VAL_LONG_LONG_BINARY(add_long);
|
||||
|
||||
VAL_BYTE_BYTE_BINARY(and_byte);
|
||||
VAL_WORD_WORD_BINARY(and_word);
|
||||
VAL_LONG_LONG_BINARY(and_long);
|
||||
cur_flags_mask = ALL_FLAGS & (~F_AF);
|
||||
VAL_BYTE_BYTE_BINARY(and_byte);
|
||||
VAL_WORD_WORD_BINARY(and_word);
|
||||
VAL_LONG_LONG_BINARY(and_long);
|
||||
|
||||
VAL_BYTE_BYTE_BINARY(cmp_byte);
|
||||
VAL_WORD_WORD_BINARY(cmp_word);
|
||||
VAL_LONG_LONG_BINARY(cmp_long);
|
||||
cur_flags_mask = ALL_FLAGS;
|
||||
VAL_BYTE_BYTE_BINARY(cmp_byte);
|
||||
VAL_WORD_WORD_BINARY(cmp_word);
|
||||
VAL_LONG_LONG_BINARY(cmp_long);
|
||||
|
||||
VAL_BYTE_UNARY(daa_byte);
|
||||
VAL_BYTE_UNARY(das_byte); // Fails for 0x9A (out of range anyway)
|
||||
cur_flags_mask = ALL_FLAGS & (~F_OF);
|
||||
VAL_BYTE_UNARY(daa_byte);
|
||||
VAL_BYTE_UNARY(das_byte); // Fails for 0x9A (out of range anyway)
|
||||
|
||||
VAL_BYTE_UNARY(dec_byte);
|
||||
VAL_WORD_UNARY(dec_word);
|
||||
VAL_LONG_UNARY(dec_long);
|
||||
cur_flags_mask = ALL_FLAGS;
|
||||
VAL_BYTE_UNARY(dec_byte);
|
||||
VAL_WORD_UNARY(dec_word);
|
||||
VAL_LONG_UNARY(dec_long);
|
||||
|
||||
VAL_BYTE_UNARY(inc_byte);
|
||||
VAL_WORD_UNARY(inc_word);
|
||||
VAL_LONG_UNARY(inc_long);
|
||||
VAL_BYTE_UNARY(inc_byte);
|
||||
VAL_WORD_UNARY(inc_word);
|
||||
VAL_LONG_UNARY(inc_long);
|
||||
|
||||
VAL_BYTE_BYTE_BINARY(or_byte);
|
||||
VAL_WORD_WORD_BINARY(or_word);
|
||||
VAL_LONG_LONG_BINARY(or_long);
|
||||
cur_flags_mask = ALL_FLAGS & (~F_AF);
|
||||
VAL_BYTE_BYTE_BINARY(or_byte);
|
||||
VAL_WORD_WORD_BINARY(or_word);
|
||||
VAL_LONG_LONG_BINARY(or_long);
|
||||
|
||||
VAL_BYTE_UNARY(neg_byte);
|
||||
VAL_WORD_UNARY(neg_word);
|
||||
VAL_LONG_UNARY(neg_long);
|
||||
cur_flags_mask = ALL_FLAGS;
|
||||
VAL_BYTE_UNARY(neg_byte);
|
||||
VAL_WORD_UNARY(neg_word);
|
||||
VAL_LONG_UNARY(neg_long);
|
||||
|
||||
VAL_BYTE_UNARY(not_byte);
|
||||
VAL_WORD_UNARY(not_word);
|
||||
VAL_LONG_UNARY(not_long);
|
||||
VAL_BYTE_UNARY(not_byte);
|
||||
VAL_WORD_UNARY(not_word);
|
||||
VAL_LONG_UNARY(not_long);
|
||||
|
||||
VAL_BYTE_ROTATE(rcl_byte);
|
||||
VAL_WORD_ROTATE(rcl_word);
|
||||
VAL_LONG_ROTATE(rcl_long);
|
||||
cur_flags_mask = ALL_FLAGS & (~F_OF);
|
||||
VAL_BYTE_ROTATE(rcl_byte);
|
||||
VAL_WORD_ROTATE(rcl_word);
|
||||
VAL_LONG_ROTATE(rcl_long);
|
||||
|
||||
VAL_BYTE_ROTATE(rcr_byte);
|
||||
VAL_WORD_ROTATE(rcr_word);
|
||||
VAL_LONG_ROTATE(rcr_long);
|
||||
VAL_BYTE_ROTATE(rcr_byte);
|
||||
VAL_WORD_ROTATE(rcr_word);
|
||||
VAL_LONG_ROTATE(rcr_long);
|
||||
|
||||
VAL_BYTE_ROTATE(rol_byte);
|
||||
VAL_WORD_ROTATE(rol_word);
|
||||
VAL_LONG_ROTATE(rol_long);
|
||||
VAL_BYTE_ROTATE(rol_byte);
|
||||
VAL_WORD_ROTATE(rol_word);
|
||||
VAL_LONG_ROTATE(rol_long);
|
||||
|
||||
VAL_BYTE_ROTATE(ror_byte);
|
||||
VAL_WORD_ROTATE(ror_word);
|
||||
VAL_LONG_ROTATE(ror_long);
|
||||
VAL_BYTE_ROTATE(ror_byte);
|
||||
VAL_WORD_ROTATE(ror_word);
|
||||
VAL_LONG_ROTATE(ror_long);
|
||||
|
||||
VAL_BYTE_ROTATE(shl_byte);
|
||||
VAL_WORD_ROTATE(shl_word);
|
||||
VAL_LONG_ROTATE(shl_long);
|
||||
cur_flags_mask = ALL_FLAGS & (~(F_AF | F_OF));
|
||||
VAL_BYTE_ROTATE(shl_byte);
|
||||
VAL_WORD_ROTATE(shl_word);
|
||||
VAL_LONG_ROTATE(shl_long);
|
||||
|
||||
VAL_BYTE_ROTATE(shr_byte);
|
||||
VAL_WORD_ROTATE(shr_word);
|
||||
VAL_LONG_ROTATE(shr_long);
|
||||
VAL_BYTE_ROTATE(shr_byte);
|
||||
VAL_WORD_ROTATE(shr_word);
|
||||
VAL_LONG_ROTATE(shr_long);
|
||||
|
||||
VAL_BYTE_ROTATE(sar_byte);
|
||||
VAL_WORD_ROTATE(sar_word);
|
||||
VAL_LONG_ROTATE(sar_long);
|
||||
VAL_BYTE_ROTATE(sar_byte);
|
||||
VAL_WORD_ROTATE(sar_word);
|
||||
VAL_LONG_ROTATE(sar_long);
|
||||
|
||||
VAL_WORD_ROTATE_DBL(shld_word);
|
||||
VAL_LONG_ROTATE_DBL(shld_long);
|
||||
cur_flags_mask = ALL_FLAGS & (~(F_AF | F_OF));
|
||||
VAL_WORD_ROTATE_DBL(shld_word);
|
||||
VAL_LONG_ROTATE_DBL(shld_long);
|
||||
|
||||
VAL_WORD_ROTATE_DBL(shrd_word);
|
||||
VAL_LONG_ROTATE_DBL(shrd_long);
|
||||
VAL_WORD_ROTATE_DBL(shrd_word);
|
||||
VAL_LONG_ROTATE_DBL(shrd_long);
|
||||
|
||||
VAL_BYTE_BYTE_BINARY(sbb_byte);
|
||||
VAL_WORD_WORD_BINARY(sbb_word);
|
||||
VAL_LONG_LONG_BINARY(sbb_long);
|
||||
cur_flags_mask = ALL_FLAGS;
|
||||
VAL_BYTE_BYTE_BINARY(sbb_byte);
|
||||
VAL_WORD_WORD_BINARY(sbb_word);
|
||||
VAL_LONG_LONG_BINARY(sbb_long);
|
||||
|
||||
VAL_BYTE_BYTE_BINARY(sub_byte);
|
||||
VAL_WORD_WORD_BINARY(sub_word);
|
||||
VAL_LONG_LONG_BINARY(sub_long);
|
||||
VAL_BYTE_BYTE_BINARY(sub_byte);
|
||||
VAL_WORD_WORD_BINARY(sub_word);
|
||||
VAL_LONG_LONG_BINARY(sub_long);
|
||||
|
||||
VAL_BYTE_BYTE_BINARY(xor_byte);
|
||||
VAL_WORD_WORD_BINARY(xor_word);
|
||||
VAL_LONG_LONG_BINARY(xor_long);
|
||||
cur_flags_mask = ALL_FLAGS & (~F_AF);
|
||||
VAL_BYTE_BYTE_BINARY(xor_byte);
|
||||
VAL_WORD_WORD_BINARY(xor_word);
|
||||
VAL_LONG_LONG_BINARY(xor_long);
|
||||
|
||||
VAL_VOID_BYTE_BINARY(test_byte);
|
||||
VAL_VOID_WORD_BINARY(test_word);
|
||||
VAL_VOID_LONG_BINARY(test_long);
|
||||
VAL_VOID_BYTE_BINARY(test_byte);
|
||||
VAL_VOID_WORD_BINARY(test_word);
|
||||
VAL_VOID_LONG_BINARY(test_long);
|
||||
|
||||
VAL_BYTE_MUL(imul_byte);
|
||||
VAL_WORD_MUL(imul_word);
|
||||
VAL_LONG_MUL(imul_long);
|
||||
cur_flags_mask = F_CF | F_OF;
|
||||
VAL_BYTE_MUL(imul_byte);
|
||||
VAL_WORD_MUL(imul_word);
|
||||
VAL_LONG_MUL(imul_long);
|
||||
|
||||
VAL_BYTE_MUL(mul_byte);
|
||||
VAL_WORD_MUL(mul_word);
|
||||
VAL_LONG_MUL(mul_long);
|
||||
VAL_BYTE_MUL(mul_byte);
|
||||
VAL_WORD_MUL(mul_word);
|
||||
VAL_LONG_MUL(mul_long);
|
||||
|
||||
VAL_BYTE_DIV(idiv_byte);
|
||||
VAL_WORD_DIV(idiv_word);
|
||||
VAL_LONG_DIV(idiv_long);
|
||||
cur_flags_mask = 0;
|
||||
VAL_BYTE_DIV(idiv_byte);
|
||||
VAL_WORD_DIV(idiv_word);
|
||||
VAL_LONG_DIV(idiv_long);
|
||||
|
||||
VAL_BYTE_DIV(div_byte);
|
||||
VAL_WORD_DIV(div_word);
|
||||
VAL_LONG_DIV(div_long);
|
||||
VAL_BYTE_DIV(div_byte);
|
||||
VAL_WORD_DIV(div_word);
|
||||
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) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
|
@ -28,14 +28,13 @@
|
|||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* 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
|
||||
#define __X86EMU_DEBUG_H
|
||||
|
@ -50,10 +49,10 @@
|
|||
#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset*/
|
||||
|
||||
#ifdef DEBUG
|
||||
# define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_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_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_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_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
|
||||
# define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
|
||||
#else
|
||||
# define CHECK_IP_FETCH()
|
||||
# define CHECK_SP_ACCESS()
|
||||
|
@ -62,50 +61,50 @@
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
# define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
|
||||
# define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
|
||||
# define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
|
||||
# define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
|
||||
# define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
|
||||
# define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_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_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
|
||||
# define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
|
||||
# define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
|
||||
# define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
|
||||
# define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
|
||||
# define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
|
||||
# define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
|
||||
# define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_CS_IP)
|
||||
|
||||
# define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
|
||||
# define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
|
||||
# define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
|
||||
# define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
|
||||
# define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
|
||||
# define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_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_FS() (M.x86.debug & DEBUG_FS_F)
|
||||
# define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
|
||||
# define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
|
||||
# define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
|
||||
# define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
|
||||
# define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_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_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
|
||||
#else
|
||||
# define DEBUG_INSTRUMENT() 0
|
||||
# define DEBUG_DECODE() 0
|
||||
# define DEBUG_TRACE() 0
|
||||
# define DEBUG_STEP() 0
|
||||
# define DEBUG_DISASSEMBLE() 0
|
||||
# define DEBUG_BREAK() 0
|
||||
# define DEBUG_SVC() 0
|
||||
# define DEBUG_INSTRUMENT() 0
|
||||
# define DEBUG_DECODE() 0
|
||||
# define DEBUG_TRACE() 0
|
||||
# define DEBUG_STEP() 0
|
||||
# define DEBUG_DISASSEMBLE() 0
|
||||
# define DEBUG_BREAK() 0
|
||||
# define DEBUG_SVC() 0
|
||||
# define DEBUG_SAVE_IP_CS() 0
|
||||
# define DEBUG_FS() 0
|
||||
# define DEBUG_PROC() 0
|
||||
# define DEBUG_SYSINT() 0
|
||||
# define DEBUG_TRACECALL() 0
|
||||
# define DEBUG_TRACECALLREGS() 0
|
||||
# define DEBUG_SYS() 0
|
||||
# define DEBUG_MEM_TRACE() 0
|
||||
# define DEBUG_IO_TRACE() 0
|
||||
# define DEBUG_FS() 0
|
||||
# define DEBUG_PROC() 0
|
||||
# define DEBUG_SYSINT() 0
|
||||
# define DEBUG_TRACECALL() 0
|
||||
# define DEBUG_TRACECALLREGS() 0
|
||||
# define DEBUG_SYS() 0
|
||||
# define DEBUG_MEM_TRACE() 0
|
||||
# define DEBUG_IO_TRACE() 0
|
||||
# define DEBUG_DECODE_NOPRINT() 0
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
# define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
|
||||
x86emu_decode_printf(x)
|
||||
# define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
|
||||
x86emu_decode_printf2(x,y)
|
||||
# define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
|
||||
x86emu_decode_printf(x)
|
||||
# define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
|
||||
x86emu_decode_printf2(x,y)
|
||||
|
||||
/*
|
||||
* 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
|
||||
* major opcode of the instruction is accessed.
|
||||
*/
|
||||
#define INC_DECODED_INST_LEN(x) \
|
||||
if (DEBUG_DECODE()) \
|
||||
x86emu_inc_decoded_inst_len(x)
|
||||
#define INC_DECODED_INST_LEN(x) \
|
||||
if (DEBUG_DECODE()) \
|
||||
x86emu_inc_decoded_inst_len(x)
|
||||
|
||||
#define SAVE_IP_CS(x,y) \
|
||||
if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \
|
||||
#define SAVE_IP_CS(x,y) \
|
||||
if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \
|
||||
| DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \
|
||||
M.x86.saved_cs = x; \
|
||||
M.x86.saved_ip = y; \
|
||||
}
|
||||
M.x86.saved_cs = x; \
|
||||
M.x86.saved_ip = y; \
|
||||
}
|
||||
#else
|
||||
# define INC_DECODED_INST_LEN(x)
|
||||
# define DECODE_PRINTF(x)
|
||||
|
@ -131,30 +130,30 @@
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define TRACE_REGS() \
|
||||
if (DEBUG_DISASSEMBLE()) { \
|
||||
x86emu_just_disassemble(); \
|
||||
goto EndOfTheInstructionProcedure; \
|
||||
} \
|
||||
if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
|
||||
#define TRACE_REGS() \
|
||||
if (DEBUG_DISASSEMBLE()) { \
|
||||
x86emu_just_disassemble(); \
|
||||
goto EndOfTheInstructionProcedure; \
|
||||
} \
|
||||
if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
|
||||
#else
|
||||
# define TRACE_REGS()
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
# define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
|
||||
# define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
|
||||
#else
|
||||
# define SINGLE_STEP()
|
||||
#endif
|
||||
|
||||
#define TRACE_AND_STEP() \
|
||||
TRACE_REGS(); \
|
||||
SINGLE_STEP()
|
||||
#define TRACE_AND_STEP() \
|
||||
TRACE_REGS(); \
|
||||
SINGLE_STEP()
|
||||
|
||||
#ifdef DEBUG
|
||||
# define START_OF_INSTR()
|
||||
# define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
|
||||
# define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
|
||||
# define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
|
||||
# define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
|
||||
#else
|
||||
# define START_OF_INSTR()
|
||||
# define END_OF_INSTR()
|
||||
|
@ -163,30 +162,30 @@
|
|||
|
||||
#ifdef DEBUG
|
||||
# define CALL_TRACE(u,v,w,x,s) \
|
||||
if (DEBUG_TRACECALLREGS()) \
|
||||
x86emu_dump_regs(); \
|
||||
if (DEBUG_TRACECALL()) \
|
||||
printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
|
||||
if (DEBUG_TRACECALLREGS()) \
|
||||
x86emu_dump_regs(); \
|
||||
if (DEBUG_TRACECALL()) \
|
||||
printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
|
||||
# define RETURN_TRACE(n,u,v) \
|
||||
if (DEBUG_TRACECALLREGS()) \
|
||||
x86emu_dump_regs(); \
|
||||
if (DEBUG_TRACECALL()) \
|
||||
printk("%04x:%04x: %s\n",u,v,n);
|
||||
if (DEBUG_TRACECALLREGS()) \
|
||||
x86emu_dump_regs(); \
|
||||
if (DEBUG_TRACECALL()) \
|
||||
printk("%04x:%04x: %s\n",u,v,n);
|
||||
#else
|
||||
# define CALL_TRACE(u,v,w,x,s)
|
||||
# define RETURN_TRACE(n,u,v)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DB(x) x
|
||||
#define DB(x) x
|
||||
#else
|
||||
#define DB(x)
|
||||
#define DB(x)
|
||||
#endif
|
||||
|
||||
/*-------------------------- Function Prototypes --------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
|
||||
#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) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
|
@ -28,8 +28,8 @@
|
|||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for instruction decoding logic.
|
||||
|
@ -43,19 +43,19 @@
|
|||
|
||||
/* Instruction Decoding Stuff */
|
||||
|
||||
#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_WORD_REGISTER(r) decode_rm_word_register(r)
|
||||
#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r)
|
||||
#define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK
|
||||
#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_WORD_REGISTER(r) decode_rm_word_register(r)
|
||||
#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r)
|
||||
#define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK
|
||||
|
||||
/*-------------------------- Function Prototypes --------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
void x86emu_intr_raise (u8 type);
|
||||
void x86emu_intr_raise (u8 type);
|
||||
void fetch_decode_modrm (int *mod,int *regh,int *regl);
|
||||
u8 fetch_byte_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_long (uint offset, u32 val);
|
||||
void store_data_long_abs (uint segment, uint offset, u32 val);
|
||||
u8* decode_rm_byte_register(int reg);
|
||||
u16* decode_rm_word_register(int reg);
|
||||
u32* decode_rm_long_register(int reg);
|
||||
u16* decode_rm_seg_register(int reg);
|
||||
u8* decode_rm_byte_register(int reg);
|
||||
u16* decode_rm_word_register(int reg);
|
||||
u32* decode_rm_long_register(int reg);
|
||||
u16* decode_rm_seg_register(int reg);
|
||||
unsigned decode_rm00_address(int rm);
|
||||
unsigned decode_rm01_address(int rm);
|
||||
unsigned decode_rm10_address(int rm);
|
||||
unsigned decode_rmXX_address(int mod, int rm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
|
||||
#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) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
|
@ -28,8 +28,8 @@
|
|||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for FPU instruction decoding.
|
||||
|
@ -40,7 +40,7 @@
|
|||
#define __X86EMU_FPU_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
|
||||
#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) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
|
@ -28,8 +28,8 @@
|
|||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* 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) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
|
@ -28,8 +28,8 @@
|
|||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for primitive operation functions.
|
||||
|
@ -39,10 +39,8 @@
|
|||
#ifndef __X86EMU_PRIM_OPS_H
|
||||
#define __X86EMU_PRIM_OPS_H
|
||||
|
||||
#include "x86emu/prim_asm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
u16 aaa_word (u16 d);
|
||||
|
@ -118,7 +116,7 @@ u32 xor_long (u32 d, u32 s);
|
|||
void imul_byte (u8 s);
|
||||
void imul_word (u16 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_word (u16 s);
|
||||
void mul_long (u32 s);
|
||||
|
@ -134,98 +132,11 @@ u16 mem_access_word (int addr);
|
|||
void push_word (u16 w);
|
||||
void push_long (u32 w);
|
||||
u16 pop_word (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
|
||||
u32 pop_long (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
|
||||
#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) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
|
@ -28,18 +28,16 @@
|
|||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for system specific functions. These functions
|
||||
* are always compiled and linked in the OS depedent libraries,
|
||||
* and never in a binary portable driver.
|
||||
* are always compiled and linked in the OS depedent libraries,
|
||||
* 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
|
||||
#define __X86EMU_X86EMUI_H
|
||||
|
||||
|
@ -48,18 +46,18 @@
|
|||
* dramatically in this case).
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus) && !defined(_NO_INLINE)
|
||||
#define _INLINE inline
|
||||
#if defined(__cplusplus) && !defined(_NO_INLINE)
|
||||
#define _INLINE inline
|
||||
#else
|
||||
#define _INLINE static
|
||||
#define _INLINE static
|
||||
#endif
|
||||
|
||||
/* Get rid of unused parameters in C++ compilation mode */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define X86EMU_UNUSED(v)
|
||||
#define X86EMU_UNUSED(v)
|
||||
#else
|
||||
#define X86EMU_UNUSED(v) v
|
||||
#define X86EMU_UNUSED(v) v
|
||||
#endif
|
||||
|
||||
#include "x86emu.h"
|
||||
|
@ -70,36 +68,34 @@
|
|||
#include "x86emu/prim_ops.h"
|
||||
#include "x86emu/fpu.h"
|
||||
#include "x86emu/fpu_regs.h"
|
||||
|
||||
#ifdef IN_MODULE
|
||||
#include <xf86_ansic.h>
|
||||
#else
|
||||
#ifndef __KERNEL__
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
/*--------------------------- Inline Functions ----------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
extern u8 (X86APIP sys_rdb)(u32 addr);
|
||||
extern u16 (X86APIP sys_rdw)(u32 addr);
|
||||
extern u32 (X86APIP sys_rdl)(u32 addr);
|
||||
extern u8 (X86APIP sys_rdb)(u32 addr);
|
||||
extern u16 (X86APIP sys_rdw)(u32 addr);
|
||||
extern u32 (X86APIP sys_rdl)(u32 addr);
|
||||
extern void (X86APIP sys_wrb)(u32 addr,u8 val);
|
||||
extern void (X86APIP sys_wrw)(u32 addr,u16 val);
|
||||
extern void (X86APIP sys_wrl)(u32 addr,u32 val);
|
||||
|
||||
extern u8 (X86APIP sys_inb)(X86EMU_pioAddr addr);
|
||||
extern u16 (X86APIP sys_inw)(X86EMU_pioAddr addr);
|
||||
extern u32 (X86APIP sys_inl)(X86EMU_pioAddr addr);
|
||||
extern u8 (X86APIP sys_inb)(X86EMU_pioAddr addr);
|
||||
extern u16 (X86APIP sys_inw)(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_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
|
||||
} /* End of "C" linkage for C++ */
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
|
||||
#endif /* __X86EMU_X86EMUI_H */
|
||||
|
|
Loading…
Reference in New Issue