mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:55:08 +01:00
Fix NCE Destruction
NCE is implicitly depended on by the `GPU` class due to the NCE Memory Trapping API so the destruction of it must take place after the destruction of the `GPU` class. Additionally, to prevent bugs the NCE destructor must set `staticNce` to `nullptr` as the signal handler will potentially access a destroyed instance of NCE otherwise.
This commit is contained in:
parent
815f1f4067
commit
cd8fa66326
@ -63,13 +63,13 @@ namespace skyline {
|
||||
std::shared_ptr<JvmManager> jvm;
|
||||
std::shared_ptr<Settings> settings;
|
||||
std::shared_ptr<loader::Loader> loader;
|
||||
std::shared_ptr<nce::NCE> nce;
|
||||
std::shared_ptr<kernel::type::KProcess> process{};
|
||||
static thread_local inline std::shared_ptr<kernel::type::KThread> 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::GPU> gpu;
|
||||
std::shared_ptr<soc::SOC> soc;
|
||||
std::shared_ptr<audio::Audio> audio;
|
||||
std::shared_ptr<nce::NCE> nce;
|
||||
std::shared_ptr<kernel::Scheduler> scheduler;
|
||||
std::shared_ptr<input::Input> input;
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -75,6 +75,8 @@ namespace skyline::nce {
|
||||
*/
|
||||
NCE(const DeviceState &state);
|
||||
|
||||
~NCE();
|
||||
|
||||
struct PatchData {
|
||||
size_t size; //!< Size of the .patch section
|
||||
std::vector<size_t> offsets; //!< Offsets in .text of instructions that need to be patched
|
||||
|
Loading…
Reference in New Issue
Block a user