2020-04-17 03:55:47 +01:00
|
|
|
/*
|
2021-10-04 20:59:10 +01:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2020-04-17 03:55:47 +01:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
#include <stratosphere.hpp>
|
|
|
|
|
2021-01-18 13:20:27 +00:00
|
|
|
namespace ams {
|
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
namespace init {
|
2021-01-18 13:20:27 +00:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
void InitializeSystemModule() {
|
|
|
|
/* Initialize heap. */
|
|
|
|
pgl::srv::InitializeHeap();
|
2021-01-18 13:20:27 +00:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
/* Initialize our connection to sm. */
|
|
|
|
R_ABORT_UNLESS(sm::Initialize());
|
2021-01-18 13:20:27 +00:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
/* Initialize fs. */
|
|
|
|
fs::InitializeForSystem();
|
|
|
|
fs::SetAllocator(pgl::srv::Allocate, pgl::srv::Deallocate);
|
|
|
|
fs::SetEnabledAutoAbort(false);
|
2021-10-07 07:22:54 +01:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
/* Initialize other services we need. */
|
|
|
|
R_ABORT_UNLESS(setInitialize());
|
|
|
|
R_ABORT_UNLESS(setsysInitialize());
|
|
|
|
R_ABORT_UNLESS(pmshellInitialize());
|
|
|
|
R_ABORT_UNLESS(ldrShellInitialize());
|
|
|
|
R_ABORT_UNLESS(lrInitialize());
|
2021-01-18 13:20:27 +00:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
/* Verify that we can sanely execute. */
|
|
|
|
ams::CheckApiVersion();
|
|
|
|
}
|
2021-01-22 11:52:10 +00:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
void FinalizeSystemModule() { /* ... */ }
|
2020-04-17 03:55:47 +01:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
void Startup() { /* ... */ }
|
2021-10-07 07:22:54 +01:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
}
|
2020-06-30 07:19:33 +01:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
void Main() {
|
|
|
|
/* Set thread name. */
|
|
|
|
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(pgl, Main));
|
|
|
|
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(pgl, Main));
|
2020-04-17 09:06:07 +01:00
|
|
|
|
2021-10-08 01:44:54 +01:00
|
|
|
/* Initialize and start the server. */
|
|
|
|
pgl::srv::StartServer();
|
|
|
|
}
|
2020-04-17 03:55:47 +01:00
|
|
|
|
|
|
|
}
|