0.8.3: fix some memory/deadlock issues

This commit is contained in:
Michael Scire 2019-01-24 11:41:32 -08:00
parent 5b1bb71787
commit cedbcba3e3
2 changed files with 14 additions and 11 deletions

View file

@ -62,6 +62,11 @@ void __appInit(void) {
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_SM));
}
rc = fsInitialize();
if (R_FAILED(rc)) {
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_FS));
}
CheckAtmosphereVersion(CURRENT_ATMOSPHERE_VERSION);
}
@ -89,14 +94,6 @@ int main(int argc, char **argv)
/* Create fsp-srv mitm. */
AddMitmServerToManager<FsMitmService>(server_manager, "fsp-srv", 61);
/* Connect to FS */
{
Result rc = fsInitialize();
if (R_FAILED(rc)) {
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_FS));
}
}
if (R_FAILED(threadCreate(&sd_initializer_thread, &Utils::InitializeSdThreadFunc, NULL, 0x4000, 0x15, 0))) {
/* TODO: Panic. */

View file

@ -179,11 +179,17 @@ void ResourceLimitUtils::InitializeLimits() {
}
}
/* Atmosphere: Allocate extra memory (24 MiB) to SYSTEM away from Application. */
/* Atmosphere: Allocate extra memory (24 MiB) to SYSTEM away from Applet. */
for (unsigned int i = 0; i < 6; i++) {
g_memory_resource_limits[i][0] += ATMOSPHERE_EXTRA_SYSTEM_MEMORY_FOR_SYSMODULES;
/* Taking from application instead of applet fixes a rare hang on boot on < 4.0.0. */
g_memory_resource_limits[i][1] -= ATMOSPHERE_EXTRA_SYSTEM_MEMORY_FOR_SYSMODULES;
/* On < 4.0.0, taking from application instead of applet fixes a rare hang on boot. */
if (kernelAbove600()) {
g_memory_resource_limits[i][1] -= ATMOSPHERE_EXTRA_SYSTEM_MEMORY_FOR_SYSMODULES;
} else if (kernelAbove400()) {
g_memory_resource_limits[i][2] -= ATMOSPHERE_EXTRA_SYSTEM_MEMORY_FOR_SYSMODULES;
} else {
g_memory_resource_limits[i][1] -= ATMOSPHERE_EXTRA_SYSTEM_MEMORY_FOR_SYSMODULES;
}
}
/* Set resource limits. */