Revision 586314f2 op-i386.c

b/op-i386.c
1
#define DEBUG_EXEC
2

  
1 3
typedef unsigned char uint8_t;
2 4
typedef unsigned short uint16_t;
3 5
typedef unsigned int uint32_t;
......
10 12

  
11 13
#define NULL 0
12 14

  
15
typedef struct FILE FILE;
16
extern FILE *logfile;
17
extern int loglevel;
18
extern int fprintf(FILE *, const char *, ...);
19

  
13 20
#ifdef __i386__
14 21
register int T0 asm("esi");
15 22
register int T1 asm("ebx");
......
1636 1643
/* main execution loop */
1637 1644
uint8_t code_gen_buffer[65536];
1638 1645

  
1646
#ifdef DEBUG_EXEC
1647
static const char *cc_op_str[] = {
1648
    "DYNAMIC",
1649
    "EFLAGS",
1650
    "MUL",
1651
    "ADDB",
1652
    "ADDW",
1653
    "ADDL",
1654
    "SUBB",
1655
    "SUBW",
1656
    "SUBL",
1657
    "LOGICB",
1658
    "LOGICW",
1659
    "LOGICL",
1660
    "INCB",
1661
    "INCW",
1662
    "INCL",
1663
    "DECB",
1664
    "DECW",
1665
    "DECL",
1666
    "SHLB",
1667
    "SHLW",
1668
    "SHLL",
1669
};
1670
#endif
1671

  
1639 1672
int cpu_x86_exec(CPUX86State *env1)
1640 1673
{
1641 1674
    int saved_T0, saved_T1, saved_A0;
......
1653 1686
    /* prepare setjmp context for exception handling */
1654 1687
    if (setjmp(env->jmp_env) == 0) {
1655 1688
        for(;;) {
1689
#ifdef DEBUG_EXEC
1690
            if (loglevel) {
1691
                fprintf(logfile, 
1692
                        "EAX=%08x EBX=%08X ECX=%08x EDX=%08x\n"
1693
                        "ESI=%08x ESI=%08X EBP=%08x ESP=%08x\n"
1694
                        "CCS=%08x CCD=%08x CCOP=%s\n",
1695
                        env->regs[R_EAX], env->regs[R_EBX], env->regs[R_ECX], env->regs[R_EDX], 
1696
                        env->regs[R_ESI], env->regs[R_EDI], env->regs[R_EBP], env->regs[R_ESP], 
1697
                        env->cc_src, env->cc_dst, cc_op_str[env->cc_op]);
1698
            }
1699
#endif
1656 1700
            cpu_x86_gen_code(code_gen_buffer, &code_gen_size, (uint8_t *)env->pc);
1657 1701
            /* execute the generated code */
1658 1702
            gen_func = (void *)code_gen_buffer;

Also available in: Unified diff