From a50871f87c9656b24038ebc8a1bcf232aad17a55 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Fri, 13 Sep 2002 12:50:56 +0000 Subject: [PATCH] Updates for new FPU core architecture --- BasiliskII/src/uae_cpu/gencpu.c | 15 ++++++++------- BasiliskII/src/uae_cpu/newcpu.cpp | 32 ++++++------------------------- BasiliskII/src/uae_cpu/newcpu.h | 20 ------------------- 3 files changed, 14 insertions(+), 53 deletions(-) diff --git a/BasiliskII/src/uae_cpu/gencpu.c b/BasiliskII/src/uae_cpu/gencpu.c index b966fc55..db169e8c 100644 --- a/BasiliskII/src/uae_cpu/gencpu.c +++ b/BasiliskII/src/uae_cpu/gencpu.c @@ -2113,19 +2113,19 @@ static void gen_opcode (unsigned long int opcode) genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0); sync_m68k_pc (); swap_opcode (); - printf ("\tfpp_opp(opcode,extra);\n"); + printf ("\tfpuop_arithmetic(opcode, extra);\n"); break; case i_FDBcc: genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0); sync_m68k_pc (); swap_opcode (); - printf ("\tfdbcc_opp(opcode,extra);\n"); + printf ("\tfpuop_dbcc(opcode, extra);\n"); break; case i_FScc: genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0); sync_m68k_pc (); swap_opcode (); - printf ("\tfscc_opp(opcode,extra);\n"); + printf ("\tfpuop_scc(opcode,extra);\n"); break; case i_FTRAPcc: sync_m68k_pc (); @@ -2135,7 +2135,7 @@ static void gen_opcode (unsigned long int opcode) genamode (curi->smode, "srcreg", curi->size, "dummy", 1, 0); sync_m68k_pc (); swap_opcode (); - printf ("\tftrapcc_opp(opcode,oldpc);\n"); + printf ("\tfpuop_trapcc(opcode,oldpc);\n"); break; case i_FBcc: sync_m68k_pc (); @@ -2144,17 +2144,17 @@ static void gen_opcode (unsigned long int opcode) genamode (curi->dmode, "srcreg", curi->size, "extra", 1, 0); sync_m68k_pc (); swap_opcode (); - printf ("\tfbcc_opp(opcode,pc,extra);\n"); + printf ("\tfpuop_bcc(opcode,pc,extra);\n"); break; case i_FSAVE: sync_m68k_pc (); swap_opcode (); - printf ("\tfsave_opp(opcode);\n"); + printf ("\tfpuop_save(opcode);\n"); break; case i_FRESTORE: sync_m68k_pc (); swap_opcode (); - printf ("\tfrestore_opp(opcode);\n"); + printf ("\tfpuop_restore(opcode);\n"); break; case i_CINVL: case i_CINVP: @@ -2227,6 +2227,7 @@ static void generate_includes (FILE * f) fprintf (f, "#include \"memory.h\"\n"); fprintf (f, "#include \"readcpu.h\"\n"); fprintf (f, "#include \"newcpu.h\"\n"); + fprintf (f, "#include \"fpu/fpu.h\"\n"); fprintf (f, "#include \"cputbl.h\"\n"); fprintf (f, "#define SET_CFLG_ALWAYS(x) SET_CFLG(x)\n"); diff --git a/BasiliskII/src/uae_cpu/newcpu.cpp b/BasiliskII/src/uae_cpu/newcpu.cpp index 670f2954..f0e5d817 100644 --- a/BasiliskII/src/uae_cpu/newcpu.cpp +++ b/BasiliskII/src/uae_cpu/newcpu.cpp @@ -22,6 +22,7 @@ extern int intlev(void); // From baisilisk_glue.cpp #include "memory.h" #include "readcpu.h" #include "newcpu.h" +#include "fpu/fpu.h" #if defined(ENABLE_EXCLUSIVE_SPCFLAGS) && !defined(HAVE_HARDWARE_LOCKS) B2_mutex *spcflags_lock = NULL; @@ -50,10 +51,6 @@ int movem_index1[256]; int movem_index2[256]; int movem_next[256]; -int fpp_movem_index1[256]; -int fpp_movem_index2[256]; -int fpp_movem_next[256]; - cpuop_func *cpufunctbl[65536]; #define FLIGHT_RECORDER 0 @@ -235,15 +232,6 @@ void init_m68k (void) movem_index2[i] = 7-j; movem_next[i] = i & (~(1 << j)); } - for (i = 0 ; i < 256 ; i++) { - int j; - for (j = 7 ; j >= 0 ; j--) { - if (i & (1 << j)) break; - } - fpp_movem_index1[i] = 7-j; - fpp_movem_index2[i] = j; - fpp_movem_next[i] = i & (~(1 << j)); - } #if COUNT_INSTRS { FILE *f = fopen (icountfilename (), "r"); @@ -268,9 +256,7 @@ void init_m68k (void) #if defined(ENABLE_EXCLUSIVE_SPCFLAGS) && !defined(HAVE_HARDWARE_LOCKS) spcflags_lock = B2_create_mutex(); #endif - - fpu_init (); - fpu_set_integral_fpu (CPUType == 4); + fpu_init(CPUType == 4); } void exit_m68k (void) @@ -1443,16 +1429,10 @@ void m68k_dumpstate (uaecptr *nextpc) printf ("T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IMASK=%d\n", regs.t1, regs.t0, regs.s, regs.m, GET_XFLG, GET_NFLG, GET_ZFLG, GET_VFLG, GET_CFLG, regs.intmask); - for (i = 0; i < 8; i++){ - printf ("FP%d: %g ", i, regs.fp[i]); - if ((i & 3) == 3) printf ("\n"); - } - printf ("N=%d Z=%d I=%d NAN=%d\n", - (regs.fpsr & 0x8000000) != 0, - (regs.fpsr & 0x4000000) != 0, - (regs.fpsr & 0x2000000) != 0, - (regs.fpsr & 0x1000000) != 0); - + + fpu_dump_registers(); + fpu_dump_flags(); + m68k_disasm(m68k_getpc (), nextpc, 1); if (nextpc) printf ("next PC: %08lx\n", *nextpc); diff --git a/BasiliskII/src/uae_cpu/newcpu.h b/BasiliskII/src/uae_cpu/newcpu.h index ac559e5d..743c8cb1 100644 --- a/BasiliskII/src/uae_cpu/newcpu.h +++ b/BasiliskII/src/uae_cpu/newcpu.h @@ -20,10 +20,6 @@ extern int movem_index1[256]; extern int movem_index2[256]; extern int movem_next[256]; -extern int fpp_movem_index1[256]; -extern int fpp_movem_index2[256]; -extern int fpp_movem_next[256]; - extern int broken_in; /* Control flow information */ @@ -83,9 +79,6 @@ struct regstruct { flagtype x; flagtype stopped; - double fp[8]; - uae_u32 fpcr,fpsr,fpiar; - #if USE_PREFETCH_BUFFER /* Fellow sources say this is 4 longwords. That's impossible. It needs * to be at least a longword. The HRM has some cryptic comment about two @@ -264,19 +257,6 @@ extern int m68k_do_specialties(void); extern void mmu_op (uae_u32, uae_u16); -extern void fpp_opp (uae_u32, uae_u16); -extern void fdbcc_opp (uae_u32, uae_u16); -extern void fscc_opp (uae_u32, uae_u16); -extern void ftrapcc_opp (uae_u32,uaecptr); -extern void fbcc_opp (uae_u32, uaecptr, uae_u32); -extern void fsave_opp (uae_u32); -extern void frestore_opp (uae_u32); - -extern void fpu_set_integral_fpu (bool is_integral); -extern void fpu_init (void); -extern void fpu_exit (void); -extern void fpu_reset (void); - /* Opcode of faulting instruction */ extern uae_u16 last_op_for_exception_3; /* PC at fault time */