AuroraRuntime/Source/Memory/Memory.cpp
Reece 0fb514f856 New memory APIs
[+] AuMemory::Cache
[+] AuMemory::SwapLock
[+] AuMemory::Transition

AuROXTL
[+] AuPageRoundUp
[+] AuPageRound
2022-03-21 05:20:19 +00:00

73 lines
1.6 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Memory.cpp
Date: 2021-6-12
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "Memory.hpp"
#include <mimalloc.h>
#include <Source/HWInfo/HWInfo.hpp>
#if defined(AURORA_IS_LINUX_DERIVED)
#include <sys/mman.h>
#endif
namespace Aurora::Memory
{
AUKN_SYM AuUInt GetChunkSize(const void *head)
{
return mi_malloc_size(head);
}
AUKN_SYM void *_ZAlloc(Types::size_t length)
{
return mi_zalloc(length);
}
AUKN_SYM void *_ZAlloc(Types::size_t length, Types::size_t align)
{
return mi_zalloc_aligned(length, align);
}
AUKN_SYM void *_FAlloc(Types::size_t length)
{
return mi_malloc(length);
}
AUKN_SYM void *_FAlloc(Types::size_t length, Types::size_t align)
{
return mi_malloc_aligned(length, align);
}
AUKN_SYM void *_ZRealloc(void *buffer, Types::size_t length, Types::size_t align)
{
return mi_rezalloc_aligned(buffer, length, align);
}
AUKN_SYM void *_ZRealloc(void *buffer, Types::size_t length)
{
return mi_rezalloc(buffer, length);
}
AUKN_SYM void *_FRealloc(void *buffer, Types::size_t length, Types::size_t align)
{
return mi_realloc_aligned(buffer, length, align);
}
AUKN_SYM void *_FRealloc(void *buffer, Types::size_t length)
{
return mi_realloc(buffer, length);
}
AUKN_SYM void _Free(void *buffer)
{
mi_free(buffer);
}
AUKN_SYM AuUInt GetPageSize()
{
return AuHwInfo::GetPageSize();
}
}