/*---------------------------------------------------------------------------* Project: Horizon File: init_Default.cpp Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 32272 $ *---------------------------------------------------------------------------*/ #include #include #include #include #include namespace { class ExitHandler : public nn::srv::NotificationHandler { public: virtual void HandleNotification(bit32 message) { NN_UNUSED_VAR(message); nn::svc::ExitProcess(); } }; ExitHandler s_ExitHandler; } extern "C" void nninitStartUpDefault(void) { #if NN_PLATFORM_HAS_MMU #pragma push #pragma diag_suppress 1361 const size_t assingment = nn::os::GetAppMemorySize(); const size_t currentUsing = nn::os::GetUsingMemorySize(); const size_t available = assingment - currentUsing; const size_t heapSize = available - nn::os::DEVICE_MEMORY_SIZE; nn::os::SetupHeapForMemoryBlock(heapSize); nn::os::InitializeDeviceMemory(); nn::init::InitializeAllocator( 8 * 1024 * 1024 ); #pragma pop #endif // if NN_PLATFORM_HAS_MMU } #if NN_PLATFORM_HAS_MMU extern "C" NN_WEAK_SYMBOL void nninitSetupDaemons(void) { // デーモンマネージャのデフォルト設定を行う nn::ndm::SetupDaemonsDefault(); } #endif extern "C" void nninitSetupDefault(void) { #if NN_PLATFORM_HAS_MMU nn::srv::Initialize(); nn::srv::StartNotification(); nn::srv::RegisterNotificationHandler(&s_ExitHandler, nn::srv::NOTIFICATION_EXIT); nn::os::detail::SaveThreadLocalRegionAddress(); nninitSetupDaemons(); #endif // if NN_PLATFORM_HAS_MMU } extern "C" void nninitSetupDefaultWithoutSettingExitHandler(void) { #if NN_PLATFORM_HAS_MMU nn::srv::Initialize(); nn::srv::StartNotification(); nn::os::detail::SaveThreadLocalRegionAddress(); nninitSetupDaemons(); #endif // if NN_PLATFORM_HAS_MMU }