mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-13 22:54:24 -04:00
fusee_cpp: implement emummc/system partition mounting
This commit is contained in:
parent
8560713a60
commit
2f7012cbc6
15 changed files with 1009 additions and 18 deletions
|
@ -20,13 +20,15 @@ namespace ams::nxboot {
|
|||
|
||||
void *AllocateMemory(size_t size);
|
||||
|
||||
template<typename T>
|
||||
inline T *AllocateObject() {
|
||||
void * const mem = AllocateMemory(sizeof(T) + alignof(T));
|
||||
ALWAYS_INLINE void *AllocateAligned(size_t size, size_t align) {
|
||||
return reinterpret_cast<void *>(util::AlignUp(reinterpret_cast<uintptr_t>(AllocateMemory(size + align)), align));
|
||||
}
|
||||
|
||||
T * const obj = reinterpret_cast<T *>(util::AlignUp(reinterpret_cast<uintptr_t>(mem), alignof(T)));
|
||||
template<typename T, typename... Args> requires std::constructible_from<T, Args...>
|
||||
inline T *AllocateObject(Args &&... args) {
|
||||
T * const obj = static_cast<T *>(AllocateAligned(sizeof(T), alignof(T)));
|
||||
|
||||
std::construct_at(obj);
|
||||
std::construct_at(obj, std::forward<Args>(args)...);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue