1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-18 01:46:47 +00:00

kern: remove more of clc

This commit is contained in:
Michael Scire 2020-12-01 13:08:47 -08:00 committed by SciresM
parent aae565629e
commit 24d545701c
4 changed files with 5 additions and 29 deletions

View file

@ -26,7 +26,7 @@ namespace ams::kern::arch::arm64 {
constexpr KHardwareTimer() : KInterruptTask(), KHardwareTimerBase(), maximum_time(std::numeric_limits<s64>::max()) { /* ... */ } constexpr KHardwareTimer() : KInterruptTask(), KHardwareTimerBase(), maximum_time(std::numeric_limits<s64>::max()) { /* ... */ }
public: public:
/* Public API. */ /* Public API. */
NOINLINE void Initialize(s32 core_id); NOINLINE void Initialize();
NOINLINE void Finalize(); NOINLINE void Finalize();
static s64 GetTick() { static s64 GetTick() {

View file

@ -27,18 +27,6 @@ namespace ams::kern {
struct KCoreLocalContext { struct KCoreLocalContext {
KCurrentContext current; KCurrentContext current;
/* Everything after this point is for debugging. */
/* Retail kernel doesn't even consistently update these fields. */
u64 num_sw_interrupts;
u64 num_hw_interrupts;
std::atomic<u64> num_svc;
u64 num_process_switches;
u64 num_thread_switches;
u64 num_fpu_switches;
u64 num_scheduler_updates;
u64 num_invoked_scheduler_updates;
std::atomic<u64> num_specific_svc[0x80];
u32 perf_counters[6];
}; };
static_assert(sizeof(KCoreLocalContext) < PageSize); static_assert(sizeof(KCoreLocalContext) < PageSize);

View file

@ -17,7 +17,7 @@
namespace ams::kern::arch::arm64 { namespace ams::kern::arch::arm64 {
void KHardwareTimer::Initialize(s32 core_id) { void KHardwareTimer::Initialize() {
/* Setup the global timer for the core. */ /* Setup the global timer for the core. */
InitializeGlobalTimer(); InitializeGlobalTimer();
@ -25,7 +25,7 @@ namespace ams::kern::arch::arm64 {
this->maximum_time = static_cast<s64>(std::min<u64>(std::numeric_limits<s64>::max(), cpu::CounterTimerPhysicalTimerCompareValueRegisterAccessor().GetCompareValue())); this->maximum_time = static_cast<s64>(std::min<u64>(std::numeric_limits<s64>::max(), cpu::CounterTimerPhysicalTimerCompareValueRegisterAccessor().GetCompareValue()));
/* Bind the interrupt task for this core. */ /* Bind the interrupt task for this core. */
Kernel::GetInterruptManager().BindHandler(std::addressof(Kernel::GetHardwareTimer(core_id)), KInterruptName_NonSecurePhysicalTimer, core_id, KInterruptController::PriorityLevel_Timer, true, true); Kernel::GetInterruptManager().BindHandler(this, KInterruptName_NonSecurePhysicalTimer, GetCurrentCoreId(), KInterruptController::PriorityLevel_Timer, true, true);
} }
void KHardwareTimer::Finalize() { void KHardwareTimer::Finalize() {

View file

@ -49,22 +49,10 @@ namespace ams::kern {
/* Initialize current context. */ /* Initialize current context. */
clc->current.current_thread = nullptr; clc->current.current_thread = nullptr;
clc->current.current_process = nullptr; clc->current.current_process = nullptr;
clc->current.core_id = core_id;
clc->current.scheduler = std::addressof(Kernel::GetScheduler()); clc->current.scheduler = std::addressof(Kernel::GetScheduler());
clc->current.interrupt_task_manager = std::addressof(Kernel::GetInterruptTaskManager()); clc->current.interrupt_task_manager = std::addressof(Kernel::GetInterruptTaskManager());
clc->current.core_id = core_id;
clc->current.exception_stack_top = GetVoidPointer(KMemoryLayout::GetExceptionStackTopAddress(core_id) - sizeof(KThread::StackParameters)); clc->current.exception_stack_top = GetVoidPointer(KMemoryLayout::GetExceptionStackTopAddress(core_id) - sizeof(KThread::StackParameters));
/* Clear debugging counters. */
clc->num_sw_interrupts = 0;
clc->num_hw_interrupts = 0;
clc->num_svc = 0;
clc->num_process_switches = 0;
clc->num_thread_switches = 0;
clc->num_fpu_switches = 0;
for (size_t i = 0; i < util::size(clc->perf_counters); i++) {
clc->perf_counters[i] = 0;
}
} }
void Kernel::InitializeMainAndIdleThreads(s32 core_id) { void Kernel::InitializeMainAndIdleThreads(s32 core_id) {
@ -84,7 +72,7 @@ namespace ams::kern {
/* Initialize the interrupt manager, hardware timer, and scheduler */ /* Initialize the interrupt manager, hardware timer, and scheduler */
GetInterruptManager().Initialize(core_id); GetInterruptManager().Initialize(core_id);
GetHardwareTimer().Initialize(core_id); GetHardwareTimer().Initialize();
GetScheduler().Initialize(idle_thread); GetScheduler().Initialize(idle_thread);
} }