src/emu/cpu/cpu.mak
| r9881 | r9882 | |
| 832 | 832 | ifneq ($(filter MIPS,$(CPUS)),) |
| 833 | 833 | OBJDIRS += $(CPUOBJ)/mips |
| 834 | 834 | CPUOBJS += $(CPUOBJ)/mips/r3000.o |
| 835 | | CPUOBJS += $(CPUOBJ)/mips/mips3com.o $(CPUOBJ)/mips/mips3fe.o $(CPUOBJ)/mips/mips3drc.o $(DRCOBJ) |
| 835 | CPUOBJS += $(CPUOBJ)/mips/mips3com.o $(CPUOBJ)/mips/mips3.o $(CPUOBJ)/mips/mips3fe.o $(CPUOBJ)/mips/mips3drc.o $(DRCOBJ) |
| 836 | 836 | CPUOBJS += $(CPUOBJ)/mips/psx.o |
| 837 | 837 | DASMOBJS += $(CPUOBJ)/mips/r3kdasm.o |
| 838 | 838 | DASMOBJS += $(CPUOBJ)/mips/mips3dsm.o |
| r9881 | r9882 | |
| 842 | 842 | $(CPUOBJ)/mips/r3000.o: $(CPUSRC)/mips/r3000.c \ |
| 843 | 843 | $(CPUSRC)/mips/r3000.h |
| 844 | 844 | |
| 845 | $(CPUOBJ)/mips/mips3.o: $(CPUSRC)/mips/mips3.h \ |
| 846 | $(CPUSRC)/mips/mips3com.h \ |
| 847 | $(CPUSRC)/mips/mips3.c |
| 848 | |
| 845 | 849 | $(CPUOBJ)/mips/mips3com.o: $(CPUSRC)/mips/mips3.h \ |
| 846 | 850 | $(CPUSRC)/mips/mips3com.h |
| 847 | 851 | |
src/emu/cpu/mips/mips3.c
| r9881 | r9882 | |
| 11 | 11 | |
| 12 | 12 | #include "emu.h" |
| 13 | 13 | #include "debugger.h" |
| 14 | #include "profiler.h" |
| 15 | #include "mips3.h" |
| 14 | 16 | #include "mips3com.h" |
| 15 | 17 | |
| 16 | 18 | |
| 17 | 19 | #define ENABLE_OVERFLOWS 0 |
| 18 | 20 | |
| 21 | #ifndef MIPS3_USE_DRC |
| 19 | 22 | |
| 20 | 23 | /*************************************************************************** |
| 21 | 24 | HELPER MACROS |
| r9881 | r9882 | |
| 98 | 101 | int interrupt_cycles; |
| 99 | 102 | UINT32 ll_value; |
| 100 | 103 | UINT64 lld_value; |
| 104 | UINT32 badcop_value; |
| 101 | 105 | const vtlb_entry *tlb_table; |
| 102 | 106 | |
| 103 | 107 | /* endian-dependent load/store */ |
| r9881 | r9882 | |
| 156 | 160 | #define ROPCODE(pc) mips3.core.direct->read_decrypted_dword(pc) |
| 157 | 161 | |
| 158 | 162 | |
| 163 | /*************************************************************************** |
| 164 | DRC COMPATIBILITY |
| 165 | ***************************************************************************/ |
| 159 | 166 | |
| 167 | void mips3drc_set_options(device_t *device, UINT32 options) |
| 168 | { |
| 169 | } |
| 170 | |
| 171 | void mips3drc_add_fastram(device_t *device, offs_t start, offs_t end, UINT8 readonly, void *base) |
| 172 | { |
| 173 | } |
| 174 | |
| 175 | void mips3drc_add_hotspot(device_t *device, offs_t pc, UINT32 opcode, UINT32 cycles) |
| 176 | { |
| 177 | } |
| 178 | |
| 160 | 179 | /*************************************************************************** |
| 161 | 180 | EXECEPTION HANDLING |
| 162 | 181 | ***************************************************************************/ |
| r9881 | r9882 | |
| 183 | 202 | /* put the cause in the low 8 bits and clear the branch delay flag */ |
| 184 | 203 | CAUSE = (CAUSE & ~0x800000ff) | (exception << 2); |
| 185 | 204 | |
| 205 | /* set the appropriate bits for coprocessor exceptions */ |
| 206 | if(exception == EXCEPTION_BADCOP) |
| 207 | { |
| 208 | CAUSE |= mips3.badcop_value << 28; |
| 209 | } |
| 210 | |
| 186 | 211 | /* if we were in a branch delay slot, adjust */ |
| 187 | 212 | if (mips3.nextpc != ~0) |
| 188 | 213 | { |
| r9881 | r9882 | |
| 567 | 592 | INLINE void handle_cop0(UINT32 op) |
| 568 | 593 | { |
| 569 | 594 | if ((SR & SR_KSU_MASK) != SR_KSU_KERNEL && !(SR & SR_COP0)) |
| 595 | { |
| 596 | mips3.badcop_value = 0; |
| 570 | 597 | generate_exception(EXCEPTION_BADCOP, 1); |
| 598 | } |
| 571 | 599 | |
| 572 | 600 | switch (RSREG) |
| 573 | 601 | { |
| r9881 | r9882 | |
| 703 | 731 | /* note: additional condition codes available on R5000 only */ |
| 704 | 732 | |
| 705 | 733 | if (!(SR & SR_COP1)) |
| 734 | { |
| 735 | mips3.badcop_value = 1; |
| 706 | 736 | generate_exception(EXCEPTION_BADCOP, 1); |
| 737 | } |
| 707 | 738 | |
| 708 | 739 | switch (RSREG) |
| 709 | 740 | { |
| r9881 | r9882 | |
| 1059 | 1090 | /* note: additional condition codes available on R5000 only */ |
| 1060 | 1091 | |
| 1061 | 1092 | if (!(SR & SR_COP1)) |
| 1093 | { |
| 1094 | mips3.badcop_value = 1; |
| 1062 | 1095 | generate_exception(EXCEPTION_BADCOP, 1); |
| 1096 | } |
| 1063 | 1097 | |
| 1064 | 1098 | switch (RSREG) |
| 1065 | 1099 | { |
| r9881 | r9882 | |
| 1419 | 1453 | UINT32 temp; |
| 1420 | 1454 | |
| 1421 | 1455 | if (!(SR & SR_COP1)) |
| 1456 | { |
| 1457 | mips3.badcop_value = 1; |
| 1422 | 1458 | generate_exception(EXCEPTION_BADCOP, 1); |
| 1459 | } |
| 1423 | 1460 | |
| 1424 | 1461 | switch (op & 0x3f) |
| 1425 | 1462 | { |
| r9881 | r9882 | |
| 1495 | 1532 | UINT32 temp; |
| 1496 | 1533 | |
| 1497 | 1534 | if (!(SR & SR_COP1)) |
| 1535 | { |
| 1536 | mips3.badcop_value = 1; |
| 1498 | 1537 | generate_exception(EXCEPTION_BADCOP, 1); |
| 1538 | } |
| 1499 | 1539 | |
| 1500 | 1540 | switch (op & 0x3f) |
| 1501 | 1541 | { |
| r9881 | r9882 | |
| 1593 | 1633 | INLINE void handle_cop2(UINT32 op) |
| 1594 | 1634 | { |
| 1595 | 1635 | if (!(SR & SR_COP2)) |
| 1636 | { |
| 1637 | mips3.badcop_value = 2; |
| 1596 | 1638 | generate_exception(EXCEPTION_BADCOP, 1); |
| 1639 | } |
| 1597 | 1640 | |
| 1598 | 1641 | switch (RSREG) |
| 1599 | 1642 | { |
| r9881 | r9882 | |
| 2546 | 2589 | } |
| 2547 | 2590 | } |
| 2548 | 2591 | |
| 2549 | | void mips3drc_set_options(running_device *device, UINT32 options) |
| 2550 | | { |
| 2551 | | } |
| 2552 | | |
| 2553 | | void mips3drc_add_fastram(running_device *device, offs_t start, offs_t end, UINT8 readonly, void *base) |
| 2554 | | { |
| 2555 | | } |
| 2556 | | |
| 2557 | 2592 | DEFINE_LEGACY_CPU_DEVICE(VR4300BE, vr4300be); |
| 2558 | 2593 | DEFINE_LEGACY_CPU_DEVICE(VR4300LE, vr4300le); |
| 2559 | 2594 | DEFINE_LEGACY_CPU_DEVICE(VR4310BE, vr4310be); |
| r9881 | r9882 | |
| 2576 | 2611 | |
| 2577 | 2612 | DEFINE_LEGACY_CPU_DEVICE(RM7000BE, rm7000be); |
| 2578 | 2613 | DEFINE_LEGACY_CPU_DEVICE(RM7000LE, rm7000le); |
| 2614 | |
| 2615 | #endif |