2014-08-01 18:27:48 +02:00
|
|
|
#include "stdafx.h"
|
2014-08-31 11:54:12 +02:00
|
|
|
#include "Memory.h"
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
2014-10-01 11:45:43 +02:00
|
|
|
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
|
|
|
|
|
|
2014-10-01 11:45:43 +02:00
|
|
|
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
|
2014-08-01 18:27:48 +02:00
|
|
|
|
|
|
|
|
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.
|
2014-08-01 18:27:48 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-31 01:06:43 +02:00
|
|
|
//TODO
|
2014-08-01 18:27:48 +02:00
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|