drc: rework for 64bit, part 3
[pcsx_rearmed.git] / libpcsxcore / new_dynarec / pcsxmem_inline.c
CommitLineData
b1be1eee 1/*
2 * (C) GraÅžvydas "notaz" Ignotas, 2011
3 *
4 * This work is licensed under the terms of GNU GPL version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7
19776aef 8#ifndef DRC_DBG
9
b1be1eee 10static int pcsx_direct_read(int type, u_int addr, int cc_adj, int cc, int rs, int rt)
11{
12 if ((addr & 0xfffff000) == 0x1f801000) {
13 u_int t;
14 switch (addr & 0xffff) {
15 case 0x1120: // rcnt2 count
16 if (rt < 0) goto dont_care;
17 if (cc < 0) return 0;
643aeae3 18 emit_readword(&rcnts[2].mode, HOST_TEMPREG);
19 emit_readword(&rcnts[2].cycleStart, rt);
b1be1eee 20 emit_testimm(HOST_TEMPREG, 0x200);
643aeae3 21 emit_readword(&last_count, HOST_TEMPREG);
b1be1eee 22 emit_sub(HOST_TEMPREG, rt, HOST_TEMPREG);
23 emit_add(HOST_TEMPREG, cc, HOST_TEMPREG);
24 if (cc_adj)
25 emit_addimm(HOST_TEMPREG, cc_adj, rt);
26 emit_shrne_imm(rt, 3, rt);
27 mov_loadtype_adj(type!=LOADW_STUB?type:LOADH_STUB, rt, rt);
28 goto hit;
29 case 0x1104:
30 case 0x1114:
31 case 0x1124: // rcnt mode
32 if (rt < 0) return 0;
33 t = (addr >> 4) & 3;
643aeae3 34 emit_readword(&rcnts[t].mode, rt);
b1be1eee 35 emit_andimm(rt, ~0x1800, HOST_TEMPREG);
643aeae3 36 emit_writeword(HOST_TEMPREG, &rcnts[t].mode);
b1be1eee 37 mov_loadtype_adj(type, rt, rt);
38 goto hit;
39 }
40 }
41 else {
42 if (rt < 0)
43 goto dont_care;
44 }
45
46 return 0;
47
48hit:
49 assem_debug("pcsx_direct_read %08x end\n", addr);
50 return 1;
51
52dont_care:
53 assem_debug("pcsx_direct_read %08x dummy\n", addr);
54 return 1;
55}
56
19776aef 57#else
58
59static int pcsx_direct_read(int type, u_int addr, int cc_adj, int cc, int rs, int rt)
60{
61 return 0;
62}
63
64#endif
65
b1be1eee 66// vim:shiftwidth=2:expandtab