22 |
|
#include "memory.h" |
23 |
|
#include "readcpu.h" |
24 |
|
#include "newcpu.h" |
25 |
+ |
#include "fpu/fpu.h" |
26 |
|
|
27 |
< |
#if defined(ENABLE_EXCLUSIVE_SPCFLAGS) && !defined(HAVE_HARDWARE_LOCKS) && defined(HAVE_PTHREADS) |
28 |
< |
#include <pthread.h> |
28 |
< |
pthread_mutex_t spcflags_lock = PTHREAD_MUTEX_INITIALIZER; |
27 |
> |
#if defined(ENABLE_EXCLUSIVE_SPCFLAGS) && !defined(HAVE_HARDWARE_LOCKS) |
28 |
> |
B2_mutex *spcflags_lock = NULL; |
29 |
|
#endif |
30 |
|
|
31 |
|
#if ENABLE_MON |
51 |
|
int movem_index2[256]; |
52 |
|
int movem_next[256]; |
53 |
|
|
54 |
– |
int fpp_movem_index1[256]; |
55 |
– |
int fpp_movem_index2[256]; |
56 |
– |
int fpp_movem_next[256]; |
57 |
– |
|
54 |
|
cpuop_func *cpufunctbl[65536]; |
55 |
|
|
56 |
|
#define FLIGHT_RECORDER 0 |
232 |
|
movem_index2[i] = 7-j; |
233 |
|
movem_next[i] = i & (~(1 << j)); |
234 |
|
} |
239 |
– |
for (i = 0 ; i < 256 ; i++) { |
240 |
– |
int j; |
241 |
– |
for (j = 7 ; j >= 0 ; j--) { |
242 |
– |
if (i & (1 << j)) break; |
243 |
– |
} |
244 |
– |
fpp_movem_index1[i] = 7-j; |
245 |
– |
fpp_movem_index2[i] = j; |
246 |
– |
fpp_movem_next[i] = i & (~(1 << j)); |
247 |
– |
} |
235 |
|
#if COUNT_INSTRS |
236 |
|
{ |
237 |
|
FILE *f = fopen (icountfilename (), "r"); |
252 |
|
do_merges (); |
253 |
|
|
254 |
|
build_cpufunctbl (); |
255 |
< |
|
256 |
< |
fpu_init (); |
257 |
< |
fpu_set_integral_fpu (CPUType == 4); |
255 |
> |
|
256 |
> |
#if defined(ENABLE_EXCLUSIVE_SPCFLAGS) && !defined(HAVE_HARDWARE_LOCKS) |
257 |
> |
spcflags_lock = B2_create_mutex(); |
258 |
> |
#endif |
259 |
> |
fpu_init(CPUType == 4); |
260 |
|
} |
261 |
|
|
262 |
|
void exit_m68k (void) |
263 |
|
{ |
264 |
|
fpu_exit (); |
265 |
+ |
#if defined(ENABLE_EXCLUSIVE_SPCFLAGS) && !defined(HAVE_HARDWARE_LOCKS) |
266 |
+ |
B2_delete_mutex(spcflags_lock); |
267 |
+ |
#endif |
268 |
|
} |
269 |
|
|
270 |
|
struct regstruct regs, lastint_regs; |
1429 |
|
printf ("T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IMASK=%d\n", |
1430 |
|
regs.t1, regs.t0, regs.s, regs.m, |
1431 |
|
GET_XFLG, GET_NFLG, GET_ZFLG, GET_VFLG, GET_CFLG, regs.intmask); |
1432 |
< |
for (i = 0; i < 8; i++){ |
1433 |
< |
printf ("FP%d: %g ", i, regs.fp[i]); |
1434 |
< |
if ((i & 3) == 3) printf ("\n"); |
1435 |
< |
} |
1444 |
< |
printf ("N=%d Z=%d I=%d NAN=%d\n", |
1445 |
< |
(regs.fpsr & 0x8000000) != 0, |
1446 |
< |
(regs.fpsr & 0x4000000) != 0, |
1447 |
< |
(regs.fpsr & 0x2000000) != 0, |
1448 |
< |
(regs.fpsr & 0x1000000) != 0); |
1449 |
< |
|
1432 |
> |
|
1433 |
> |
fpu_dump_registers(); |
1434 |
> |
fpu_dump_flags(); |
1435 |
> |
|
1436 |
|
m68k_disasm(m68k_getpc (), nextpc, 1); |
1437 |
|
if (nextpc) |
1438 |
|
printf ("next PC: %08lx\n", *nextpc); |