예제 #1
0
int write_mi_regs(void* opaque, uint32_t address, uint32_t value, uint32_t mask)
{
    struct r4300_core* r4300 = (struct r4300_core*)opaque;
    uint32_t reg = mi_reg(address);
    const uint32_t* cp0_regs = r4300_cp0_regs();

    switch(reg)
    {
    case MI_INIT_MODE_REG:
        if (update_mi_init_mode(&r4300->mi.regs[MI_INIT_MODE_REG], value & mask) != 0)
        {
            clear_rcp_interrupt(r4300, MI_INTR_DP);
        }
        break;
    case MI_INTR_MASK_REG:
        update_mi_intr_mask(&r4300->mi.regs[MI_INTR_MASK_REG], value & mask);

        check_interupt();
        cp0_update_count();
        if (next_interupt <= cp0_regs[CP0_COUNT_REG]) gen_interupt();
        break;
    }

    return 0;
}
예제 #2
0
EXPORT void * CALL DebugGetCPUDataPtr(m64p_dbg_cpu_data cpu_data_type)
{
    switch (cpu_data_type)
    {
        case M64P_CPU_PC:
            return r4300_pc();
        case M64P_CPU_REG_REG:
            return r4300_regs();
        case M64P_CPU_REG_HI:
            return r4300_mult_hi();
        case M64P_CPU_REG_LO:
            return r4300_mult_lo();
        case M64P_CPU_REG_COP0:
            return r4300_cp0_regs();
        case M64P_CPU_REG_COP1_DOUBLE_PTR:
            return r4300_cp1_regs_double();
        case M64P_CPU_REG_COP1_SIMPLE_PTR:
            return r4300_cp1_regs_simple();
        case M64P_CPU_REG_COP1_FGR_64:
            return r4300_cp1_regs();
        case M64P_CPU_TLB:
            return g_dev.r4300.cp0.tlb.entries;
        default:
            DebugMessage(M64MSG_ERROR, "Bug: DebugGetCPUDataPtr() called with invalid input m64p_dbg_cpu_data");
            return NULL;
    }
}
static uint32_t get_remaining_dma_length(struct ai_controller* ai)
{
   uint64_t dma_length;
   unsigned int next_ai_event;
   unsigned int remaining_dma_duration;
   const uint32_t* cp0_regs;

   if (ai->fifo[0].duration == 0)
      return 0;

   cp0_update_count();
   next_ai_event          = get_event(AI_INT);

   if (next_ai_event == 0)
      return 0;

   cp0_regs = r4300_cp0_regs();
   if (next_ai_event <= cp0_regs[CP0_COUNT_REG])
      return 0;

   remaining_dma_duration = next_ai_event - cp0_regs[CP0_COUNT_REG];

   dma_length = (uint64_t)remaining_dma_duration * ai->fifo[0].length / ai->fifo[0].duration;
   return dma_length & ~7;
}
예제 #4
0
void gensyscall(void)
{
#ifdef INTERPRET_SYSCALL
   gencallinterp((unsigned int)cached_interpreter_table.SYSCALL, 0);
#else
   free_all_registers();
   simplify_access();
   mov_m32_imm32(&r4300_cp0_regs()[CP0_CAUSE_REG], 8 << 2);
   gencallinterp((unsigned int)exception_general, 0);
#endif
}