diff --git a/app/src/main/cpp/skyline/common.h b/app/src/main/cpp/skyline/common.h index 8504b504..b88952fe 100644 --- a/app/src/main/cpp/skyline/common.h +++ b/app/src/main/cpp/skyline/common.h @@ -63,13 +63,13 @@ namespace skyline { std::shared_ptr jvm; std::shared_ptr settings; std::shared_ptr loader; + std::shared_ptr nce; std::shared_ptr process{}; static thread_local inline std::shared_ptr thread{}; //!< The KThread of the thread which accesses this object static thread_local inline nce::ThreadContext *ctx{}; //!< The context of the guest thread for the corresponding host thread std::shared_ptr gpu; std::shared_ptr soc; std::shared_ptr audio; - std::shared_ptr nce; std::shared_ptr scheduler; std::shared_ptr input; }; diff --git a/app/src/main/cpp/skyline/nce.cpp b/app/src/main/cpp/skyline/nce.cpp index ad3872e3..dda73a53 100644 --- a/app/src/main/cpp/skyline/nce.cpp +++ b/app/src/main/cpp/skyline/nce.cpp @@ -118,7 +118,7 @@ namespace skyline::nce { } } - static NCE* staticNce{nullptr}; //!< A static instance of NCE for use in the signal handler + static NCE *staticNce{nullptr}; //!< A static instance of NCE for use in the signal handler void NCE::HostSignalHandler(int signal, siginfo *info, ucontext *ctx) { if (signal == SIGSEGV) { @@ -168,6 +168,10 @@ namespace skyline::nce { staticNce = this; } + NCE::~NCE() { + staticNce = nullptr; + } + constexpr u8 MainSvcTrampolineSize{17}; // Size of the main SVC trampoline function in u32 units constexpr u32 TpidrEl0{0x5E82}; // ID of TPIDR_EL0 in MRS constexpr u32 TpidrroEl0{0x5E83}; // ID of TPIDRRO_EL0 in MRS diff --git a/app/src/main/cpp/skyline/nce.h b/app/src/main/cpp/skyline/nce.h index 5b51f569..ffc43e91 100644 --- a/app/src/main/cpp/skyline/nce.h +++ b/app/src/main/cpp/skyline/nce.h @@ -75,6 +75,8 @@ namespace skyline::nce { */ NCE(const DeviceState &state); + ~NCE(); + struct PatchData { size_t size; //!< Size of the .patch section std::vector offsets; //!< Offsets in .text of instructions that need to be patched