/[pcsx2_0.9.7]/trunk/pcsx2/VUmicroMem.cpp
ViewVC logotype

Contents of /trunk/pcsx2/VUmicroMem.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 1 month ago) by william
File size: 2695 byte(s)
re-commit (had local access denied errors when committing)
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
17 #include "PrecompiledHeader.h"
18 #include "Common.h"
19 #include "VUmicro.h"
20
21
22 __aligned16 VURegs vuRegs[2];
23
24
25 vuMemoryReserve::vuMemoryReserve()
26 : _parent( L"VU0/1 on-chip memory", VU1_PROGSIZE + VU1_MEMSIZE + VU0_PROGSIZE + VU0_MEMSIZE )
27 {
28 }
29
30 void vuMemoryReserve::Reserve()
31 {
32 _parent::Reserve(HostMemoryMap::VUmem);
33 //_parent::Reserve(EmuConfig.HostMemMap.VUmem);
34
35 u8* curpos = m_reserve.GetPtr();
36 VU0.Micro = curpos; curpos += VU0_PROGSIZE;
37 VU0.Mem = curpos; curpos += VU0_MEMSIZE;
38 VU1.Micro = curpos; curpos += VU1_PROGSIZE;
39 VU1.Mem = curpos; curpos += VU1_MEMSIZE;
40 }
41
42 void vuMemoryReserve::Release()
43 {
44 _parent::Release();
45
46 VU0.Micro = VU0.Mem = NULL;
47 VU1.Micro = VU1.Mem = NULL;
48 }
49
50 void vuMemoryReserve::Reset()
51 {
52 _parent::Reset();
53
54 pxAssume( VU0.Mem );
55 pxAssume( VU1.Mem );
56
57 memMapVUmicro();
58
59 // === VU0 Initialization ===
60 memzero(VU0.ACC);
61 memzero(VU0.VF);
62 memzero(VU0.VI);
63 VU0.VF[0].f.x = 0.0f;
64 VU0.VF[0].f.y = 0.0f;
65 VU0.VF[0].f.z = 0.0f;
66 VU0.VF[0].f.w = 1.0f;
67 VU0.VI[0].UL = 0;
68
69 // === VU1 Initialization ===
70 memzero(VU1.ACC);
71 memzero(VU1.VF);
72 memzero(VU1.VI);
73 VU1.VF[0].f.x = 0.0f;
74 VU1.VF[0].f.y = 0.0f;
75 VU1.VF[0].f.z = 0.0f;
76 VU1.VF[0].f.w = 1.0f;
77 VU1.VI[0].UL = 0;
78 }
79
80 void SaveStateBase::vuMicroFreeze()
81 {
82 FreezeTag( "vuMicro" );
83
84 pxAssume( VU0.Mem != NULL );
85 pxAssume( VU1.Mem != NULL );
86
87 Freeze(VU0.ACC);
88
89 // Seemingly silly and pointless use of temp var: GCC is unable to bind packed fields
90 // (appears to be a bug, tracked here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36566 ).
91 // Dereferencing outside the context of the function (via a temp var) seems to circumvent it. --air
92
93 u32& temp_vu0_code = VU0.code;
94 Freeze(temp_vu0_code);
95
96 FreezeMem(VU0.Mem, 4*1024);
97 FreezeMem(VU0.Micro, 4*1024);
98
99 Freeze(VU0.VF);
100 Freeze(VU0.VI);
101
102 Freeze(VU1.ACC);
103
104 u32& temp_vu1_code = VU1.code;
105 Freeze(temp_vu1_code);
106
107 FreezeMem(VU1.Mem, 16*1024);
108 FreezeMem(VU1.Micro, 16*1024);
109
110 Freeze(VU1.VF);
111 Freeze(VU1.VI);
112 }

  ViewVC Help
Powered by ViewVC 1.1.22