Changed return type of Find4GBBase() to u8*, since it really is a pointer (all callers were typecasting it to u8*).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@553 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
9e49eda4f1
commit
f70819197a
|
@ -106,18 +106,18 @@ void MemArena::ReleaseView(void* view, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u64 MemArena::Find4GBBase()
|
u8* MemArena::Find4GBBase()
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// 64 bit
|
// 64 bit
|
||||||
u8* base = (u8*)VirtualAlloc(0, 0xE1000000, MEM_RESERVE, PAGE_READWRITE);
|
u8* base = (u8*)VirtualAlloc(0, 0xE1000000, MEM_RESERVE, PAGE_READWRITE);
|
||||||
VirtualFree(base, 0, MEM_RELEASE);
|
VirtualFree(base, 0, MEM_RELEASE);
|
||||||
return((u64)base);
|
return base;
|
||||||
#else
|
#else
|
||||||
// Very precarious - mmap cannot return an error when trying to map already used pages.
|
// Very precarious - mmap cannot return an error when trying to map already used pages.
|
||||||
// This makes the Windows approach above unusable on Linux, so we will simply pray...
|
// This makes the Windows approach above unusable on Linux, so we will simply pray...
|
||||||
return(0x2300000000ULL);
|
return reinterpret_cast<u8*>(0x2300000000ULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -128,11 +128,11 @@ u64 MemArena::Find4GBBase()
|
||||||
if (base) {
|
if (base) {
|
||||||
VirtualFree(base, 0, MEM_RELEASE);
|
VirtualFree(base, 0, MEM_RELEASE);
|
||||||
}
|
}
|
||||||
return((u64)base);
|
return base;
|
||||||
#else
|
#else
|
||||||
void* base = mmap(0, 0x31000000, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, 0, 0);
|
void* base = mmap(0, 0x31000000, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, 0, 0);
|
||||||
munmap(base, 0x31000000);
|
munmap(base, 0x31000000);
|
||||||
return reinterpret_cast<u64>(base);
|
return static_cast<u8*>(base);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class MemArena
|
||||||
|
|
||||||
|
|
||||||
// This only finds 1 GB in 32-bit
|
// This only finds 1 GB in 32-bit
|
||||||
static u64 Find4GBBase();
|
static u8* Find4GBBase();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -449,7 +449,7 @@ bool Init()
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
//Then, in x64 mode where we have space, grab a 4GB virtual address space
|
//Then, in x64 mode where we have space, grab a 4GB virtual address space
|
||||||
//TODO: grab 8GB and align, for easier debugging
|
//TODO: grab 8GB and align, for easier debugging
|
||||||
base = (u8*)MemArena::Find4GBBase();
|
base = MemArena::Find4GBBase();
|
||||||
//OK, we know where to find free space. Now grab it!
|
//OK, we know where to find free space. Now grab it!
|
||||||
|
|
||||||
//Physical should be unmapped when not in "real mode"
|
//Physical should be unmapped when not in "real mode"
|
||||||
|
@ -478,7 +478,7 @@ bool Init()
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Do a poor mans version - just grab 1GB, possibly discontiguous, and use &0x3FFFFFFF as the mask whenever it is accessed.
|
// Do a poor mans version - just grab 1GB, possibly discontiguous, and use &0x3FFFFFFF as the mask whenever it is accessed.
|
||||||
base = (u8*)MemArena::Find4GBBase();
|
base = MemArena::Find4GBBase();
|
||||||
if (!base) {
|
if (!base) {
|
||||||
PanicAlert("Failed to grab 1 GB of contiguous memory!\nDo you have an antivirus program or any other program\n"
|
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"
|
"that injects itself into every process, consuming address space?\nOr simply a bad graphics driver?\n\n"
|
||||||
|
|
Loading…
Reference in New Issue