strat: automatic program id detection

This commit is contained in:
Michael Scire
2021-10-01 17:18:50 -07:00
parent 9ecec1b935
commit 18825866ac
28 changed files with 88 additions and 129 deletions

View File

@@ -34,12 +34,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::AtmosphereProgramId::AtmosphereLogManager;
}
using namespace ams;
#define AMS_LM_USE_FATAL_ERROR 1

View File

@@ -35,12 +35,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::DevServer;
}
using namespace ams;
#define AMS_TIO_SERVER_USE_FATAL_ERROR 1

View File

@@ -45,8 +45,6 @@ extern "C" {
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::AtmosphereProgramId::Mitm;
/* Override. */
void ExceptionHandler(FatalErrorContext *ctx) {
/* We're bpc-mitm (or ams_mitm, anyway), so manually reboot to fatal error. */

View File

@@ -56,8 +56,6 @@ extern "C" {
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Boot;
void ExceptionHandler(FatalErrorContext *ctx) {
/* We're boot sysmodule, so manually reboot to fatal error. */
boot::RebootForFatalError(ctx);

View File

@@ -39,12 +39,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Boot2;
}
using namespace ams;
void __libnx_exception_handler(ThreadExceptionDump *ctx) {

View File

@@ -42,12 +42,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Creport;
}
using namespace ams;
void __libnx_exception_handler(ThreadExceptionDump *ctx) {

View File

@@ -34,12 +34,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Cs;
}
using namespace ams;
#define AMS_CS_SERVER_USE_FATAL_ERROR 1

View File

@@ -36,12 +36,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::DmntGen2;
}
using namespace ams;
#define AMS_DMNT2_SERVER_USE_FATAL_ERROR 1

View File

@@ -36,12 +36,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Dmnt;
}
using namespace ams;
void __libnx_initheap(void) {

View File

@@ -34,12 +34,6 @@ extern "C" {
void __libnx_exception_handler(ThreadExceptionDump *ctx);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Eclct;
}
using namespace ams;
void __libnx_exception_handler(ThreadExceptionDump *ctx) {

View File

@@ -39,12 +39,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Erpt;
}
using namespace ams;
void __libnx_exception_handler(ThreadExceptionDump *ctx) {

View File

@@ -46,12 +46,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Fatal;
}
using namespace ams;
namespace ams::fatal {

View File

@@ -34,12 +34,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Htc;
}
using namespace ams;
#define AMS_HTC_USE_FATAL_ERROR 1

View File

@@ -36,11 +36,6 @@ extern "C" {
void __libnx_exception_handler(ThreadExceptionDump *ctx);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::JpegDec;
}
using namespace ams;
void __libnx_exception_handler(ThreadExceptionDump *ctx) {

View File

@@ -41,12 +41,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Loader;
}
using namespace ams;
void __libnx_exception_handler(ThreadExceptionDump *ctx) {

View File

@@ -39,12 +39,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Ncm;
}
using namespace ams;
namespace {

View File

@@ -39,12 +39,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Pgl;
}
using namespace ams;
void __libnx_exception_handler(ThreadExceptionDump *ctx) {

View File

@@ -44,12 +44,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Pm;
}
using namespace ams;
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
@@ -81,7 +75,7 @@ namespace {
/* Doing this here works around a bug fixed in 6.0.0. */
/* Not doing so will cause svcDebugActiveProcess to deadlock on lower firmwares if called for it's own process. */
if (process_id == os::GetCurrentProcessId()) {
return ams::CurrentProgramId;
return os::GetCurrentProgramId();
}
/* Get a debug handle. */

View File

@@ -36,12 +36,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Ro;
}
using namespace ams;
namespace ams::ro {

View File

@@ -51,8 +51,6 @@ namespace {
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Sm;
void NORETURN Exit(int rc) {
AMS_ABORT("Exit called by immortal process");
}

View File

@@ -49,12 +49,6 @@ extern "C" {
void __libnx_free(void *mem);
}
namespace ams {
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Spl;
}
using namespace ams;
void __libnx_exception_handler(ThreadExceptionDump *ctx) {