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

Annotation of /trunk/pcsx2/MemoryTypes.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (hide annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 6 months ago) by william
File MIME type: text/plain
File size: 4819 byte(s)
re-commit (had local access denied errors when committing)
1 william 62 /* 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 william 31
16     #pragma once
17    
18     namespace Ps2MemSize
19     {
20 william 280 static const uint MainRam = _32mb; // 32 MB main memory!
21     static const uint Rom = _1mb * 4; // 4 MB main rom
22     static const uint Rom1 = 0x00040000; // DVD player
23     static const uint Rom2 = 0x00080000; // Chinese rom extension (?)
24     static const uint ERom = 0x001C0000; // DVD player extensions (?)
25     static const uint Hardware = _64kb;
26     static const uint Scratch = _16kb;
27 william 31
28 william 280 static const uint IopRam = _1mb * 2; // 2MB main ram on the IOP.
29     static const uint IopHardware = _64kb;
30 william 31
31 william 280 static const uint GSregs = 0x00002000; // 8k for the GS registers and stuff.
32 william 31 }
33    
34     typedef u8 mem8_t;
35     typedef u16 mem16_t;
36     typedef u32 mem32_t;
37     typedef u64 mem64_t;
38 william 62 typedef u128 mem128_t;
39    
40    
41     // --------------------------------------------------------------------------------------
42     // Future-Planned VTLB pagefault scheme!
43     // --------------------------------------------------------------------------------------
44     // When enabled, the VTLB will use a large-area reserved memory range of 512megs for EE
45     // physical ram/rom access. The base ram will be committed at 0x00000000, and ROMs will be
46     // at 0x1fc00000, etc. All memory ranges in between will be uncommitted memory -- which
47     // means that the memory will *not* count against the operating system's physical memory
48     // pool.
49     //
50     // When the VTLB generates memory operations (loads/stores), it will assume that the op
51     // is addressing either RAM or ROM, and by assuming that it can generate a completely efficient
52     // direct memory access (one AND and one MOV instruction). If the access is to another area of
53     // memory, such as hardware registers or scratchpad, the access will generate a page fault, the
54     // compiled block will be cleared and re-compiled using "full" VTLB translation logic.
55     //
56 william 280 // Note that support for this feature may not be doable under x86/32 platforms, due to the
57     // 2gb/3gb limit of Windows XP (the 3gb feature will make it slightly more feasible at least).
58     //
59 william 62 #define VTLB_UsePageFaulting 0
60    
61     #if VTLB_UsePageFaulting
62    
63     // The order of the components in this struct *matter* -- it has been laid out so that the
64     // full breadth of PS2 RAM and ROM mappings are directly supported.
65     struct EEVM_MemoryAllocMess
66     {
67 william 280 u8 (&Main)[Ps2MemSize::MainRam]; // Main memory (hard-wired to 32MB)
68 william 62
69 william 280 u8 _padding1[0x1e000000-Ps2MemSize::MainRam]
70 william 62 u8 (&ROM1)[Ps2MemSize::Rom1]; // DVD player
71    
72     u8 _padding2[0x1e040000-(0x1e000000+Ps2MemSize::Rom1)]
73     u8 (&EROM)[Ps2MemSize::ERom]; // DVD player extensions
74    
75     u8 _padding3[0x1e400000-(0x1e040000+Ps2MemSize::EROM)]
76     u8 (&ROM2)[Ps2MemSize::Rom2]; // Chinese extensions
77    
78     u8 _padding4[0x1fc00000-(0x1e040000+Ps2MemSize::Rom2)];
79     u8 (&ROM)[Ps2MemSize::Rom]; // Boot rom (4MB)
80     };
81    
82     #else
83    
84     struct EEVM_MemoryAllocMess
85     {
86 william 280 u8 Main[Ps2MemSize::MainRam]; // Main memory (hard-wired to 32MB)
87 william 62 u8 Scratch[Ps2MemSize::Scratch]; // Scratchpad!
88     u8 ROM[Ps2MemSize::Rom]; // Boot rom (4MB)
89     u8 ROM1[Ps2MemSize::Rom1]; // DVD player
90     u8 ROM2[Ps2MemSize::Rom2]; // Chinese extensions
91     u8 EROM[Ps2MemSize::ERom]; // DVD player extensions
92    
93     // Two 1 megabyte (max DMA) buffers for reading and writing to high memory (>32MB).
94     // Such accesses are not documented as causing bus errors but as the memory does
95     // not exist, reads should continue to return 0 and writes should be discarded.
96     // Probably.
97    
98     u8 ZeroRead[_1mb];
99     u8 ZeroWrite[_1mb];
100     };
101    
102     #endif
103    
104 william 273 struct IopVM_MemoryAllocMess
105     {
106     u8 Main[Ps2MemSize::IopRam]; // Main memory (hard-wired to 2MB)
107 william 280 u8 P[_64kb]; // I really have no idea what this is... --air
108 william 273 u8 Sif[0x100]; // a few special SIF/SBUS registers (likely not needed)
109     };
110    
111    
112     // DevNote: EE and IOP hardware registers are done as a static array instead of a pointer in
113     // order to allow for simpler macros and reference handles to be defined (we can safely use
114     // compile-time references to registers instead of having to use instance variables).
115    
116 william 62 extern __pagealigned u8 eeHw[Ps2MemSize::Hardware];
117 william 273 extern __pagealigned u8 iopHw[Ps2MemSize::IopHardware];
118 william 62
119    
120     extern EEVM_MemoryAllocMess* eeMem;
121 william 273 extern IopVM_MemoryAllocMess* iopMem;

  ViewVC Help
Powered by ViewVC 1.1.22