1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-21 01:42:12 +00:00
Atmosphere/libraries/libstratosphere/include/stratosphere/lmem/lmem_common.hpp
SciresM 5a8aebf74d
lmem: Implement UnitHeap, ExpHeap (#823)
* lmem: implement ExpHeap

* lmem: Implement Slab^H^H^H^HUnitHeap
2020-02-24 19:44:27 -08:00

62 lines
1.6 KiB
C++

/*
* Copyright (c) 2018-2019 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vapours.hpp>
#include "impl/lmem_impl_common.hpp"
namespace ams::lmem {
enum CreateOption {
CreateOption_None = (0),
CreateOption_ZeroClear = (1 << 0),
CreateOption_DebugFill = (1 << 1),
CreateOption_ThreadSafe = (1 << 2),
};
enum FillType {
FillType_Unallocated,
FillType_Allocated,
FillType_Freed,
FillType_Count,
};
namespace impl {
struct HeapHead;
}
using HeapHandle = impl::HeapHead *;
using HeapCommonHead = impl::HeapHead;
struct MemoryRange {
uintptr_t address;
size_t size;
};
constexpr inline s32 DefaultAlignment = 0x8;
/* Common API. */
u32 GetDebugFillValue(FillType fill_type);
void SetDebugFillValue(FillType fill_type, u32 value);
size_t GetTotalSize(HeapHandle handle);
void *GetStartAddress(HeapHandle handle);
bool ContainsAddress(HeapHandle handle, const void *address);
}