--- trunk/src/cpus/generate_tail.c 2007/10/08 16:19:11 18 +++ trunk/src/cpus/generate_tail.c 2007/10/08 16:21:17 34 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Anders Gavare. All rights reserved. + * Copyright (C) 2005-2007 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: generate_tail.c,v 1.6 2005/10/22 17:24:21 debug Exp $ + * $Id: generate_tail.c,v 1.15 2007/02/02 17:44:04 debug Exp $ */ #include @@ -35,7 +35,7 @@ char *uppercase(char *l) { static char staticbuf[1000]; - int i = 0; + size_t i = 0; while (*l && i < sizeof(staticbuf)) { char u = *l++; @@ -66,6 +66,10 @@ printf("\n/*\n * AUTOMATICALLY GENERATED! Do not edit.\n */\n\n"); + printf("extern size_t dyntrans_cache_size;\n"); + printf("extern int native_code_translation_enabled;\n"); + printf("#include \"native.h\"\n"); + printf("#ifdef DYNTRANS_32\n"); printf("#define MODE32\n"); printf("#endif\n"); @@ -75,6 +79,11 @@ printf("#include \"cpu_dyntrans.c\"\n"); printf("#undef DYNTRANS_FUNCTION_TRACE\n\n"); + printf("#define DYNTRANS_INIT_TABLES " + "%s_cpu_init_tables\n", a); + printf("#include \"cpu_dyntrans.c\"\n"); + printf("#undef DYNTRANS_INIT_TABLES\n\n"); + printf("#define DYNTRANS_TC_ALLOCATE_DEFAULT_PAGE " "%s_tc_allocate_default_page\n", a); printf("#include \"cpu_dyntrans.c\"\n"); @@ -123,8 +132,14 @@ printf("#define MODE_uint_t uint32_t\n"); printf("#define MODE_int_t int32_t\n"); printf("#endif\n"); + printf("#define COMBINE(n) %s_combine_ ## n\n", a); + printf("#include \"quick_pc_to_pointers.h\"\n"); printf("#include \"cpu_%s_instr.c\"\n\n", a); + printf("#define DYNTRANS_RUN_INSTR %s_run_instr\n", a); + printf("#include \"cpu_dyntrans.c\"\n"); + printf("#undef DYNTRANS_RUN_INSTR\n\n"); + printf("#ifdef DYNTRANS_DUALMODE_32\n"); printf("#undef COMBINE_INSTRUCTIONS\n"); @@ -169,26 +184,21 @@ printf("#include \"cpu_dyntrans.c\"\n"); printf("#undef DYNTRANS_PC_TO_POINTERS_FUNC\n\n"); printf("#undef DYNTRANS_PC_TO_POINTERS_GENERIC\n\n"); + printf("#undef COMBINE\n"); + printf("#define COMBINE(n) %s32_combine_ ## n\n", a); + printf("#include \"quick_pc_to_pointers.h\"\n"); printf("#include \"cpu_%s_instr.c\"\n", a); printf("\n#undef DYNTRANS_PC_TO_POINTERS\n" "#define DYNTRANS_PC_TO_POINTERS %s_pc_to_pointers\n" "#define DYNTRANS_PC_TO_POINTERS32 %s32_pc_to_pointers\n\n", a, a); - printf("#endif /* DYNTRANS_DUALMODE_32 */\n\n\n"); - - - printf("#define DYNTRANS_CPU_RUN_INSTR %s_cpu_run_instr\n", a); + printf("#define DYNTRANS_RUN_INSTR %s32_run_instr\n", a); printf("#include \"cpu_dyntrans.c\"\n"); - printf("#undef DYNTRANS_CPU_RUN_INSTR\n\n"); + printf("#undef DYNTRANS_RUN_INSTR\n\n"); + + printf("#endif /* DYNTRANS_DUALMODE_32 */\n\n\n"); - printf("#define CPU_RUN %s_cpu_run\n", a); - printf("#define CPU_RINSTR %s_cpu_run_instr\n", a); - printf("#define CPU_RUN_%s\n", uppercase(a)); - printf("#include \"cpu_run.c\"\n"); - printf("#undef CPU_RINSTR\n"); - printf("#undef CPU_RUN_%s\n", uppercase(a)); - printf("#undef CPU_RUN\n\n"); printf("CPU_FAMILY_INIT(%s,\"%s\")\n\n", a, b);