Revision d12d51d5 linux-user/vm86.c

b/linux-user/vm86.c
29 29

  
30 30
//#define DEBUG_VM86
31 31

  
32
#ifdef DEBUG_VM86
33
#  define LOG_VM86(...) fprintf(logfile, ## __VA_ARGS__);
34
#else
35
#  define LOG_VM86(...) do { } while (0)
36
#endif
37

  
38

  
32 39
#define set_flags(X,new,mask) \
33 40
((X) = ((X) & ~(mask)) | ((new) & (mask)))
34 41

  
......
92 99
    set_flags(env->eflags, ts->v86flags, VIF_MASK | ts->v86mask);
93 100
    target_v86->regs.eflags = tswap32(env->eflags);
94 101
    unlock_user_struct(target_v86, ts->target_v86, 1);
95
#ifdef DEBUG_VM86
96
    fprintf(logfile, "save_v86_state: eflags=%08x cs:ip=%04x:%04x\n",
97
            env->eflags, env->segs[R_CS].selector, env->eip);
98
#endif
102
    LOG_VM86("save_v86_state: eflags=%08x cs:ip=%04x:%04x\n",
103
             env->eflags, env->segs[R_CS].selector, env->eip);
99 104

  
100 105
    /* restore 32 bit registers */
101 106
    env->regs[R_EAX] = ts->vm86_saved_regs.eax;
......
121 126
   'retval' */
122 127
static inline void return_to_32bit(CPUX86State *env, int retval)
123 128
{
124
#ifdef DEBUG_VM86
125
    fprintf(logfile, "return_to_32bit: ret=0x%x\n", retval);
126
#endif
129
    LOG_VM86("return_to_32bit: ret=0x%x\n", retval);
127 130
    save_v86_state(env);
128 131
    env->regs[R_EAX] = retval;
129 132
}
......
216 219
    segoffs = ldl(int_addr);
217 220
    if ((segoffs >> 16) == TARGET_BIOSSEG)
218 221
        goto cannot_handle;
219
#if defined(DEBUG_VM86)
220
    fprintf(logfile, "VM86: emulating int 0x%x. CS:IP=%04x:%04x\n",
221
            intno, segoffs >> 16, segoffs & 0xffff);
222
#endif
222
    LOG_VM86("VM86: emulating int 0x%x. CS:IP=%04x:%04x\n",
223
             intno, segoffs >> 16, segoffs & 0xffff);
223 224
    /* save old state */
224 225
    ssp = env->segs[R_SS].selector << 4;
225 226
    sp = env->regs[R_ESP] & 0xffff;
......
235 236
    clear_AC(env);
236 237
    return;
237 238
 cannot_handle:
238
#if defined(DEBUG_VM86)
239
    fprintf(logfile, "VM86: return to 32 bits int 0x%x\n", intno);
240
#endif
239
    LOG_VM86("VM86: return to 32 bits int 0x%x\n", intno);
241 240
    return_to_32bit(env, TARGET_VM86_INTx | (intno << 8));
242 241
}
243 242

  
......
274 273
    ssp = env->segs[R_SS].selector << 4;
275 274
    sp = env->regs[R_ESP] & 0xffff;
276 275

  
277
#if defined(DEBUG_VM86)
278
    fprintf(logfile, "VM86 exception %04x:%08x\n",
279
            env->segs[R_CS].selector, env->eip);
280
#endif
276
    LOG_VM86("VM86 exception %04x:%08x\n",
277
             env->segs[R_CS].selector, env->eip);
281 278

  
282 279
    data32 = 0;
283 280
    pref_done = 0;
......
478 475
           target_v86->vm86plus.vm86dbg_intxxtab, 32);
479 476
    unlock_user_struct(target_v86, vm86_addr, 0);
480 477

  
481
#ifdef DEBUG_VM86
482
    fprintf(logfile, "do_vm86: cs:ip=%04x:%04x\n",
483
            env->segs[R_CS].selector, env->eip);
484
#endif
478
    LOG_VM86("do_vm86: cs:ip=%04x:%04x\n",
479
             env->segs[R_CS].selector, env->eip);
485 480
    /* now the virtual CPU is ready for vm86 execution ! */
486 481
 out:
487 482
    return ret;

Also available in: Unified diff