mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
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.
This commit is contained in:
parent
10407061d2
commit
fb41d89384
22 changed files with 1002 additions and 513 deletions
|
@ -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();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue