X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fnew_dynarec%2Femu_if.c;h=852d881e572296d9c5c6edfd3674da617e2ecd57;hp=92eb68fda9404a50a50f86888f7db1b82a150903;hb=5b8c000f969c365d48418781d8f88f9c58d65611;hpb=2167bef61daaeb12ceb59c3c577fc636e9011d6d diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index 92eb68fd..852d881e 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -30,28 +30,19 @@ u32 event_cycles[PSXINT_COUNT]; static void schedule_timeslice(void) { u32 i, c = psxRegs.cycle; + u32 irqs = psxRegs.interrupt; s32 min, dif; - min = psxNextsCounter + psxNextCounter - c; - for (i = 0; i < ARRAY_SIZE(event_cycles); i++) { + min = PSXCLK; + for (i = 0; irqs != 0; i++, irqs >>= 1) { + if (!(irqs & 1)) + continue; dif = event_cycles[i] - c; //evprintf(" ev %d\n", dif); if (0 < dif && dif < min) min = dif; } next_interupt = c + min; - -#if 0 - static u32 cnt, last_cycle; - static u64 sum; - if (last_cycle) { - cnt++; - sum += psxRegs.cycle - last_cycle; - if ((cnt & 0xff) == 0) - printf("%u\n", (u32)(sum / cnt)); - } - last_cycle = psxRegs.cycle; -#endif } typedef void (irq_func)(); @@ -68,6 +59,7 @@ static irq_func * const irq_funcs[] = { [PSXINT_CDRDMA] = cdrDmaInterrupt, [PSXINT_CDRLID] = cdrLidSeekInterrupt, [PSXINT_CDRPLAY] = cdrPlayInterrupt, + [PSXINT_RCNT] = psxRcntUpdate, }; /* local dupe of psxBranchTest, using event_cycles */ @@ -77,9 +69,6 @@ static void irq_test(void) u32 cycle = psxRegs.cycle; u32 irq, irq_bits; - if ((psxRegs.cycle - psxNextsCounter) >= psxNextCounter) - psxRcntUpdate(); - // irq_funcs() may queue more irqs psxRegs.interrupt = 0; @@ -131,15 +120,26 @@ void pcsx_mtc0_ds(u32 reg, u32 val) void new_dyna_save(void) { + psxRegs.interrupt &= ~(1 << PSXINT_RCNT); // old savestate compat + // psxRegs.intCycle is always maintained, no need to convert } +void new_dyna_after_save(void) +{ + psxRegs.interrupt |= 1 << PSXINT_RCNT; +} + void new_dyna_restore(void) { int i; for (i = 0; i < PSXINT_COUNT; i++) event_cycles[i] = psxRegs.intCycle[i].sCycle + psxRegs.intCycle[i].cycle; + event_cycles[PSXINT_RCNT] = psxNextsCounter + psxNextCounter; + psxRegs.interrupt |= 1 << PSXINT_RCNT; + psxRegs.interrupt &= (1 << PSXINT_COUNT) - 1; + new_dyna_pcsx_mem_load_state(); } @@ -177,31 +177,6 @@ const char gte_cycletab[64] = { 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 39, }; -enum gte_opcodes { - GTE_RTPS = 0x01, - GTE_NCLIP = 0x06, - GTE_OP = 0x0c, - GTE_DPCS = 0x10, - GTE_INTPL = 0x11, - GTE_MVMVA = 0x12, - GTE_NCDS = 0x13, - GTE_CDP = 0x14, - GTE_NCDT = 0x16, - GTE_NCCS = 0x1b, - GTE_CC = 0x1c, - GTE_NCS = 0x1e, - GTE_NCT = 0x20, - GTE_SQR = 0x28, - GTE_DCPL = 0x29, - GTE_DPCT = 0x2a, - GTE_AVSZ3 = 0x2d, - GTE_AVSZ4 = 0x2e, - GTE_RTPT = 0x30, - GTE_GPF = 0x3d, - GTE_GPL = 0x3e, - GTE_NCCT = 0x3f, -}; - #define GCBIT(x) \ (1ll << (32+x)) #define GDBIT(x) \ @@ -291,24 +266,24 @@ static int ari64_init() if (psxCP2[i] != psxNULL) gte_handlers[i] = psxCP2[i]; -#if !defined(DRC_DBG) && !defined(PCNT) +#if !defined(DRC_DBG) #ifdef __arm__ gte_handlers[0x06] = gteNCLIP_arm; gte_handlers_nf[0x01] = gteRTPS_nf_arm; gte_handlers_nf[0x30] = gteRTPT_nf_arm; #endif #ifdef __ARM_NEON__ - // compiler's _nf version is still a lot slower then neon + // compiler's _nf version is still a lot slower than neon // _nf_arm RTPS is roughly the same, RTPT slower gte_handlers[0x01] = gte_handlers_nf[0x01] = gteRTPS_neon; gte_handlers[0x30] = gte_handlers_nf[0x30] = gteRTPT_neon; - gte_handlers[0x12] = gte_handlers_nf[0x12] = gteMVMVA_neon; #endif #endif #ifdef DRC_DBG memcpy(gte_handlers_nf, gte_handlers, sizeof(gte_handlers_nf)); #endif psxH_ptr = psxH; + zeromem_ptr = zero_mem; return 0; } @@ -399,14 +374,15 @@ void do_insn_cmp() {} #endif #if defined(__x86_64__) || defined(__i386__) -unsigned int address, readmem_word, word; -unsigned short hword; -unsigned char byte; +unsigned int address; int pending_exception, stop; unsigned int next_interupt; int new_dynarec_did_compile; int cycle_multiplier; +int new_dynarec_hacks; void *psxH_ptr; +void *zeromem_ptr; +u8 zero_mem[0x1000]; void new_dynarec_init() {} void new_dyna_start() {} void new_dynarec_cleanup() {}