ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/gencpu.c
(Generate patch)

Comparing BasiliskII/src/uae_cpu/gencpu.c (file contents):
Revision 1.17 by gbeauche, 2002-09-01T15:17:13Z vs.
Revision 1.21 by gbeauche, 2005-03-17T00:21:36Z

# Line 823 | Line 823 | static int source_is_imm1_8 (struct inst
823      return i->stype == 3;
824   }
825  
826 static const char * cflow_string_of(uae_u32 opcode)
827 {
828        const char * cflow_type_str;
829        
830        int cflow_type = table68k[opcode].cflow & ~fl_trap;
831        switch (cflow_type) {
832                case fl_branch:         cflow_type_str = "CFLOW_BRANCH";                break;
833                case fl_jump:           cflow_type_str = "CFLOW_JUMP";                  break;
834                case fl_return:         cflow_type_str = "CFLOW_RETURN";                break;
835                default:                        cflow_type_str = "CFLOW_NORMAL";
836        }
837        
838        /* Patch M68K_EXEC_RETURN instruction */
839        if (table68k[opcode].mnemo == i_EMULOP_RETURN)
840                cflow_type_str = "CFLOW_EXEC_RETURN";
841        
842        return cflow_type_str;
843 }
844
826   static void gen_opcode (unsigned long int opcode)
827   {
828      struct instr *curi = table68k + opcode;
# Line 1345 | Line 1326 | static void gen_opcode (unsigned long in
1326          }
1327          printf ("\tm68k_incpc ((uae_s32)src + 2);\n");
1328          fill_prefetch_0 ();
1329 <        printf ("cpuop_return(%s);\n", cflow_string_of(opcode));
1329 >        printf ("return;\n");
1330          printf ("didnt_jump:;\n");
1331          need_endlabel = 1;
1332          }
# Line 1378 | Line 1359 | static void gen_opcode (unsigned long in
1359          }
1360          printf ("\t\t\tm68k_incpc((uae_s32)offs + 2);\n");
1361          fill_prefetch_0 ();
1362 <        printf ("cpuop_return(%s);\n", cflow_string_of(opcode));
1362 >        printf ("return;\n");
1363          printf ("\t\t}\n");
1364          printf ("\t}\n");
1365          need_endlabel = 1;
# Line 2113 | Line 2094 | static void gen_opcode (unsigned long in
2094          genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
2095          sync_m68k_pc ();
2096          swap_opcode ();
2097 <        printf ("\tfpp_opp(opcode,extra);\n");
2097 >        printf ("\tfpuop_arithmetic(opcode, extra);\n");
2098          break;
2099       case i_FDBcc:
2100          genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
2101          sync_m68k_pc ();
2102          swap_opcode ();
2103 <        printf ("\tfdbcc_opp(opcode,extra);\n");
2103 >        printf ("\tfpuop_dbcc(opcode, extra);\n");
2104          break;
2105       case i_FScc:
2106          genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
2107          sync_m68k_pc ();
2108          swap_opcode ();
2109 <        printf ("\tfscc_opp(opcode,extra);\n");
2109 >        printf ("\tfpuop_scc(opcode,extra);\n");
2110          break;
2111       case i_FTRAPcc:
2112          sync_m68k_pc ();
# Line 2135 | Line 2116 | static void gen_opcode (unsigned long in
2116              genamode (curi->smode, "srcreg", curi->size, "dummy", 1, 0);
2117          sync_m68k_pc ();
2118          swap_opcode ();
2119 <        printf ("\tftrapcc_opp(opcode,oldpc);\n");
2119 >        printf ("\tfpuop_trapcc(opcode,oldpc);\n");
2120          break;
2121       case i_FBcc:
2122          sync_m68k_pc ();
# Line 2144 | Line 2125 | static void gen_opcode (unsigned long in
2125          genamode (curi->dmode, "srcreg", curi->size, "extra", 1, 0);
2126          sync_m68k_pc ();
2127          swap_opcode ();
2128 <        printf ("\tfbcc_opp(opcode,pc,extra);\n");
2128 >        printf ("\tfpuop_bcc(opcode,pc,extra);\n");
2129          break;
2130       case i_FSAVE:
2131          sync_m68k_pc ();
2132          swap_opcode ();
2133 <        printf ("\tfsave_opp(opcode);\n");
2133 >        printf ("\tfpuop_save(opcode);\n");
2134          break;
2135       case i_FRESTORE:
2136          sync_m68k_pc ();
2137          swap_opcode ();
2138 <        printf ("\tfrestore_opp(opcode);\n");
2138 >        printf ("\tfpuop_restore(opcode);\n");
2139          break;
2140       case i_CINVL:
2141       case i_CINVP:
2142       case i_CINVA:
2143 +        /* gb-- srcreg now contains the cache field */
2144 +        printf ("\tif (srcreg&0x2)\n");
2145 +        printf ("\t\tflush_icache(%d);\n", 30 + ((opcode >> 3) & 3));
2146 +        break;
2147       case i_CPUSHL:
2148       case i_CPUSHP:
2149       case i_CPUSHA:
2150 +        /* gb-- srcreg now contains the cache field */
2151 +        printf ("\tif (srcreg&0x2)\n");
2152 +        printf ("\t\tflush_icache(%d);\n", 40 + ((opcode >> 3) & 3));
2153          break;
2154       case i_MOVE16:
2155          if ((opcode & 0xfff8) == 0xf620) {
# Line 2227 | Line 2215 | static void generate_includes (FILE * f)
2215      fprintf (f, "#include \"memory.h\"\n");
2216      fprintf (f, "#include \"readcpu.h\"\n");
2217      fprintf (f, "#include \"newcpu.h\"\n");
2218 +    fprintf (f, "#include \"compiler/compemu.h\"\n");
2219 +    fprintf (f, "#include \"fpu/fpu.h\"\n");
2220      fprintf (f, "#include \"cputbl.h\"\n");
2221          
2222          fprintf (f, "#define SET_CFLG_ALWAYS(x) SET_CFLG(x)\n");
# Line 2274 | Line 2264 | static void generate_one_opcode (int rp)
2264  
2265      fprintf (headerfile, "extern cpuop_func op_%lx_%d_nf;\n", opcode, postfix);
2266      fprintf (headerfile, "extern cpuop_func op_%lx_%d_ff;\n", opcode, postfix);
2267 <    printf ("cpuop_rettype REGPARAM2 CPUFUNC(op_%lx_%d)(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
2267 >    printf ("void REGPARAM2 CPUFUNC(op_%lx_%d)(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
2268          printf ("\tcpuop_begin();\n");
2269          
2270          /* gb-- The "nf" variant for an instruction that doesn't set the condition
# Line 2405 | Line 2395 | static void generate_one_opcode (int rp)
2395          printf ("%s: ;\n", endlabelstr);
2396          if (table68k[opcode].flagdead == 0)
2397          printf ("\n#endif\n");
2398 <        printf ("\tcpuop_end(%s);\n", cflow_string_of(opcode));
2398 >        printf ("\tcpuop_end();\n");
2399      printf ("}\n");
2400      opcode_next_clev[rp] = next_cpu_level;
2401      opcode_last_postfix[rp] = postfix;
# Line 2480 | Line 2470 | int main (int argc, char **argv)
2470       * cputbl.h that way), but cpuopti can't cope.  That could be fixed, but
2471       * I don't dare to touch the 68k version.  */
2472  
2473 <    headerfile = fopen ("cputbl.h", "wb");
2474 <    stblfile = fopen ("cpustbl.cpp", "wb");
2475 <    freopen ("cpuemu.cpp", "wb", stdout);
2473 >    headerfile = fopen ("cputbl.h", "w");
2474 >    stblfile = fopen ("cpustbl.cpp", "w");
2475 >    FILE *out = freopen ("cpuemu.cpp", "w", stdout);
2476  
2477      generate_includes (stdout);
2478      generate_includes (stblfile);
# Line 2490 | Line 2480 | int main (int argc, char **argv)
2480      generate_func ();
2481  
2482      free (table68k);
2483 +    fclose (headerfile);
2484 +    fclose (stblfile);
2485 +    fflush (out);
2486      return 0;
2487   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines