X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fr3000a.h;h=49afcb1cd6fa966b2402c563356e89619ae555db;hb=df717ca9bf196fd40134d16f94b7f3c774f2c897;hp=7e9ba1c3ae0818e7f7bc363810ded3b9b64f23bc;hpb=528ad661dd07067cbcd6c1beebad63fc36795759;p=pcsx_rearmed.git diff --git a/libpcsxcore/r3000a.h b/libpcsxcore/r3000a.h index 7e9ba1c3..49afcb1c 100644 --- a/libpcsxcore/r3000a.h +++ b/libpcsxcore/r3000a.h @@ -29,24 +29,29 @@ extern "C" { #include "psxcounters.h" #include "psxbios.h" +enum { + R3000ACPU_NOTIFY_CACHE_ISOLATED = 0, + R3000ACPU_NOTIFY_CACHE_UNISOLATED = 1, + R3000ACPU_NOTIFY_DMA3_EXE_LOAD = 2 +}; + typedef struct { int (*Init)(); void (*Reset)(); void (*Execute)(); /* executes up to a break */ void (*ExecuteBlock)(); /* executes up to a jump */ void (*Clear)(u32 Addr, u32 Size); + void (*Notify)(int note, void *data); + void (*ApplyConfig)(); void (*Shutdown)(); } R3000Acpu; extern R3000Acpu *psxCpu; extern R3000Acpu psxInt; -#if (defined(__x86_64__) || defined(__i386__) || defined(__sh__) || defined(__ppc__) || defined(__arm__)) && !defined(NOPSXREC) extern R3000Acpu psxRec; -#define PSXREC -#endif typedef union { -#if defined(__BIGENDIAN__) +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ struct { u8 h3, h2, h, l; } b; struct { s8 h3, h2, h, l; } sb; struct { u16 h, l; } w; @@ -154,20 +159,41 @@ enum { PSXINT_SPUDMA, PSXINT_GPUBUSY, PSXINT_MDECINDMA, + PSXINT_GPUOTCDMA, + PSXINT_CDRDMA, PSXINT_NEWDRC_CHECK, + PSXINT_RCNT, + PSXINT_CDRLID, + PSXINT_CDRPLAY_OLD, /* unused */ + PSXINT_SPU_UPDATE, PSXINT_COUNT }; +typedef struct psxCP2Regs { + psxCP2Data CP2D; /* Cop2 data registers */ + psxCP2Ctrl CP2C; /* Cop2 control registers */ +} psxCP2Regs; + typedef struct { psxGPRRegs GPR; /* General Purpose Registers */ psxCP0Regs CP0; /* Coprocessor0 Registers */ - psxCP2Data CP2D; /* Cop2 data registers */ - psxCP2Ctrl CP2C; /* Cop2 control registers */ + union { + struct { + psxCP2Data CP2D; /* Cop2 data registers */ + psxCP2Ctrl CP2C; /* Cop2 control registers */ + }; + psxCP2Regs CP2; + }; u32 pc; /* Program counter */ u32 code; /* The instruction */ u32 cycle; u32 interrupt; struct { u32 sCycle, cycle; } intCycle[32]; + u32 gteBusyCycle; + u32 muldivBusyCycle; + // warning: changing anything in psxRegisters requires update of all + // asm in libpcsxcore/new_dynarec/, but this member can be replaced + u32 reserved[2]; } psxRegisters; extern psxRegisters psxRegs; @@ -176,21 +202,24 @@ extern psxRegisters psxRegs; extern u32 event_cycles[PSXINT_COUNT]; extern u32 next_interupt; -void new_dyna_save(void); -void new_dyna_restore(void); +void new_dyna_before_save(void); +void new_dyna_after_save(void); +void new_dyna_freeze(void *f, int mode); -#define new_dyna_set_event(e, c) { \ - s32 c_ = c; \ - u32 abs_ = psxRegs.cycle + c_; \ - s32 odi_ = next_interupt - psxRegs.cycle; \ +#define new_dyna_set_event_abs(e, abs) { \ + u32 abs_ = abs; \ + s32 di_ = next_interupt - abs_; \ event_cycles[e] = abs_; \ - if (c_ < odi_) { \ - /*printf("%u: next_interupt %d -> %d (%u)\n", psxRegs.cycle, odi_, c_, abs_);*/ \ + if (di_ > 0) { \ + /*printf("%u: next_interupt %u -> %u\n", psxRegs.cycle, next_interupt, abs_);*/ \ next_interupt = abs_; \ } \ } -#if defined(__BIGENDIAN__) +#define new_dyna_set_event(e, c) \ + new_dyna_set_event_abs(e, psxRegs.cycle + (c)) + +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #define _i32(x) *(s32 *)&x #define _u32(x) x