-// cycles after syscall/hle?
// pending_exception?
+// swi 0 in do_unalignedwritestub?
#include <stdio.h>
#include "emu_if.h"
void gen_interupt()
{
evprintf("ari64_gen_interupt\n");
- evprintf(" +ge %08x, %d->%d\n", psxRegs.pc, Count, next_interupt);
+ evprintf(" +ge %08x, %d->%d\n", psxRegs.pc, psxRegs.cycle, next_interupt);
#ifdef DRC_DBG
psxRegs.cycle += 2;
-#else
- psxRegs.cycle = Count; // stupid
#endif
psxBranchTest();
- if (psxRegs.cycle != Count) {
- printf("psxRegs.cycle != Count: %d != %d\n", psxRegs.cycle, Count);
- Count = psxRegs.cycle;
- }
-
- next_interupt = Count + psxNextCounter;
- evprintf(" -ge %08x, %d->%d\n", psxRegs.pc, Count, next_interupt);
+ next_interupt = psxNextsCounter + psxNextCounter;
+ evprintf(" -ge %08x, %d->%d\n", psxRegs.pc, psxRegs.cycle, next_interupt);
pending_exception = 1; /* FIXME */
}
static void ari64_execute()
{
- /* TODO: get rid of this cycle counter copying */
- Count = psxRegs.cycle;
- next_interupt = Count + psxNextCounter;
+ next_interupt = psxNextsCounter + psxNextCounter;
- evprintf("psxNextsCounter %d, psxNextCounter %d\n", psxNextsCounter, psxNextCounter);
- evprintf("ari64_execute %08x, %d->%d\n", psxRegs.pc, Count, next_interupt);
+ evprintf("psxNextsCounter %d, psxNextCounter %d, Count %d\n", psxNextsCounter, psxNextCounter, psxRegs.CP0.r[9]);
+ evprintf("ari64_execute %08x, %d->%d\n", psxRegs.pc, psxRegs.cycle, next_interupt);
new_dyna_start(psxRegs.pc);
- evprintf("ari64_execute end %08x, %d->%d\n", psxRegs.pc, Count, next_interupt);
-
-#ifndef DRC_DBG
- psxRegs.cycle = Count;
-#endif
+ evprintf("ari64_execute end %08x, %d->%d\n", psxRegs.pc, psxRegs.cycle, next_interupt);
}
static void ari64_clear(u32 Addr, u32 Size)
str r1, [fp, #pending_exception-dynarec_local]
and r2, r2, r10, lsr #17
add r3, fp, #restore_candidate-dynarec_local
- str r10, [fp, #reg_cop0+36-dynarec_local] /* Count */
+ str r10, [fp, #cycle-dynarec_local] /* PCSX cycles */
+@@ str r10, [fp, #reg_cop0+36-dynarec_local] /* Count */
ldr r4, [r2, r3]
mov r10, lr
tst r4, r4
.E1:
bl gen_interupt
mov lr, r10
- ldr r10, [fp, #reg_cop0+36-dynarec_local] /* Count */
+ ldr r10, [fp, #cycle-dynarec_local]
ldr r0, [fp, #next_interupt-dynarec_local]
ldr r1, [fp, #pending_exception-dynarec_local]
ldr r2, [fp, #stop-dynarec_local]
ldr r0, [fp, #pcaddr-dynarec_local]
bl get_addr_ht
ldr r1, [fp, #next_interupt-dynarec_local]
- ldr r10, [fp, #reg_cop0+36-dynarec_local] /* Count */
+ ldr r10, [fp, #cycle-dynarec_local]
str r1, [fp, #last_count-dynarec_local]
sub r10, r10, r1
add r10, r10, #2
add r2, r2, r10
mov r0, #0x20 /* cause */
str r2, [fp, #cycle-dynarec_local] /* PCSX cycle counter */
- str r2, [fp, #reg_cop0+36-dynarec_local] /* Count */
bl psxException
/* note: psxException might do recorsive recompiler call from it's HLE code,
* so be ready for this */
+pcsx_return:
+ ldr r1, [fp, #next_interupt-dynarec_local]
+ ldr r10, [fp, #cycle-dynarec_local]
ldr r0, [fp, #pcaddr-dynarec_local]
- mov r10, #0 /* FIXME */
+ sub r10, r10, r1
+ str r1, [fp, #last_count-dynarec_local]
bl get_addr_ht
mov pc, r0
.size jump_syscall_hle, .-jump_syscall_hle
add r2, r2, r10
ldr r3, [fp, #psxHLEt_addr-dynarec_local] /* psxHLEt */
str r2, [fp, #cycle-dynarec_local] /* PCSX cycle counter */
- str r2, [fp, #reg_cop0+36-dynarec_local] /* Count */
- mov lr, pc
+ adr lr, pcsx_return
ldr pc, [r3, r1, lsl #2]
-
- ldr r0, [fp, #pcaddr-dynarec_local]
- mov r10, #0 /* FIXME */
- bl get_addr_ht
- mov pc, r0
.size jump_hlecall, .-jump_hlecall
new_dyna_leave:
ldr r0, [fp, #last_count-dynarec_local]
add r12, fp, #28
add r10, r0, r10
- str r10, [fp, #reg_cop0+36-dynarec_local] /* Count */
+ str r10, [fp, #cycle-dynarec_local]
ldmia r12, {r4, r5, r6, r7, r8, r9, sl, fp, pc}
.size new_dyna_leave, .-new_dyna_leave
+ /* these are used to call memhandlers */
.align 2
.global indirect_jump_indexed
.type indirect_jump_indexed, %function
indirect_jump:
ldr r12, [fp, #last_count-dynarec_local]
add r2, r2, r12
- str r2, [fp, #reg_cop0+36-dynarec_local] /* Count */
+ str r2, [fp, #cycle-dynarec_local]
mov pc, r0
.size indirect_jump, .-indirect_jump
.size indirect_jump_indexed, .-indirect_jump_indexed
bic r1, r1, #2
add r10, r0, r10
str r1, [fp, #reg_cop0+48-dynarec_local] /* Status */
- str r10, [fp, #reg_cop0+36-dynarec_local] /* Count */
+ str r10, [fp, #cycle-dynarec_local]
bl check_interupt
ldr r1, [fp, #next_interupt-dynarec_local]
ldr r0, [fp, #reg_cop0+56-dynarec_local] /* EPC */
/*bl new_recompile_block*/
bl get_addr_ht
ldr r1, [fp, #next_interupt-dynarec_local]
- ldr r10, [fp, #reg_cop0+36-dynarec_local] /* Count */
+ ldr r10, [fp, #cycle-dynarec_local]
str r1, [fp, #last_count-dynarec_local]
sub r10, r10, r1
mov pc, r0