summaryrefslogtreecommitdiff
path: root/Source/Core/Common/MemArena.cpp
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-11-02 19:12:21 -0800
committerJasper St. Pierre <jstpierre@mecheye.net>2014-11-02 19:25:42 -0800
commit5e5ed07b4140b98d2bee9128ad096cfae6c21f8b (patch)
treeecd0be57d5b870b3ae6dab402ffa851611dc2f5f /Source/Core/Common/MemArena.cpp
parent64540bc60d86c9cf48b26fd8b181e1b0a5a6400f (diff)
MemArena: Fix the calculation of position in SHM
The code to calculate the offsets into the SHM file wasn't properly respecting the skip flags, causing it to calculate offsets beyond the end of the SHM file.
Diffstat (limited to 'Source/Core/Common/MemArena.cpp')
-rw-r--r--Source/Core/Common/MemArena.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/Common/MemArena.cpp b/Source/Core/Common/MemArena.cpp
index 119549f06d..15de0c37b9 100644
--- a/Source/Core/Common/MemArena.cpp
+++ b/Source/Core/Common/MemArena.cpp
@@ -176,15 +176,17 @@ static bool Memory_TryBase(u8 *base, MemoryView *views, int num_views, u32 flags
// We just mimic the popular BAT setup.
u32 shm_position = 0;
- // Zero all the pointers to be sure.
for (int i = 0; i < num_views; i++)
{
+ // Zero all the pointers to be sure.
views[i].mapped_ptr = nullptr;
- if (!(views[i].flags & MV_MIRROR_PREVIOUS) && i > 0)
- shm_position += views[i - 1].size;
+ SKIP(flags, views[i].flags);
views[i].shm_position = shm_position;
+
+ if (!(views[i].flags & MV_MIRROR_PREVIOUS))
+ shm_position += views[i].size;
}
int i;