2018-11-07 22:15:02 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Assertions.h>
|
2018-11-08 00:24:59 +01:00
|
|
|
|
2018-11-07 22:15:02 +01:00
|
|
|
class Process;
|
2018-11-08 00:24:59 +01:00
|
|
|
struct RegisterDump;
|
2018-11-07 22:15:02 +01:00
|
|
|
|
|
|
|
|
extern Process* current;
|
2019-01-25 07:52:44 +01:00
|
|
|
extern Process* g_last_fpu_process;
|
2019-02-06 18:45:21 +01:00
|
|
|
extern Process* g_finalizer;
|
2018-11-07 22:15:02 +01:00
|
|
|
|
|
|
|
|
class Scheduler {
|
|
|
|
|
public:
|
|
|
|
|
static void initialize();
|
2018-11-08 00:24:59 +01:00
|
|
|
static void timer_tick(RegisterDump&);
|
2018-11-07 22:15:02 +01:00
|
|
|
static bool pick_next();
|
|
|
|
|
static void pick_next_and_switch_now();
|
|
|
|
|
static void switch_now();
|
|
|
|
|
static bool yield();
|
2019-02-07 11:12:23 +01:00
|
|
|
static bool donate_to(Process*, const char* reason);
|
2018-11-07 22:15:02 +01:00
|
|
|
static bool context_switch(Process&);
|
2018-11-07 23:59:49 +01:00
|
|
|
static void prepare_to_modify_tss(Process&);
|
2019-02-04 10:28:12 +01:00
|
|
|
static Process* colonel();
|
2019-02-06 15:05:47 +01:00
|
|
|
static bool is_active();
|
2018-11-08 00:24:59 +01:00
|
|
|
private:
|
|
|
|
|
static void prepare_for_iret_to_new_process();
|
2018-11-07 22:15:02 +01:00
|
|
|
};
|