summaryrefslogtreecommitdiff
path: root/src/common/mem_arena.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/mem_arena.h')
-rw-r--r--src/common/mem_arena.h70
1 files changed, 0 insertions, 70 deletions
diff --git a/src/common/mem_arena.h b/src/common/mem_arena.h
deleted file mode 100644
index d514fe58c..000000000
--- a/src/common/mem_arena.h
+++ /dev/null
@@ -1,70 +0,0 @@
1// Copyright (C) 2003 Dolphin Project.
2
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, version 2.0 or later versions.
6
7// This program is distributed in the hope that it will be useful,
8// but WITHOUT ANY WARRANTY; without even the implied warranty of
9// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10// GNU General Public License 2.0 for more details.
11
12// A copy of the GPL 2.0 should have been included with the program.
13// If not, see http://www.gnu.org/licenses/
14
15// Official SVN repository and contact information can be found at
16// http://code.google.com/p/dolphin-emu/
17
18#pragma once
19
20#ifdef _WIN32
21#include <windows.h>
22#endif
23
24#include "common/common_types.h"
25
26// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
27// Multiple views can mirror the same section of the block, which makes it very convient for emulating
28// memory mirrors.
29
30class MemArena
31{
32public:
33 void GrabLowMemSpace(size_t size);
34 void ReleaseSpace();
35 void *CreateView(s64 offset, size_t size, void *base = 0);
36 void ReleaseView(void *view, size_t size);
37
38 // This only finds 1 GB in 32-bit
39 static u8 *Find4GBBase();
40private:
41
42#ifdef _WIN32
43 HANDLE hMemoryMapping;
44#else
45 int fd;
46#endif
47};
48
49enum {
50 MV_MIRROR_PREVIOUS = 1,
51 // MV_FAKE_VMEM = 2,
52 // MV_WII_ONLY = 4,
53 MV_IS_PRIMARY_RAM = 0x100,
54 MV_IS_EXTRA1_RAM = 0x200,
55 MV_IS_EXTRA2_RAM = 0x400,
56};
57
58struct MemoryView
59{
60 u8 **out_ptr_low;
61 u8 **out_ptr;
62 u32 virtual_address;
63 u32 size;
64 u32 flags;
65};
66
67// Uses a memory arena to set up an emulator-friendly memory map according to
68// a passed-in list of MemoryView structures.
69u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena *arena);
70void MemoryMap_Shutdown(const MemoryView *views, int num_views, u32 flags, MemArena *arena);