From 8248a8d13728a40ae779c8fab233d2eff8c4880b Mon Sep 17 00:00:00 2001 From: hrydgard Date: Mon, 14 Jul 2008 19:02:05 +0000 Subject: [PATCH] Reduce contiguous memory space requirement in 32-bit mode slightly. Could help some people who get the error message. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/MemArena.cpp | 3 ++- Source/Core/Core/Src/HW/Memmap.cpp | 5 ++++- Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/Src/MemArena.cpp b/Source/Core/Common/Src/MemArena.cpp index 0634c20b39..f577373fdd 100644 --- a/Source/Core/Common/Src/MemArena.cpp +++ b/Source/Core/Common/Src/MemArena.cpp @@ -104,7 +104,8 @@ u64 MemArena::Find4GBBase() { #ifdef _M_X64 #ifdef _WIN32 - u8* base = (u8*)VirtualAlloc(0, 0x100000000, MEM_RESERVE, PAGE_READWRITE); + // The highest thing in any 1GB section of memory space is the locked cache. We only need to fit it. + u8* base = (u8*)VirtualAlloc(0, 0xE1000000, MEM_RESERVE, PAGE_READWRITE); VirtualFree(base, 0, MEM_RELEASE); return((u64)base); diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index a00d279603..93b0f62a09 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -470,7 +470,10 @@ bool Init() // Do a poor mans version - just grab 1GB, possibly discontiguous, and use &0x3FFFFFFF as the mask whenever it is accessed. base = (u8*)MemArena::Find4GBBase(); if (!base) { - PanicAlert("Failed to grab 1 GB of contiguous memory!"); + PanicAlert("Failed to grab 1 GB of contiguous memory!\nDo you have an antivirus program or any other program\n" + "that injects itself into every process, consuming address space?\nOr simply a bad graphics driver?\n\n" + "Dolphin will handle this better in the future by falling back to slow memory emulation.\n" + "For now, sorry, but it won't work. Try the 64-bit build if you can."); } position = 0; m_pPhysicalRAM = (u8*)g_arena.CreateViewAt(position, RAM_SIZE, base + (0x00000000 & MEMVIEW32_MASK)); diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index 5389c2a497..b623e8aa01 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -569,6 +569,7 @@ namespace Jit64 MOV(16, R(EAX), MComplex(RBX, gpr.R(inst.RA).GetSimpleReg(), 1, offset)); MOV(32, M(&temp64), R(EAX)); MOVD_xmm(XMM0, M(&temp64)); + // SSE4 optimization opportunity here. PXOR(XMM1, R(XMM1)); PUNPCKLBW(XMM0, R(XMM1)); PUNPCKLWD(XMM0, R(XMM1));