strat: no longer materially constrained by sm session limit
This commit is contained in:
@@ -110,9 +110,9 @@ void __appInit(void) {
|
||||
/* Disable FS auto-abort. */
|
||||
fs::SetEnabledAutoAbort(false);
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
|
||||
ams::CheckApiVersion();
|
||||
}
|
||||
|
||||
@@ -172,10 +172,8 @@ namespace ams::mitm {
|
||||
}
|
||||
|
||||
/* Connect to set:sys. */
|
||||
sm::DoWithSession([]() {
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
});
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
|
||||
/* Load settings off the SD card. */
|
||||
settings::fwdbg::InitializeSdCardKeyValueStore();
|
||||
|
||||
@@ -76,13 +76,13 @@ void __libnx_initheap(void) {
|
||||
void __appInit(void) {
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
R_ABORT_UNLESS(pmdmntInitialize());
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
ncm::Initialize();
|
||||
spl::InitializeForFs();
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
R_ABORT_UNLESS(pmdmntInitialize());
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
ncm::Initialize();
|
||||
spl::InitializeForFs();
|
||||
|
||||
/* Disable auto-abort in fs operations. */
|
||||
fs::SetEnabledAutoAbort(false);
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace ams::mitm::sysupdater {
|
||||
mitm::WaitInitialized();
|
||||
|
||||
/* Connect to nim. */
|
||||
sm::DoWithSession([]() { nim::InitializeForNetworkInstallManager(); });
|
||||
nim::InitializeForNetworkInstallManager();
|
||||
ON_SCOPE_EXIT { nim::FinalizeForNetworkInstallManager(); };
|
||||
|
||||
/* Register ams:su. */
|
||||
|
||||
@@ -126,12 +126,12 @@ void __appInit(void) {
|
||||
|
||||
fs::SetAllocator(Allocate, Deallocate);
|
||||
|
||||
/* Initialize services we need (TODO: NCM) */
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
spl::Initialize();
|
||||
R_ABORT_UNLESS(pmshellInitialize());
|
||||
});
|
||||
/* Initialize services we need. */
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
spl::Initialize();
|
||||
R_ABORT_UNLESS(pmshellInitialize());
|
||||
|
||||
ams::CheckApiVersion();
|
||||
}
|
||||
|
||||
@@ -90,14 +90,14 @@ void __appInit(void) {
|
||||
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
||||
|
||||
/* Initialize services we need. */
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
R_ABORT_UNLESS(pmbmInitialize());
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
R_ABORT_UNLESS(pmshellInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
gpio::Initialize();
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
R_ABORT_UNLESS(pmbmInitialize());
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
R_ABORT_UNLESS(pmshellInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
gpio::Initialize();
|
||||
|
||||
/* Mount the SD card. */
|
||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||
|
||||
@@ -41,8 +41,12 @@ namespace ams::creport {
|
||||
|
||||
/* Try to get the current time. */
|
||||
{
|
||||
sm::ScopedServiceHolder<timeInitialize, timeExit> time_holder;
|
||||
return time_holder && R_SUCCEEDED(timeGetCurrentTime(TimeType_LocalSystemClock, out));
|
||||
if (R_FAILED(::timeInitialize())) {
|
||||
return false;
|
||||
}
|
||||
ON_SCOPE_EXIT { ::timeExit(); };
|
||||
|
||||
return R_SUCCEEDED(::timeGetCurrentTime(TimeType_LocalSystemClock, out));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,8 +341,9 @@ namespace ams::creport {
|
||||
/* Since we save reports only locally and do not send them via telemetry, we will skip this. */
|
||||
AMS_UNUSED(enable_screenshot);
|
||||
if (hos::GetVersion() >= hos::Version_9_0_0 && this->IsApplication()) {
|
||||
sm::ScopedServiceHolder<capsrv::InitializeScreenShotControl, capsrv::FinalizeScreenShotControl> capssc_holder;
|
||||
if (capssc_holder) {
|
||||
if (R_SUCCEEDED(capsrv::InitializeScreenShotControl())) {
|
||||
ON_SCOPE_EXIT { capsrv::FinalizeScreenShotControl(); };
|
||||
|
||||
u64 jpeg_size;
|
||||
if (R_SUCCEEDED(capsrv::CaptureJpegScreenshot(std::addressof(jpeg_size), this->heap_storage, sizeof(this->heap_storage), vi::LayerStack_ApplicationForDebug, TimeSpan::FromSeconds(10)))) {
|
||||
util::SNPrintf(file_path, sizeof(file_path), "sdmc:/atmosphere/crash_reports/%011lu_%016lx.jpg", timestamp, this->process_info.program_id);
|
||||
|
||||
@@ -92,9 +92,9 @@ void __appInit(void) {
|
||||
InitializeFsHeap();
|
||||
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
|
||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||
}
|
||||
@@ -179,14 +179,16 @@ int main(int argc, char **argv) {
|
||||
if (hos::GetVersion() < hos::Version_11_0_0 || !enable_jit_debug) {
|
||||
if (hos::GetVersion() >= hos::Version_10_0_0) {
|
||||
/* On 10.0.0+, use pgl to terminate. */
|
||||
sm::ScopedServiceHolder<pgl::Initialize, pgl::Finalize> pgl_holder;
|
||||
if (pgl_holder) {
|
||||
if (R_SUCCEEDED(pgl::Initialize())) {
|
||||
ON_SCOPE_EXIT { pgl::Finalize(); };
|
||||
|
||||
pgl::TerminateProcess(crashed_pid);
|
||||
}
|
||||
} else {
|
||||
/* On < 10.0.0, use ns:dev to terminate. */
|
||||
sm::ScopedServiceHolder<nsdevInitialize, nsdevExit> ns_holder;
|
||||
if (ns_holder) {
|
||||
if (R_SUCCEEDED(::nsdevInitialize())) {
|
||||
ON_SCOPE_EXIT { ::nsdevExit(); };
|
||||
|
||||
nsdevTerminateProcess(static_cast<u64>(crashed_pid));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,13 +114,13 @@ void __appInit(void) {
|
||||
|
||||
fs::SetAllocator(cs::Allocate, cs::Deallocate);
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
lr::Initialize();
|
||||
R_ABORT_UNLESS(ldr::InitializeForShell());
|
||||
R_ABORT_UNLESS(pgl::Initialize());
|
||||
/* TODO: Other services? */
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
lr::Initialize();
|
||||
R_ABORT_UNLESS(ldr::InitializeForShell());
|
||||
R_ABORT_UNLESS(pgl::Initialize());
|
||||
/* TODO: Other services? */
|
||||
|
||||
ams::CheckApiVersion();
|
||||
}
|
||||
|
||||
@@ -83,18 +83,18 @@ void __appInit(void) {
|
||||
InitializeFsHeap();
|
||||
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(pmdmntInitialize());
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
R_ABORT_UNLESS(ldrDmntInitialize());
|
||||
R_ABORT_UNLESS(roDmntInitialize());
|
||||
R_ABORT_UNLESS(nsdevInitialize());
|
||||
lr::Initialize();
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(hidInitialize());
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(pmdmntInitialize());
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
R_ABORT_UNLESS(ldrDmntInitialize());
|
||||
R_ABORT_UNLESS(roDmntInitialize());
|
||||
R_ABORT_UNLESS(nsdevInitialize());
|
||||
lr::Initialize();
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(hidInitialize());
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
|
||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||
|
||||
|
||||
@@ -66,16 +66,16 @@ void __libnx_initheap(void) {
|
||||
void __appInit(void) {
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(pscmInitialize());
|
||||
R_ABORT_UNLESS(time::Initialize());
|
||||
if (hos::GetVersion() >= hos::Version_11_0_0) {
|
||||
R_ABORT_UNLESS(ectxrInitialize());
|
||||
}
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(pscmInitialize());
|
||||
R_ABORT_UNLESS(time::Initialize());
|
||||
if (hos::GetVersion() >= hos::Version_11_0_0) {
|
||||
R_ABORT_UNLESS(ectxrInitialize());
|
||||
}
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
|
||||
ams::CheckApiVersion();
|
||||
}
|
||||
|
||||
@@ -99,26 +99,26 @@ void __appInit(void) {
|
||||
fatal::InitializeFsHeap();
|
||||
fs::SetAllocator(fatal::AllocateForFs, fatal::DeallocateForFs);
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
R_ABORT_UNLESS(i2cInitialize());
|
||||
R_ABORT_UNLESS(bpcInitialize());
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
if (hos::GetVersion() >= hos::Version_8_0_0) {
|
||||
R_ABORT_UNLESS(clkrstInitialize());
|
||||
} else {
|
||||
R_ABORT_UNLESS(pcvInitialize());
|
||||
}
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
R_ABORT_UNLESS(i2cInitialize());
|
||||
R_ABORT_UNLESS(bpcInitialize());
|
||||
|
||||
R_ABORT_UNLESS(lblInitialize());
|
||||
R_ABORT_UNLESS(psmInitialize());
|
||||
R_ABORT_UNLESS(spsmInitialize());
|
||||
R_ABORT_UNLESS(plInitialize(::PlServiceType_User));
|
||||
gpio::Initialize();
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
});
|
||||
if (hos::GetVersion() >= hos::Version_8_0_0) {
|
||||
R_ABORT_UNLESS(clkrstInitialize());
|
||||
} else {
|
||||
R_ABORT_UNLESS(pcvInitialize());
|
||||
}
|
||||
|
||||
R_ABORT_UNLESS(lblInitialize());
|
||||
R_ABORT_UNLESS(psmInitialize());
|
||||
R_ABORT_UNLESS(spsmInitialize());
|
||||
R_ABORT_UNLESS(plInitialize(::PlServiceType_User));
|
||||
gpio::Initialize();
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
|
||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||
|
||||
|
||||
@@ -41,8 +41,12 @@ namespace ams::fatal::srv {
|
||||
|
||||
/* Try to get the current time. */
|
||||
{
|
||||
sm::ScopedServiceHolder<timeInitialize, timeExit> time_holder;
|
||||
return time_holder && R_SUCCEEDED(timeGetCurrentTime(TimeType_LocalSystemClock, out));
|
||||
if (R_FAILED(::timeInitialize())) {
|
||||
return false;
|
||||
}
|
||||
ON_SCOPE_EXIT { ::timeExit(); };
|
||||
|
||||
return R_SUCCEEDED(::timeGetCurrentTime(TimeType_LocalSystemClock, out));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -484,9 +484,7 @@ namespace ams::fatal::srv {
|
||||
PreRenderFrameBuffer();
|
||||
|
||||
/* Prepare screen for drawing. */
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(PrepareScreenForDrawing());
|
||||
});
|
||||
R_ABORT_UNLESS(PrepareScreenForDrawing());
|
||||
|
||||
/* Display the pre-rendered frame. */
|
||||
this->DisplayPreRenderedFrame();
|
||||
|
||||
@@ -104,12 +104,12 @@ void __appInit(void) {
|
||||
|
||||
fs::SetAllocator(htc::Allocate, htc::Deallocate);
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(setcalInitialize());
|
||||
R_ABORT_UNLESS(pscmInitialize());
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(setcalInitialize());
|
||||
R_ABORT_UNLESS(pscmInitialize());
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
|
||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||
|
||||
|
||||
@@ -62,6 +62,8 @@ void __libnx_initheap(void) {
|
||||
void __appInit(void) {
|
||||
hos::InitializeForStratosphere();
|
||||
ams::CheckApiVersion();
|
||||
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
}
|
||||
|
||||
void __appExit(void) {
|
||||
|
||||
@@ -145,12 +145,12 @@ void __appInit(void) {
|
||||
fs::SetAllocator(ldr::Allocate, ldr::Deallocate);
|
||||
|
||||
/* Initialize services we need. */
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
lr::Initialize();
|
||||
R_ABORT_UNLESS(fsldrInitialize());
|
||||
spl::Initialize();
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
lr::Initialize();
|
||||
R_ABORT_UNLESS(fsldrInitialize());
|
||||
spl::Initialize();
|
||||
|
||||
ams::CheckApiVersion();
|
||||
}
|
||||
|
||||
@@ -93,10 +93,10 @@ void __appInit(void) {
|
||||
|
||||
fs::SetAllocator(Allocate, Deallocate);
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
spl::Initialize();
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
spl::Initialize();
|
||||
|
||||
ams::CheckApiVersion();
|
||||
}
|
||||
|
||||
@@ -70,14 +70,14 @@ void __appInit(void) {
|
||||
|
||||
fs::SetAllocator(pgl::srv::Allocate, pgl::srv::Deallocate);
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(pmshellInitialize());
|
||||
R_ABORT_UNLESS(ldrShellInitialize());
|
||||
R_ABORT_UNLESS(lrInitialize());
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(pmshellInitialize());
|
||||
R_ABORT_UNLESS(ldrShellInitialize());
|
||||
R_ABORT_UNLESS(lrInitialize());
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
|
||||
ams::CheckApiVersion();
|
||||
}
|
||||
|
||||
@@ -129,20 +129,20 @@ namespace {
|
||||
void __appInit(void) {
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsprInitialize());
|
||||
R_ABORT_UNLESS(smManagerInitialize());
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
/* This works around a bug with process permissions on < 4.0.0. */
|
||||
/* It also informs SM of privileged process information. */
|
||||
RegisterPrivilegedProcesses();
|
||||
R_ABORT_UNLESS(fsprInitialize());
|
||||
R_ABORT_UNLESS(smManagerInitialize());
|
||||
|
||||
/* Use AMS manager extension to tell SM that FS has been worked around. */
|
||||
R_ABORT_UNLESS(sm::manager::EndInitialDefers());
|
||||
/* This works around a bug with process permissions on < 4.0.0. */
|
||||
/* It also informs SM of privileged process information. */
|
||||
RegisterPrivilegedProcesses();
|
||||
|
||||
R_ABORT_UNLESS(ldrPmInitialize());
|
||||
spl::Initialize();
|
||||
});
|
||||
/* Use AMS manager extension to tell SM that FS has been worked around. */
|
||||
R_ABORT_UNLESS(sm::manager::EndInitialDefers());
|
||||
|
||||
R_ABORT_UNLESS(ldrPmInitialize());
|
||||
spl::Initialize();
|
||||
|
||||
ams::CheckApiVersion();
|
||||
}
|
||||
|
||||
@@ -145,14 +145,14 @@ void __appInit(void) {
|
||||
|
||||
fs::SetAllocator(ro::Allocate, ro::Deallocate);
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
spl::Initialize();
|
||||
if (hos::GetVersion() < hos::Version_3_0_0) {
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
}
|
||||
});
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
spl::Initialize();
|
||||
if (hos::GetVersion() < hos::Version_3_0_0) {
|
||||
R_ABORT_UNLESS(pminfoInitialize());
|
||||
}
|
||||
|
||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ void __appInit(void) {
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
/* SPL doesn't really access any services... */
|
||||
R_ABORT_UNLESS(sm::Initialize());
|
||||
|
||||
ams::CheckApiVersion();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user