1 diff --git a/libpcsxcore/new_dynarec/linkage_arm.S b/libpcsxcore/new_dynarec/linkage_arm.S
2 index d32dc0b..e52dde8 100644
3 --- a/libpcsxcore/new_dynarec/linkage_arm.S
4 +++ b/libpcsxcore/new_dynarec/linkage_arm.S
5 @@ -442,7 +442,7 @@ FUNCTION(cc_interrupt):
6 str r1, [fp, #LO_pending_exception]
7 and r2, r2, r10, lsr #17
8 add r3, fp, #LO_restore_candidate
9 - str r10, [fp, #LO_cycle] /* PCSX cycles */
10 +@@@ str r10, [fp, #LO_cycle] /* PCSX cycles */
11 @@ str r10, [fp, #LO_reg_cop0+36] /* Count */
14 @@ -530,7 +530,7 @@ FUNCTION(jump_syscall_hle):
15 mov r1, #0 /* in delay slot */
17 mov r0, #0x20 /* cause */
18 - str r2, [fp, #LO_cycle] /* PCSX cycle counter */
19 +@@@ str r2, [fp, #LO_cycle] /* PCSX cycle counter */
22 /* note: psxException might do recursive recompiler call from it's HLE code,
23 @@ -551,7 +551,7 @@ FUNCTION(jump_hlecall):
24 str r0, [fp, #LO_pcaddr]
27 - str r2, [fp, #LO_cycle] /* PCSX cycle counter */
28 +@@@ str r2, [fp, #LO_cycle] /* PCSX cycle counter */
30 .size jump_hlecall, .-jump_hlecall
32 @@ -561,7 +561,7 @@ FUNCTION(jump_intcall):
33 str r0, [fp, #LO_pcaddr]
36 - str r2, [fp, #LO_cycle] /* PCSX cycle counter */
37 +@@@ str r2, [fp, #LO_cycle] /* PCSX cycle counter */
39 .size jump_hlecall, .-jump_hlecall
41 @@ -570,7 +570,7 @@ FUNCTION(new_dyna_leave):
42 ldr r0, [fp, #LO_last_count]
45 - str r10, [fp, #LO_cycle]
46 +@@@ str r10, [fp, #LO_cycle]
47 ldmfd sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip, pc}
48 .size new_dyna_leave, .-new_dyna_leave
50 @@ -687,7 +687,7 @@ FUNCTION(new_dyna_start):
51 \readop r0, [r1, r3, lsl #\tab_shift]
54 - str r2, [fp, #LO_cycle]
55 +@@@ str r2, [fp, #LO_cycle]
59 @@ -722,7 +722,7 @@ FUNCTION(jump_handler_read32):
63 - str r2, [fp, #LO_cycle]
64 +@@@ str r2, [fp, #LO_cycle]
67 ldr r0, [fp, #LO_next_interupt]
68 @@ -750,7 +750,7 @@ FUNCTION(jump_handler_write_h):
72 - str r2, [fp, #LO_cycle]
73 +@@@ str r2, [fp, #LO_cycle]
76 ldr r0, [fp, #LO_next_interupt]
77 diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c
78 index 6d7069d..586a6db 100644
79 --- a/libpcsxcore/new_dynarec/new_dynarec.c
80 +++ b/libpcsxcore/new_dynarec/new_dynarec.c
81 @@ -38,10 +38,10 @@ static int sceBlock;
82 #include "../psxhle.h" //emulator interface
83 #include "emu_if.h" //emulator interface
86 -//#define assem_debug printf
88 +#define assem_debug printf
89 //#define inv_debug printf
90 -#define assem_debug(...)
91 +//#define assem_debug(...)
92 #define inv_debug(...)
95 @@ -362,6 +362,9 @@ static u_int get_vpage(u_int vaddr)
96 // This is called from the recompiled JR/JALR instructions
97 void *get_addr(u_int vaddr)
100 +printf("get_addr %08x, pc=%08x\n", vaddr, psxRegs.pc);
102 u_int page=get_page(vaddr);
103 u_int vpage=get_vpage(vaddr);
104 struct ll_entry *head;
105 @@ -4403,13 +4406,15 @@ void do_cc(int i,signed char i_regmap[],int *adj,int addr,int taken,int invert)
107 emit_addimm_and_set_flags(cycles,HOST_CCREG);
115 emit_cmpimm(HOST_CCREG,-CLOCK_ADJUST(count+2));
121 add_stub(CC_STUB,jaddr,idle?idle:(int)out,(*adj==0||invert||idle)?0:(count+2),i,addr,taken,0);
123 @@ -4884,7 +4889,8 @@ void rjump_assemble(int i,struct regstat *i_regs)
124 // special case for RFE
130 //load_regs_bt(branch_regs[i].regmap,branch_regs[i].is32,branch_regs[i].dirty,-1);
133 @@ -5034,7 +5040,8 @@ void cjump_assemble(int i,struct regstat *i_regs)
135 emit_addimm_and_set_flags(CLOCK_ADJUST(ccadj[i]+2),cc);
140 add_stub(CC_STUB,jaddr,(int)out,0,i,start+i*4+8,NOTTAKEN,0);
143 @@ -5300,7 +5307,8 @@ void cjump_assemble(int i,struct regstat *i_regs)
144 emit_loadreg(CCREG,HOST_CCREG);
145 emit_addimm_and_set_flags(CLOCK_ADJUST(ccadj[i]+2),HOST_CCREG);
150 add_stub(CC_STUB,jaddr,(int)out,0,i,start+i*4+8,NOTTAKEN,0);
151 emit_storereg(CCREG,HOST_CCREG);
153 @@ -5309,7 +5317,8 @@ void cjump_assemble(int i,struct regstat *i_regs)
154 assert(cc==HOST_CCREG);
155 emit_addimm_and_set_flags(CLOCK_ADJUST(ccadj[i]+2),cc);
160 add_stub(CC_STUB,jaddr,(int)out,0,i,start+i*4+8,likely[i]?NULLDS:NOTTAKEN,0);
163 @@ -5419,7 +5428,8 @@ void sjump_assemble(int i,struct regstat *i_regs)
164 else if(nevertaken) {
165 emit_addimm_and_set_flags(CLOCK_ADJUST(ccadj[i]+2),cc);
170 add_stub(CC_STUB,jaddr,(int)out,0,i,start+i*4+8,NOTTAKEN,0);
173 @@ -5628,7 +5638,8 @@ void sjump_assemble(int i,struct regstat *i_regs)
174 emit_loadreg(CCREG,HOST_CCREG);
175 emit_addimm_and_set_flags(CLOCK_ADJUST(ccadj[i]+2),HOST_CCREG);
180 add_stub(CC_STUB,jaddr,(int)out,0,i,start+i*4+8,NOTTAKEN,0);
181 emit_storereg(CCREG,HOST_CCREG);
183 @@ -5637,7 +5648,8 @@ void sjump_assemble(int i,struct regstat *i_regs)
184 assert(cc==HOST_CCREG);
185 emit_addimm_and_set_flags(CLOCK_ADJUST(ccadj[i]+2),cc);
190 add_stub(CC_STUB,jaddr,(int)out,0,i,start+i*4+8,likely[i]?NULLDS:NOTTAKEN,0);
193 @@ -5833,7 +5845,8 @@ void fjump_assemble(int i,struct regstat *i_regs)
194 emit_loadreg(CCREG,HOST_CCREG);
195 emit_addimm_and_set_flags(CLOCK_ADJUST(ccadj[i]+2),HOST_CCREG);
200 add_stub(CC_STUB,jaddr,(int)out,0,i,start+i*4+8,NOTTAKEN,0);
201 emit_storereg(CCREG,HOST_CCREG);
203 @@ -5842,7 +5855,8 @@ void fjump_assemble(int i,struct regstat *i_regs)
204 assert(cc==HOST_CCREG);
205 emit_addimm_and_set_flags(CLOCK_ADJUST(ccadj[i]+2),cc);
210 add_stub(CC_STUB,jaddr,(int)out,0,i,start+i*4+8,likely[i]?NULLDS:NOTTAKEN,0);
213 @@ -6463,7 +6477,7 @@ void unneeded_registers(int istart,int iend,int r)
214 // R0 is always unneeded
218 + unneeded_reg[i]=1;//u;
219 unneeded_reg_upper[i]=uu;
220 gte_unneeded[i]=gte_u;
222 @@ -9676,6 +9690,7 @@ int new_recompile_block(int addr)
224 // This allocates registers (if possible) one instruction prior
225 // to use, which can avoid a load-use penalty on certain CPUs.
227 for(i=0;i<slen-1;i++)
229 if(!i||(itype[i-1]!=UJUMP&&itype[i-1]!=CJUMP&&itype[i-1]!=SJUMP&&itype[i-1]!=RJUMP&&itype[i-1]!=FJUMP))
230 @@ -9832,6 +9847,7 @@ int new_recompile_block(int addr)
236 /* Pass 6 - Optimize clean/dirty state */
237 clean_registers(0,slen-1,1);
238 @@ -10149,6 +10165,11 @@ int new_recompile_block(int addr)
240 pagespan_assemble(i,®s[i]);break;
244 + if(itype[i]!=UJUMP&&itype[i]!=CJUMP&&itype[i]!=SJUMP&&itype[i]!=RJUMP)
245 + wb_dirtys(regs[i].regmap,regs[i].is32,regs[i].dirty);
247 if(itype[i]==UJUMP||itype[i]==RJUMP||(source[i]>>16)==0x1000)
250 @@ -10256,7 +10277,7 @@ int new_recompile_block(int addr)
253 // External Branch Targets (jump_in)
254 - if(copy+slen*4>(void *)shadow+sizeof(shadow)) copy=shadow;
255 + if(copy+slen*4>(void *)shadow+sizeof(shadow)) {copy=shadow;printf("shadow overflow\n");}
259 @@ -10370,6 +10391,10 @@ int new_recompile_block(int addr)
261 expirep=(expirep+1)&65535;
264 +printf("new_recompile_block done\n");