rpcsx/rpcs3/Emu/Memory/vm.cpp

47 lines
871 B
C++
Raw Normal View History

#include "stdafx.h"
2014-08-31 11:54:12 +02:00
#include "Memory.h"
#ifdef _WIN32
#include <Windows.h>
void* const g_base_addr = VirtualAlloc(nullptr, 0x100000000, MEM_RESERVE, PAGE_NOACCESS);
2014-08-31 11:54:12 +02:00
#else
#include <sys/mman.h>
/* OS X uses MAP_ANON instead of MAP_ANONYMOUS */
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
void* const g_base_addr = ::mmap(nullptr, 0x100000000, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
2014-08-31 11:54:12 +02:00
#endif
namespace vm
{
bool check_addr(u32 addr)
{
2014-08-31 01:06:43 +02:00
// Checking address before using it is unsafe.
// The only safe way to check it is to protect both actions (checking and using) with mutex that is used for mapping/allocation.
return false;
}
2014-08-31 01:06:43 +02:00
//TODO
bool map(u32 addr, u32 size, u32 flags)
{
return false;
}
bool unmap(u32 addr, u32 size, u32 flags)
{
return false;
}
u32 alloc(u32 size)
{
return 0;
}
void unalloc(u32 addr)
{
}
}