mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:27:34 +00:00
Kernel: Set up and calibrate APIC timer, and enable timer on all CPUs
This enables the APIC timer on all CPUs, which means Scheduler::timer_tick is now called on all CPUs independently. We still don't do anything on the APs as it instantly crashes due to a number of other problems.
This commit is contained in:
parent
9d347352a1
commit
fe615e601a
14 changed files with 478 additions and 70 deletions
|
@ -27,10 +27,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Time/HardwareTimer.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class APICTimer;
|
||||
|
||||
struct LocalAPIC {
|
||||
u32 apic_id;
|
||||
};
|
||||
|
@ -52,6 +55,17 @@ public:
|
|||
Thread* get_idle_thread(u32 cpu) const;
|
||||
u32 enabled_processor_count() const { return m_processor_enabled_cnt; }
|
||||
|
||||
APICTimer* initialize_timers(HardwareTimerBase&);
|
||||
APICTimer* get_timer() const { return m_apic_timer; }
|
||||
enum class TimerMode {
|
||||
OneShot,
|
||||
Periodic,
|
||||
TSCDeadline
|
||||
};
|
||||
void setup_local_timer(u32, TimerMode, bool);
|
||||
u32 get_timer_current_count();
|
||||
u32 get_timer_divisor();
|
||||
|
||||
private:
|
||||
class ICRReg {
|
||||
u32 m_low { 0 };
|
||||
|
@ -102,6 +116,7 @@ private:
|
|||
AK::Atomic<u8> m_apic_ap_continue { 0 };
|
||||
u32 m_processor_cnt { 0 };
|
||||
u32 m_processor_enabled_cnt { 0 };
|
||||
APICTimer* m_apic_timer { nullptr };
|
||||
|
||||
static PhysicalAddress get_base();
|
||||
static void set_base(const PhysicalAddress& base);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue