|
|
@ -3,12 +3,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include "../kernel.h"
|
|
|
|
#include "../kernel.h"
|
|
|
|
|
|
|
|
|
|
|
|
// process statuses:
|
|
|
|
enum process_status {
|
|
|
|
#define PROC_DEAD 0
|
|
|
|
PROC_DEAD = 0,
|
|
|
|
#define PROC_RDY 1
|
|
|
|
PROC_RDY = 1,
|
|
|
|
#define PROC_WAIT_LOCK 2
|
|
|
|
PROC_WAIT_PROC = 2,
|
|
|
|
#define PROC_WAIT_PROC 3
|
|
|
|
PROC_WAIT_SLEEP = 3,
|
|
|
|
#define PROC_WAIT_SLEEP 4
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// process structure:
|
|
|
|
// process structure:
|
|
|
|
typedef struct ProcessControlBlock ProcessControlBlock;
|
|
|
|
typedef struct ProcessControlBlock ProcessControlBlock;
|
|
|
@ -17,8 +17,7 @@ struct ProcessControlBlock {
|
|
|
|
int pc;
|
|
|
|
int pc;
|
|
|
|
int regs[31];
|
|
|
|
int regs[31];
|
|
|
|
// scheduling information
|
|
|
|
// scheduling information
|
|
|
|
int status;
|
|
|
|
enum process_status status;
|
|
|
|
int requested_lock;
|
|
|
|
|
|
|
|
ProcessControlBlock *waiting_for_process;
|
|
|
|
ProcessControlBlock *waiting_for_process;
|
|
|
|
unsigned long long int asleep_until;
|
|
|
|
unsigned long long int asleep_until;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -33,5 +32,6 @@ void __attribute__((noreturn)) scheduler_run_next();
|
|
|
|
void __attribute__((noreturn)) scheduler_switch_to(int proc_index);
|
|
|
|
void __attribute__((noreturn)) scheduler_switch_to(int proc_index);
|
|
|
|
int scheduler_index_from_pid(int pid);
|
|
|
|
int scheduler_index_from_pid(int pid);
|
|
|
|
int* get_current_process_registers();
|
|
|
|
int* get_current_process_registers();
|
|
|
|
|
|
|
|
ProcessControlBlock* get_current_process();
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|