mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
erpt: update for new sf semantics
This commit is contained in:
parent
5191f0e305
commit
dc4ee1a5bc
2 changed files with 50 additions and 3 deletions
|
@ -18,6 +18,22 @@
|
||||||
|
|
||||||
namespace ams::psc {
|
namespace ams::psc {
|
||||||
|
|
||||||
|
/* TODO: Nintendo uses sf::ShimLobraryObjectHolder here, we should similarly consider switching. */
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
struct PscRemotePmModuleTag;
|
||||||
|
using RemoteAllocator = ams::sf::ExpHeapStaticAllocator<2_KB, PscRemotePmModuleTag>;
|
||||||
|
using RemoteObjectFactory = ams::sf::ObjectFactory<typename RemoteAllocator::Policy>;
|
||||||
|
|
||||||
|
class StaticAllocatorInitializer {
|
||||||
|
public:
|
||||||
|
StaticAllocatorInitializer() {
|
||||||
|
RemoteAllocator::Initialize(lmem::CreateOption_None);
|
||||||
|
}
|
||||||
|
} g_static_allocator_initializer;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
PmModule::PmModule() : intf(nullptr), initialized(false), reserved(0) { /* ... */ }
|
PmModule::PmModule() : intf(nullptr), initialized(false), reserved(0) { /* ... */ }
|
||||||
|
|
||||||
PmModule::~PmModule() {
|
PmModule::~PmModule() {
|
||||||
|
@ -34,8 +50,7 @@ namespace ams::psc {
|
||||||
::PscPmModule module;
|
::PscPmModule module;
|
||||||
R_TRY(::pscmGetPmModule(std::addressof(module), static_cast<::PscPmModuleId>(mid), reinterpret_cast<const u16 *>(dependencies), dependency_count, clear_mode == os::EventClearMode_AutoClear));
|
R_TRY(::pscmGetPmModule(std::addressof(module), static_cast<::PscPmModuleId>(mid), reinterpret_cast<const u16 *>(dependencies), dependency_count, clear_mode == os::EventClearMode_AutoClear));
|
||||||
|
|
||||||
/* TODO: Proper allocator */
|
this->intf = RemoteObjectFactory::CreateSharedEmplaced<psc::sf::IPmModule, RemotePmModule>(module);
|
||||||
this->intf = ams::sf::CreateSharedObjectEmplaced<psc::sf::IPmModule, RemotePmModule>(module);
|
|
||||||
this->system_event.AttachReadableHandle(module.event.revent, false, clear_mode);
|
this->system_event.AttachReadableHandle(module.event.revent, false, clear_mode);
|
||||||
this->initialized = true;
|
this->initialized = true;
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
|
|
@ -21,7 +21,7 @@ extern "C" {
|
||||||
u32 __nx_applet_type = AppletType_None;
|
u32 __nx_applet_type = AppletType_None;
|
||||||
u32 __nx_fs_num_sessions = 1;
|
u32 __nx_fs_num_sessions = 1;
|
||||||
|
|
||||||
#define INNER_HEAP_SIZE 0x4000
|
#define INNER_HEAP_SIZE 0x0
|
||||||
size_t nx_inner_heap_size = INNER_HEAP_SIZE;
|
size_t nx_inner_heap_size = INNER_HEAP_SIZE;
|
||||||
char nx_inner_heap[INNER_HEAP_SIZE];
|
char nx_inner_heap[INNER_HEAP_SIZE];
|
||||||
|
|
||||||
|
@ -33,6 +33,10 @@ extern "C" {
|
||||||
alignas(16) u8 __nx_exception_stack[ams::os::MemoryPageSize];
|
alignas(16) u8 __nx_exception_stack[ams::os::MemoryPageSize];
|
||||||
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
|
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
|
||||||
void __libnx_exception_handler(ThreadExceptionDump *ctx);
|
void __libnx_exception_handler(ThreadExceptionDump *ctx);
|
||||||
|
|
||||||
|
void *__libnx_thread_alloc(size_t size);
|
||||||
|
void __libnx_thread_free(void *mem);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ams {
|
namespace ams {
|
||||||
|
@ -121,6 +125,34 @@ namespace ams::erpt {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace ams {
|
||||||
|
|
||||||
|
void *Malloc(size_t size) {
|
||||||
|
AMS_ABORT("ams::Malloc was called");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Free(void *ptr) {
|
||||||
|
AMS_ABORT("ams::Free was called");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void *operator new(size_t size) {
|
||||||
|
AMS_ABORT("operator new(size_t) was called");
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void *p) {
|
||||||
|
AMS_ABORT("operator delete(void *) was called");
|
||||||
|
}
|
||||||
|
|
||||||
|
void *__libnx_thread_alloc(size_t size) {
|
||||||
|
AMS_ABORT("__libnx_thread_alloc was called");
|
||||||
|
}
|
||||||
|
|
||||||
|
void __libnx_thread_free(void *mem) {
|
||||||
|
AMS_ABORT("__libnx_thread_free was called");
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* Set thread name. */
|
/* Set thread name. */
|
||||||
|
|
Loading…
Reference in a new issue