mirror of
https://github.com/bkaradzic/bx.git
synced 2026-10-30 20:45:42 +00:00
Added Android memoryMap, DirectoryReader, process memory, and NEON signbitsmask. (#479)
This commit is contained in:
+7
-9
@@ -34,7 +34,8 @@
|
||||
# endif // !BX_PLATFORM_PS4 && !BX_PLATFORM_PS5
|
||||
|
||||
# if BX_PLATFORM_ANDROID
|
||||
# include <malloc.h> // mallinfo
|
||||
# include <stdio.h> // fopen
|
||||
# include <sys/mman.h>
|
||||
# elif BX_PLATFORM_LINUX \
|
||||
|| BX_PLATFORM_RPI
|
||||
# include <stdio.h> // fopen
|
||||
@@ -157,10 +158,7 @@ namespace bx
|
||||
|
||||
size_t getProcessMemoryUsed()
|
||||
{
|
||||
#if BX_PLATFORM_ANDROID
|
||||
struct mallinfo mi = mallinfo();
|
||||
return mi.uordblks;
|
||||
#elif BX_PLATFORM_LINUX
|
||||
#if BX_PLATFORM_ANDROID || BX_PLATFORM_LINUX
|
||||
FILE* file = fopen("/proc/self/statm", "r");
|
||||
if (NULL == file)
|
||||
{
|
||||
@@ -504,7 +502,7 @@ namespace bx
|
||||
|
||||
namespace
|
||||
{
|
||||
#if BX_PLATFORM_LINUX || BX_PLATFORM_OSX
|
||||
#if BX_PLATFORM_ANDROID || BX_PLATFORM_LINUX || BX_PLATFORM_OSX
|
||||
static int32_t toPosixProt(uint32_t _protect)
|
||||
{
|
||||
switch (_protect)
|
||||
@@ -557,7 +555,7 @@ namespace bx
|
||||
BX_ASSERT(_alignment <= granularity, "Alignments greater than the allocation granularity are not implemented (requested %zu, granularity %zu).", _alignment, granularity);
|
||||
BX_UNUSED(_alignment, granularity);
|
||||
|
||||
#if BX_PLATFORM_LINUX || BX_PLATFORM_OSX
|
||||
#if BX_PLATFORM_ANDROID || BX_PLATFORM_LINUX || BX_PLATFORM_OSX
|
||||
if (NULL == _address)
|
||||
{
|
||||
if (0 == (state & Memory::Reserve) )
|
||||
@@ -737,7 +735,7 @@ namespace bx
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
|
||||
#if BX_PLATFORM_LINUX || BX_PLATFORM_OSX
|
||||
#if BX_PLATFORM_ANDROID || BX_PLATFORM_LINUX || BX_PLATFORM_OSX
|
||||
int32_t result = munmap(_address, _size);
|
||||
|
||||
if (-1 == result)
|
||||
@@ -768,7 +766,7 @@ namespace bx
|
||||
{
|
||||
const uint32_t page = _flags & Memory::PageMask;
|
||||
|
||||
#if BX_PLATFORM_LINUX || BX_PLATFORM_OSX
|
||||
#if BX_PLATFORM_ANDROID || BX_PLATFORM_LINUX || BX_PLATFORM_OSX
|
||||
if (0 != (page & Memory::PageHuge) )
|
||||
{
|
||||
return 1ull << 30; // 1 GiB nominal
|
||||
|
||||
Reference in New Issue
Block a user