1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: init_Default.cpp 4 5 Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 27849 $ 14 *---------------------------------------------------------------------------*/ 15 16 #include <nn/config.h> 17 #include <nn/init.h> 18 #include <nn/os.h> 19 #include <nn/srv.h> 20 #include <nn/ndm.h> 21 22 namespace 23 { 24 class ExitHandler : public nn::srv::NotificationHandler 25 { 26 public: HandleNotification(bit32 message)27 virtual void HandleNotification(bit32 message) 28 { 29 NN_UNUSED_VAR(message); 30 31 nn::svc::ExitProcess(); 32 } 33 }; 34 35 36 37 ExitHandler s_ExitHandler; 38 } 39 nninitStartUpDefault(void)40extern "C" void nninitStartUpDefault(void) 41 { 42 #if NN_PLATFORM_HAS_MMU 43 #pragma push 44 #pragma diag_suppress 1361 45 46 const size_t assingment = nn::os::GetAppMemorySize(); 47 const size_t currentUsing = nn::os::GetUsingMemorySize(); 48 49 const size_t available = assingment - currentUsing; 50 const size_t heapSize = available - nn::os::DEVICE_MEMORY_SIZE; 51 52 nn::os::SetupHeapForMemoryBlock(heapSize); 53 nn::os::InitializeDeviceMemory(); 54 55 nn::init::InitializeAllocator( 8 * 1024 * 1024 ); 56 #pragma pop 57 #endif // if NN_PLATFORM_HAS_MMU 58 } 59 60 #if NN_PLATFORM_HAS_MMU nninitSetupDaemons(void)61extern "C" NN_WEAK_SYMBOL void nninitSetupDaemons(void) 62 { 63 // デーモンマネージャのデフォルト設定を行う 64 nn::ndm::SetupDaemonsDefault(); 65 } 66 #endif 67 nninitSetupDefault(void)68extern "C" void nninitSetupDefault(void) 69 { 70 #if NN_PLATFORM_HAS_MMU 71 nn::srv::Initialize(); 72 nn::srv::StartNotification(); 73 74 nn::srv::RegisterNotificationHandler(&s_ExitHandler, nn::srv::NOTIFICATION_EXIT); 75 76 nn::os::detail::SaveThreadLocalRegionAddress(); 77 78 nninitSetupDaemons(); 79 #endif // if NN_PLATFORM_HAS_MMU 80 } 81 82