From d15154f6684d9e20c95f7bfd654b9657485c2fc9 Mon Sep 17 00:00:00 2001
From: TuxSH <1922548+TuxSH@users.noreply.github.com>
Date: Wed, 26 Feb 2020 23:24:48 +0000
Subject: [PATCH] thermosphere: cleanup again
---
thermosphere/src/debug_manager.c | 11 ++++++
thermosphere/src/traps.c | 60 --------------------------------
thermosphere/src/traps.h | 22 ------------
3 files changed, 11 insertions(+), 82 deletions(-)
delete mode 100644 thermosphere/src/traps.c
delete mode 100644 thermosphere/src/traps.h
diff --git a/thermosphere/src/debug_manager.c b/thermosphere/src/debug_manager.c
index 510475d82..b9031a32c 100644
--- a/thermosphere/src/debug_manager.c
+++ b/thermosphere/src/debug_manager.c
@@ -250,3 +250,14 @@ void debugManagerContinueCores(u32 coreList)
__wfe();
} while ((atomic_load(&g_debugManager.pausedCoreList) & coreList) != 0);
}
+
+/* u64 mdcr = GET_SYSREG(mdcr_el2);
+
+ // Trap Debug Exceptions, and accesses to debug registers.
+ mdcr |= MDCR_EL2_TDE;
+
+ // Implied from TDE
+ mdcr |= MDCR_EL2_TDRA | MDCR_EL2_TDOSA | MDCR_EL2_TDA;
+
+ SET_SYSREG(mdcr_el2, mdcr);
+*/
diff --git a/thermosphere/src/traps.c b/thermosphere/src/traps.c
deleted file mode 100644
index 2b4c2183f..000000000
--- a/thermosphere/src/traps.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2019 Atmosphère-NX
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "traps.h"
-#include "sysreg.h"
-
-static inline void enableDebugTraps(void)
-{
- u64 mdcr = GET_SYSREG(mdcr_el2);
-
- // Trap Debug Exceptions, and accesses to debug registers.
- mdcr |= MDCR_EL2_TDE;
-
- // Implied from TDE
- mdcr |= MDCR_EL2_TDRA | MDCR_EL2_TDOSA | MDCR_EL2_TDA;
-
- SET_SYSREG(mdcr_el2, mdcr);
-}
-
-static inline void enableTimerTraps(void)
-{
- // Disable event streams, trap everything
- u64 cnthctl = 0;
- SET_SYSREG(cnthctl_el2, cnthctl);
-}
-
-void enableTraps(void)
-{
- u64 hcr = GET_SYSREG(hcr_el2);
-
- // Trap SMC instructions
- hcr |= HCR_TSC;
-
- // Trap set/way isns
- hcr |= HCR_TSW;
-
- // Reroute physical IRQs to EL2
- hcr |= HCR_IMO;
-
- // Make sure HVC is enabled
- hcr &= ~HCR_HCD;
-
- SET_SYSREG(hcr_el2, hcr);
-
- enableDebugTraps();
- enableTimerTraps();
-}
diff --git a/thermosphere/src/traps.h b/thermosphere/src/traps.h
deleted file mode 100644
index cf4a50af3..000000000
--- a/thermosphere/src/traps.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2019 Atmosphère-NX
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#pragma once
-
-#include "utils.h"
-#include "exceptions.h"
-
-void enableTraps(void);