--- trunk/src/cpus/generate_arm_multi.c 2007/10/08 16:19:16 19 +++ trunk/src/cpus/generate_arm_multi.c 2007/10/08 16:19:23 20 @@ -25,9 +25,10 @@ * SUCH DAMAGE. * * - * $Id: generate_arm_multi.c,v 1.6 2005/10/26 14:37:03 debug Exp $ + * $Id: generate_arm_multi.c,v 1.11 2005/11/19 18:53:07 debug Exp $ * * Generation of commonly used ARM load/store multiple instructions. + * * The main idea is to first check whether a load/store would be possible * without going outside a page, and if so, use the host_load or _store * arrays for quick access to emulated RAM. Otherwise, fall back to using @@ -93,7 +94,8 @@ exit(1); } - printf("\nX(multi_0x%08x) {\n", opcode); + printf("\nvoid arm_instr_multi_0x%08x(struct cpu *cpu," + " struct arm_instr_call *ic) {\n", opcode); printf("\tunsigned char *page;\n"); printf("\tuint32_t addr = cpu->cd.arm.r[%i];\n", r); @@ -102,8 +104,7 @@ printf("\tuint32_t tmp_pc = ((size_t)ic - (size_t)\n\t" " cpu->cd.arm.cur_ic_page) / sizeof(struct " "arm_instr_call);\n" - "\ttmp_pc = ((cpu->cd.arm.r[ARM_PC] & " - "~((ARM_IC_ENTRIES_PER_PAGE-1)" + "\ttmp_pc = ((cpu->pc & ~((ARM_IC_ENTRIES_PER_PAGE-1)" "\n\t << ARM_INSTR_ALIGNMENT_SHIFT)))\n" "\t + (tmp_pc << ARM_INSTR_ALIGNMENT_SHIFT) + 12;\n"); } @@ -147,13 +148,18 @@ if (load && w && i == r) { /* Skip the load if we're using writeback. */ - } else if (load) - printf("\t\tcpu->cd.arm.r[%i] = p[%i];\n", i, x); - else { + } else if (load) { + if (i == 15) + printf("\t\tcpu->pc = p[%i];\n", x); + else + printf("\t\tcpu->cd.arm.r[%i] = " + "p[%i];\n", i, x); + } else { if (i == 15) printf("\t\tp[%i] = tmp_pc;\n", x); else - printf("\t\tp[%i] = cpu->cd.arm.r[%i];\n", x, i); + printf("\t\tp[%i] = cpu->cd.arm.r" + "[%i];\n", x, i); } x ++; @@ -169,13 +175,18 @@ if (load && w && i == r) { /* Skip the load if we're using writeback. */ - } else if (load) - printf("\t\tcpu->cd.arm.r[%i] = p[%i];\n", i, x); - else { + } else if (load) { + if (i == 15) + printf("\t\tcpu->pc = p[%i];\n", x); + else + printf("\t\tcpu->cd.arm.r[%i] = " + "p[%i];\n", i, x); + } else { if (i == 15) printf("\t\tp[%i] = tmp_pc;\n", x); else - printf("\t\tp[%i] = cpu->cd.arm.r[%i];\n", x, i); + printf("\t\tp[%i] = " + "cpu->cd.arm.r[%i];\n", x, i); } } } @@ -185,8 +196,7 @@ r, u? "+=" : "-=", 4*n_regs); if (load && opcode & 0x8000) { - printf("\t\tcpu->pc = cpu->cd.arm.r[15];\n" - "\t\tarm_pc_to_pointers(cpu);\n"); + printf("\t\tquick_pc_to_pointers(cpu);\n"); } printf("\t} else\n"); @@ -221,7 +231,21 @@ exit(1); } - printf("\n/* AUTOMATICALLY GENERATED! Do not edit. */\n\n"); + printf("\n/* AUTOMATICALLY GENERATED! Do not edit. */\n\n" + "#include \n" + "#include \n" + "#include \"cpu.h\"\n" + "#include \"misc.h\"\n" + "#include \"arm_quick_pc_to_pointers.h\"\n" + "#include \"arm_tmphead_1.h\"\n" + "\n#define instr(x) arm_instr_ ## x\n"); + printf("extern void arm_instr_nop(struct cpu *, " + "struct arm_instr_call *);\n"); + printf("extern void arm_instr_bdt_load(struct cpu *, " + "struct arm_instr_call *);\n"); + printf("extern void arm_instr_bdt_store(struct cpu *, " + "struct arm_instr_call *);\n"); + printf("\n\n"); /* Generate the opcode functions: */ for (i=1; i