/[pcsx2_0.9.7]/trunk/pcsx2/Memory.h
ViewVC logotype

Contents of /trunk/pcsx2/Memory.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (10 years, 2 months ago) by william
File MIME type: text/plain
File size: 6023 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16 #pragma once
17
18 #ifdef __LINUX__
19 #include <signal.h>
20 #endif
21
22 //#define ENABLECACHE
23 #include "vtlb.h"
24
25 #include <xmmintrin.h>
26
27 static __fi void CopyQWC( void* dest, const void* src )
28 {
29 _mm_store_ps( (float*)dest, _mm_load_ps((const float*)src) );
30 }
31
32 static __fi void ZeroQWC( void* dest )
33 {
34 _mm_store_ps( (float*)dest, _mm_setzero_ps() );
35 }
36
37 static __fi void ZeroQWC( u128& dest )
38 {
39 _mm_store_ps( (float*)&dest, _mm_setzero_ps() );
40 }
41
42 #define PSM(mem) (vtlb_GetPhyPtr((mem)&0x1fffffff)) //pcsx2 is a competition.The one with most hacks wins :D
43
44 #define psHs8(mem) (*(s8 *)&eeHw[(mem) & 0xffff])
45 #define psHs16(mem) (*(s16*)&eeHw[(mem) & 0xffff])
46 #define psHs32(mem) (*(s32*)&eeHw[(mem) & 0xffff])
47 #define psHs64(mem) (*(s64*)&eeHw[(mem) & 0xffff])
48 #define psHu8(mem) (*(u8 *)&eeHw[(mem) & 0xffff])
49 #define psHu16(mem) (*(u16*)&eeHw[(mem) & 0xffff])
50 #define psHu32(mem) (*(u32*)&eeHw[(mem) & 0xffff])
51 #define psHu64(mem) (*(u64*)&eeHw[(mem) & 0xffff])
52 #define psHu128(mem)(*(u128*)&eeHw[(mem) & 0xffff])
53
54 #define psMs8(mem) (*(s8 *)&eeMem->Main[(mem) & 0x1ffffff])
55 #define psMs16(mem) (*(s16*)&eeMem->Main[(mem) & 0x1ffffff])
56 #define psMs32(mem) (*(s32*)&eeMem->Main[(mem) & 0x1ffffff])
57 #define psMs64(mem) (*(s64*)&eeMem->Main[(mem) & 0x1ffffff])
58 #define psMu8(mem) (*(u8 *)&eeMem->Main[(mem) & 0x1ffffff])
59 #define psMu16(mem) (*(u16*)&eeMem->Main[(mem) & 0x1ffffff])
60 #define psMu32(mem) (*(u32*)&eeMem->Main[(mem) & 0x1ffffff])
61 #define psMu64(mem) (*(u64*)&eeMem->Main[(mem) & 0x1ffffff])
62
63 #define psRs8(mem) (*(s8 *)&eeMem->ROM[(mem) & 0x3fffff])
64 #define psRs16(mem) (*(s16*)&eeMem->ROM[(mem) & 0x3fffff])
65 #define psRs32(mem) (*(s32*)&eeMem->ROM[(mem) & 0x3fffff])
66 #define psRs64(mem) (*(s64*)&eeMem->ROM[(mem) & 0x3fffff])
67 #define psRu8(mem) (*(u8 *)&eeMem->ROM[(mem) & 0x3fffff])
68 #define psRu16(mem) (*(u16*)&eeMem->ROM[(mem) & 0x3fffff])
69 #define psRu32(mem) (*(u32*)&eeMem->ROM[(mem) & 0x3fffff])
70 #define psRu64(mem) (*(u64*)&eeMem->ROM[(mem) & 0x3fffff])
71
72 #define psR1s8(mem) (*(s8 *)&eeMem->ROM1[(mem) & 0x3ffff])
73 #define psR1s16(mem) (*(s16*)&eeMem->ROM1[(mem) & 0x3ffff])
74 #define psR1s32(mem) (*(s32*)&eeMem->ROM1[(mem) & 0x3ffff])
75 #define psR1s64(mem) (*(s64*)&eeMem->ROM1[(mem) & 0x3ffff])
76 #define psR1u8(mem) (*(u8 *)&eeMem->ROM1[(mem) & 0x3ffff])
77 #define psR1u16(mem) (*(u16*)&eeMem->ROM1[(mem) & 0x3ffff])
78 #define psR1u32(mem) (*(u32*)&eeMem->ROM1[(mem) & 0x3ffff])
79 #define psR1u64(mem) (*(u64*)&eeMem->ROM1[(mem) & 0x3ffff])
80
81 #define psR2s8(mem) (*(s8 *)&eeMem->ROM2[(mem) & 0x3ffff])
82 #define psR2s16(mem) (*(s16*)&eeMem->ROM2[(mem) & 0x3ffff])
83 #define psR2s32(mem) (*(s32*)&eeMem->ROM2[(mem) & 0x3ffff])
84 #define psR2s64(mem) (*(s64*)&eeMem->ROM2[(mem) & 0x3ffff])
85 #define psR2u8(mem) (*(u8 *)&eeMem->ROM2[(mem) & 0x3ffff])
86 #define psR2u16(mem) (*(u16*)&eeMem->ROM2[(mem) & 0x3ffff])
87 #define psR2u32(mem) (*(u32*)&eeMem->ROM2[(mem) & 0x3ffff])
88 #define psR2u64(mem) (*(u64*)&eeMem->ROM2[(mem) & 0x3ffff])
89
90 #define psERs8(mem) (*(s8 *)&eeMem->EROM[(mem) & 0x3ffff])
91 #define psERs16(mem) (*(s16*)&eeMem->EROM[(mem) & 0x3ffff])
92 #define psERs32(mem) (*(s32*)&eeMem->EROM[(mem) & 0x3ffff])
93 #define psERs64(mem) (*(s64*)&eeMem->EROM[(mem) & 0x3ffff])
94 #define psERu8(mem) (*(u8 *)&eeMem->EROM[(mem) & 0x3ffff])
95 #define psERu16(mem) (*(u16*)&eeMem->EROM[(mem) & 0x3ffff])
96 #define psERu32(mem) (*(u32*)&eeMem->EROM[(mem) & 0x3ffff])
97 #define psERu64(mem) (*(u64*)&eeMem->EROM[(mem) & 0x3ffff])
98
99 #define psSs32(mem) (*(s32 *)&eeMem->Scratch[(mem) & 0x3fff])
100 #define psSs64(mem) (*(s64 *)&eeMem->Scratch[(mem) & 0x3fff])
101 #define psSs128(mem) (*(s128*)&eeMem->Scratch[(mem) & 0x3fff])
102 #define psSu32(mem) (*(u32 *)&eeMem->Scratch[(mem) & 0x3fff])
103 #define psSu64(mem) (*(u64 *)&eeMem->Scratch[(mem) & 0x3fff])
104 #define psSu128(mem) (*(u128*)&eeMem->Scratch[(mem) & 0x3fff])
105
106 extern void memAlloc();
107 extern void memReset(); // clears PS2 ram and loads the bios. Throws Exception::FileNotFound on error.
108 extern void memShutdown();
109 extern void memSetKernelMode();
110 //extern void memSetSupervisorMode();
111 extern void memSetUserMode();
112 extern void memSetPageAddr(u32 vaddr, u32 paddr);
113 extern void memClearPageAddr(u32 vaddr);
114 extern void memBindConditionalHandlers();
115
116 extern void memMapVUmicro();
117
118 extern int mmap_GetRamPageInfo( u32 paddr );
119 extern void mmap_MarkCountedRamPage( u32 paddr );
120 extern void mmap_ResetBlockTracking();
121
122 #define memRead8 vtlb_memRead<mem8_t>
123 #define memRead16 vtlb_memRead<mem16_t>
124 #define memRead32 vtlb_memRead<mem32_t>
125
126 #define memWrite8 vtlb_memWrite<mem8_t>
127 #define memWrite16 vtlb_memWrite<mem16_t>
128 #define memWrite32 vtlb_memWrite<mem32_t>
129
130 static __fi void memRead64(u32 mem, mem64_t* out) { vtlb_memRead64(mem, out); }
131 static __fi void memRead64(u32 mem, mem64_t& out) { vtlb_memRead64(mem, &out); }
132
133 static __fi void memRead128(u32 mem, mem128_t* out) { vtlb_memRead128(mem, out); }
134 static __fi void memRead128(u32 mem, mem128_t& out) { vtlb_memRead128(mem, &out); }
135
136 static __fi void memWrite64(u32 mem, const mem64_t* val) { vtlb_memWrite64(mem, val); }
137 static __fi void memWrite64(u32 mem, const mem64_t& val) { vtlb_memWrite64(mem, &val); }
138 static __fi void memWrite128(u32 mem, const mem128_t* val) { vtlb_memWrite128(mem, val); }
139 static __fi void memWrite128(u32 mem, const mem128_t& val) { vtlb_memWrite128(mem, &val); }
140
141
142 extern u16 ba0R16(u32 mem);

  ViewVC Help
Powered by ViewVC 1.1.22