Revision e19e89a5 target-i386/helper.c

b/target-i386/helper.c
290 290

  
291 291
    type = (e2 >> DESC_TYPE_SHIFT) & 0xf;
292 292
#ifdef DEBUG_PCALL
293
    if (loglevel)
293
    if (loglevel & CPU_LOG_PCALL)
294 294
        fprintf(logfile, "switch_tss: sel=0x%04x type=%d src=%d\n", tss_selector, type, source);
295 295
#endif
296 296

  
......
858 858
}
859 859

  
860 860
/*
861
 * Begin excution of an interruption. is_int is TRUE if coming from
861
 * Begin execution of an interruption. is_int is TRUE if coming from
862 862
 * the int instruction. next_eip is the EIP value AFTER the interrupt
863 863
 * instruction. It is only relevant if is_int is TRUE.  
864 864
 */
865 865
void do_interrupt(int intno, int is_int, int error_code, 
866 866
                  unsigned int next_eip, int is_hw)
867 867
{
868
#if 0
869
    {
870
        extern FILE *stdout;
871
        static int count;
872
        if (env->cr[0] & CR0_PE_MASK)  {
873
            fprintf(stdout, "%d: v=%02x e=%04x i=%d CPL=%d CS:EIP=%04x:%08x SS:ESP=%04x:%08x",
868
#ifdef DEBUG_PCALL
869
    if (loglevel & (CPU_LOG_PCALL | CPU_LOG_INT)) {
870
        if ((env->cr[0] & CR0_PE_MASK)) {
871
            static int count;
872
            fprintf(logfile, "%6d: v=%02x e=%04x i=%d cpl=%d IP=%04x:%08x SP=%04x:%08x",
874 873
                    count, intno, error_code, is_int,
875 874
                    env->hflags & HF_CPL_MASK,
876 875
                    env->segs[R_CS].selector, EIP,
877 876
                    env->segs[R_SS].selector, ESP);
878 877
            if (intno == 0x0e) {
879
                fprintf(stdout, " CR2=%08x", env->cr[2]);
878
                fprintf(logfile, " CR2=%08x", env->cr[2]);
880 879
            } else {
881
                fprintf(stdout, " EAX=%08x", env->regs[R_EAX]);
880
                fprintf(logfile, " EAX=%08x", env->regs[R_EAX]);
882 881
            }
883
            fprintf(stdout, "\n");
884

  
885
            if (0) {
886
                cpu_x86_dump_state(env, stdout, X86_DUMP_CCOP);
882
            fprintf(logfile, "\n");
887 883
#if 0
888
                {
889
                    int i;
890
                    uint8_t *ptr;
891
                    fprintf(stdout, "       code=");
892
                    ptr = env->segs[R_CS].base + env->eip;
893
                    for(i = 0; i < 16; i++) {
894
                        fprintf(stdout, " %02x", ldub(ptr + i));
895
                    }
896
                    fprintf(stdout, "\n");
884
            cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP);
885
            {
886
                int i;
887
                uint8_t *ptr;
888
                fprintf(logfile, "       code=");
889
                ptr = env->segs[R_CS].base + env->eip;
890
                for(i = 0; i < 16; i++) {
891
                    fprintf(logfile, " %02x", ldub(ptr + i));
897 892
                }
898
#endif
893
                fprintf(logfile, "\n");
899 894
            }
900
            count++;
901
        }
902
    }
903 895
#endif
904
#ifdef DEBUG_PCALL
905
    if (loglevel) {
906
        static int count;
907
        fprintf(logfile, "%d: interrupt: vector=%02x error_code=%04x int=%d\n",
908
                count, intno, error_code, is_int);
909
        cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP);
910
#if 0
911
        {
912
            int i;
913
            uint8_t *ptr;
914
            fprintf(logfile, "       code=");
915
            ptr = env->segs[R_CS].base + env->eip;
916
            for(i = 0; i < 16; i++) {
917
                fprintf(logfile, " %02x", ldub(ptr + i));
918
            }
919
            fprintf(logfile, "\n");
896
            count++;
920 897
        }
921
#endif
922
        count++;
923 898
    }
924 899
#endif
925 900
    if (env->cr[0] & CR0_PE_MASK) {
......
1365 1340
    new_cs = T0;
1366 1341
    new_eip = T1;
1367 1342
#ifdef DEBUG_PCALL
1368
    if (loglevel) {
1369
        fprintf(logfile, "lcall %04x:%08x\n",
1370
                new_cs, new_eip);
1343
    if (loglevel & CPU_LOG_PCALL) {
1344
        fprintf(logfile, "lcall %04x:%08x s=%d\n",
1345
                new_cs, new_eip, shift);
1371 1346
        cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP);
1372 1347
    }
1373 1348
#endif
......
1377 1352
        raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
1378 1353
    cpl = env->hflags & HF_CPL_MASK;
1379 1354
#ifdef DEBUG_PCALL
1380
    if (loglevel) {
1355
    if (loglevel & CPU_LOG_PCALL) {
1381 1356
        fprintf(logfile, "desc=%08x:%08x\n", e1, e2);
1382 1357
    }
1383 1358
#endif
......
1466 1441
            /* to inner priviledge */
1467 1442
            get_ss_esp_from_tss(&ss, &sp, dpl);
1468 1443
#ifdef DEBUG_PCALL
1469
            if (loglevel)
1470
                fprintf(logfile, "ss=%04x sp=%04x param_count=%d ESP=%x\n", 
1444
            if (loglevel & CPU_LOG_PCALL)
1445
                fprintf(logfile, "new ss:esp=%04x:%08x param_count=%d ESP=%x\n", 
1471 1446
                        ss, sp, param_count, ESP);
1472 1447
#endif
1473 1448
            if ((ss & 0xfffc) == 0)
......
1626 1601
            POPW(ssp, sp, sp_mask, new_eflags);
1627 1602
    }
1628 1603
#ifdef DEBUG_PCALL
1629
    if (loglevel) {
1630
        fprintf(logfile, "lret new %04x:%08x addend=0x%x\n",
1631
                new_cs, new_eip, addend);
1604
    if (loglevel & CPU_LOG_PCALL) {
1605
        fprintf(logfile, "lret new %04x:%08x s=%d addend=0x%x\n",
1606
                new_cs, new_eip, shift, addend);
1632 1607
        cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP);
1633 1608
    }
1634 1609
#endif
......
1673 1648
            POPW(ssp, sp, sp_mask, new_esp);
1674 1649
            POPW(ssp, sp, sp_mask, new_ss);
1675 1650
        }
1651
#ifdef DEBUG_PCALL
1652
        if (loglevel & CPU_LOG_PCALL) {
1653
            fprintf(logfile, "new ss:esp=%04x:%08x\n",
1654
                    new_ss, new_esp);
1655
        }
1656
#endif
1676 1657
        
1677 1658
        if ((new_ss & 3) != rpl)
1678 1659
            raise_exception_err(EXCP0D_GPF, new_ss & 0xfffc);

Also available in: Unified diff