~ubuntu-branches/ubuntu/lucid/basilisk2/lucid

« back to all changes in this revision

Viewing changes to src/uae_cpu/newcpu.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-03-06 19:33:01 UTC
  • mfrom: (2.1.4 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080306193301-cc2ofn705nfsq3y0
Tags: 0.9.20070407-4
* Update copyright-check cdbs snippet to parse licensecheck using perl:
  + No longer randomly drops newlines
  + More compact hint file (and ordered more like wiki-proposed new copyright
    syntax).
  + No longer ignore files without copyright.
* Update copyright_hints.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
#if FLIGHT_RECORDER
57
57
struct rec_step {
 
58
        uae_u32 pc;
 
59
#if FLIGHT_RECORDER >= 2
58
60
        uae_u32 d[8];
59
61
        uae_u32 a[8];
60
 
        uae_u32 pc;
 
62
#endif
61
63
};
62
64
 
63
 
const int LOG_SIZE = 8192;
 
65
const int LOG_SIZE = 32768;
64
66
static rec_step log[LOG_SIZE];
65
67
static int log_ptr = -1; // First time initialization
66
68
 
72
74
 
73
75
void m68k_record_step(uaecptr pc)
74
76
{
75
 
        for (int i = 0; i < 8; i++) {
76
 
                log[log_ptr].d[i] = m68k_dreg(regs, i);
77
 
                log[log_ptr].a[i] = m68k_areg(regs, i);
 
77
#if FLIGHT_RECORDER >= 2
 
78
        /* XXX: if LSB is set, we are recording from generated code and we
 
79
           don't support registers recording yet.  */
 
80
        if ((pc & 1) == 0) {
 
81
                for (int i = 0; i < 8; i++) {
 
82
                        log[log_ptr].d[i] = m68k_dreg(regs, i);
 
83
                        log[log_ptr].a[i] = m68k_areg(regs, i);
 
84
                }
78
85
        }
 
86
#endif
79
87
        log[log_ptr].pc = pc;
80
88
        log_ptr = (log_ptr + 1) % LOG_SIZE;
81
89
}
87
95
                return;
88
96
        for (int i = 0; i < LOG_SIZE; i++) {
89
97
                int j = (i + log_ptr) % LOG_SIZE;
90
 
                fprintf(f, "pc %08x\n", log[j].pc);
91
 
                fprintf(f, "d0 %08x d1 %08x d2 %08x d3 %08x\n", log[j].d[0], log[j].d[1], log[j].d[2], log[j].d[3]);
92
 
                fprintf(f, "d4 %08x d5 %08x d6 %08x d7 %08x\n", log[j].d[4], log[j].d[5], log[j].d[6], log[j].d[7]);
93
 
                fprintf(f, "a0 %08x a1 %08x a2 %08x a3 %08x\n", log[j].a[0], log[j].a[1], log[j].a[2], log[j].a[3]);
94
 
                fprintf(f, "a4 %08x a5 %08x a6 %08x a7 %08x\n", log[j].a[4], log[j].a[5], log[j].a[6], log[j].a[7]);
 
98
                uae_u32 pc = log[j].pc & ~1;
 
99
                fprintf(f, "pc %08x", pc);
 
100
#if FLIGHT_RECORDER >= 2
 
101
                fprintf(f, "\n");
 
102
                if ((log[j].pc & 1) == 0) {
 
103
                        fprintf(f, "d0 %08x d1 %08x d2 %08x d3 %08x\n", log[j].d[0], log[j].d[1], log[j].d[2], log[j].d[3]);
 
104
                        fprintf(f, "d4 %08x d5 %08x d6 %08x d7 %08x\n", log[j].d[4], log[j].d[5], log[j].d[6], log[j].d[7]);
 
105
                        fprintf(f, "a0 %08x a1 %08x a2 %08x a3 %08x\n", log[j].a[0], log[j].a[1], log[j].a[2], log[j].a[3]);
 
106
                        fprintf(f, "a4 %08x a5 %08x a6 %08x a7 %08x\n", log[j].a[4], log[j].a[5], log[j].a[6], log[j].a[7]);
 
107
                }
 
108
#else
 
109
                fprintf(f, " | ");
 
110
#endif
95
111
#if ENABLE_MON
96
 
                disass_68k(f, log[j].pc);
 
112
                disass_68k(f, pc);
97
113
#endif
98
114
        }
99
115
        fclose(f);
100
116
}
101
117
#endif
102
118
 
 
119
#if ENABLE_MON
 
120
static void dump_regs(void)
 
121
{
 
122
        m68k_dumpstate(NULL);
 
123
}
 
124
#endif
 
125
 
103
126
#define COUNT_INSTRS 0
104
127
 
105
128
#if COUNT_INSTRS
1152
1175
    fpu_reset();
1153
1176
        
1154
1177
#if FLIGHT_RECORDER
 
1178
        log_ptr = 0;
 
1179
        memset(log, 0, sizeof(log));
 
1180
#endif
 
1181
 
1155
1182
#if ENABLE_MON
1156
 
        if (log_ptr == -1) {
 
1183
        static bool first_time = true;
 
1184
        if (first_time) {
 
1185
                first_time = false;
 
1186
                mon_add_command("regs", dump_regs, "regs                    Dump m68k emulator registers\n");
 
1187
#if FLIGHT_RECORDER
1157
1188
                // Install "log" command in mon
1158
1189
                mon_add_command("log", dump_log, "log                      Dump m68k emulation log\n");
 
1190
#endif
1159
1191
        }
1160
1192
#endif
1161
 
        log_ptr = 0;
1162
 
        memset(log, 0, sizeof(log));
1163
 
#endif
1164
1193
}
1165
1194
 
1166
1195
void m68k_emulop_return(void)
1320
1349
                m68k_record_step(m68k_getpc());
1321
1350
#endif
1322
1351
                (*cpufunctbl[opcode])(opcode);
 
1352
                cpu_check_ticks();
1323
1353
                if (SPCFLAGS_TEST(SPCFLAG_ALL_BUT_EXEC_RETURN)) {
1324
1354
                        if (m68k_do_specialties())
1325
1355
                                return;
1327
1357
        }
1328
1358
}
1329
1359
 
1330
 
#if USE_JIT && !defined(X86_ASSEMBLY)
1331
 
void m68k_compile_execute (void)
1332
 
{
1333
 
    for (;;) {
1334
 
          if (quit_program)
1335
 
                break;
1336
 
          m68k_do_compile_execute();
1337
 
    }
1338
 
}
1339
 
#endif
1340
 
 
1341
1360
void m68k_execute (void)
1342
1361
{
1343
1362
#if USE_JIT