diff options
author | Tom <tomut@yahoo.com> | 2020-06-27 13:42:28 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-01 12:07:01 +0200 |
commit | fb41d89384cb5bbdf602ae41ae7e038fb48a34ce (patch) | |
tree | 21f97ea745e1eb15d88cc8e9ccd7b1d4b15a30f3 /Kernel/Scheduler.h | |
parent | 10407061d21abcfbc0c63e37314f4ae3938e3e25 (diff) | |
download | serenity-fb41d89384cb5bbdf602ae41ae7e038fb48a34ce.zip |
Kernel: Implement software context switching and Processor structure
Moving certain globals into a new Processor structure for
each CPU allows us to eventually run an instance of the
scheduler on each CPU.
Diffstat (limited to 'Kernel/Scheduler.h')
-rw-r--r-- | Kernel/Scheduler.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/Kernel/Scheduler.h b/Kernel/Scheduler.h index ea374fa946..7ed8642caf 100644 --- a/Kernel/Scheduler.h +++ b/Kernel/Scheduler.h @@ -43,28 +43,25 @@ struct SchedulerData; extern Thread* g_finalizer; extern Thread* g_colonel; extern WaitQueue* g_finalizer_wait_queue; -extern bool g_finalizer_has_work; +extern Atomic<bool> g_finalizer_has_work; extern u64 g_uptime; extern SchedulerData* g_scheduler_data; extern timeval g_timeofday; class Scheduler { public: - static void initialize(); + static void initialize(u32 cpu); static void timer_tick(const RegisterState&); + [[noreturn]] static void start(); static bool pick_next(); static timeval time_since_boot(); - static void pick_next_and_switch_now(); - static void switch_now(); static bool yield(); static bool donate_to(Thread*, const char* reason); static bool context_switch(Thread&); - static void prepare_to_modify_tss(Thread&); static Process* colonel(); - static bool is_active(); static void beep(); static void idle_loop(); - static void stop_idling(); + static void invoke_async(); template<typename Callback> static inline IterationDecision for_each_runnable(Callback); @@ -74,9 +71,6 @@ public: static void init_thread(Thread& thread); static void update_state_for_thread(Thread& thread); - -private: - static void prepare_for_iret_to_new_process(); }; } |