LF OS
Hobby operating system for amd64 with high ambitions
|
Go to the source code of this file.
Data Structures | |
union | wait_data |
Enumerations | |
enum | kill_reason { kill_reason_segv = 1 , kill_reason_abort = 2 } |
enum | wait_reason { wait_reason_mutex , wait_reason_condvar , wait_reason_message , wait_reason_time } |
Functions | |
void | init_scheduler (void) |
void | start_task (struct vm_table *context, ptr_t entry, ptr_t data_start, ptr_t data_end, const char *name) |
void | schedule_next (cpu_state **cpu, struct vm_table **context) |
bool | schedule_next_if_needed (cpu_state **cpu, struct vm_table **context) |
void | scheduler_process_save (cpu_state *cpu) |
bool | scheduler_handle_pf (ptr_t fault_address, uint64_t error_code) |
void | scheduler_kill_current (enum kill_reason kill_reason) |
void | scheduler_wait_for (pid_t pid, enum wait_reason reason, union wait_data data) |
void | scheduler_waitable_done (enum wait_reason reason, union wait_data data, size_t max_amount) |
ptr_t | scheduler_map_hardware (ptr_t hw, size_t len) |
Map a given memory area in the currently running userspace process at a random location. | |
Variables | |
volatile pid_t | scheduler_current_process |
union wait_data |
enum kill_reason |
Enumerator | |
---|---|
kill_reason_segv | |
kill_reason_abort |
Definition at line 8 of file scheduler.h.
enum wait_reason |
Enumerator | |
---|---|
wait_reason_mutex | |
wait_reason_condvar | |
wait_reason_message | |
wait_reason_time |
Definition at line 13 of file scheduler.h.
void init_scheduler | ( | void | ) |
Definition at line 87 of file scheduler.c.
References MAX_PROCS, memset(), and processes.
Definition at line 181 of file scheduler.c.
References process_t::context, process_t::cpu, MAX_PROCS, pid, process, process_state_runnable, process_state_running, process_state_waiting, processes, sc_handle_clock_read(), scheduler_current_process, scheduler_idle_if_needed(), process_t::state, state, and wait_reason_time.
Definition at line 221 of file scheduler.c.
References process_state_runnable, process_state_running, processes, schedule_next(), scheduler_current_process, and state.
Definition at line 334 of file scheduler.c.
References ALLOCATOR_REGION_DIRECT_MAPPING, ALLOCATOR_REGION_USER_STACK, logw, memset(), mm_alloc_pages(), name, processes, scheduler_current_process, process_t::stack, region_t::start, and vm_context_map().
void scheduler_kill_current | ( | enum kill_reason | kill_reason | ) |
Map a given memory area in the currently running userspace process at a random location.
Definition at line 605 of file scheduler.c.
References region_t::end, process_t::hw, processes, scheduler_current_process, and vm_map_hardware().
void scheduler_process_save | ( | cpu_state * | cpu | ) |
Definition at line 155 of file scheduler.c.
References memcpy(), process_state_running, process_state_waiting, processes, scheduler_current_process, and state.
void scheduler_wait_for | ( | pid_t | pid, |
enum wait_reason | reason, | ||
union wait_data | data | ||
) |
Definition at line 353 of file scheduler.c.
References pid, process_state_waiting, processes, scheduler_current_process, process_t::state, process_t::waiting_data, and process_t::waiting_for.
void scheduler_waitable_done | ( | enum wait_reason | reason, |
union wait_data | data, | ||
size_t | max_amount | ||
) |
Definition at line 363 of file scheduler.c.
References wait_data::condvar, MAX_PROCS, wait_data::message_queue, wait_data::mutex, mutex_lock(), pid, process_state_runnable, process_state_waiting, processes, scheduler_current_process, process_t::state, wait_reason_condvar, wait_reason_message, wait_reason_mutex, wait_reason_time, process_t::waiting_data, and process_t::waiting_for.
void start_task | ( | struct vm_table * | context, |
ptr_t | entry, | ||
ptr_t | data_start, | ||
ptr_t | data_end, | ||
const char * | name | ||
) |
Definition at line 136 of file scheduler.c.
References ALLOCATOR_REGION_USER_STACK, data_end, entry, name, panic_message(), process_t::parent, pid, process, processes, setup_process(), and strncpy().
|
extern |
Definition at line 50 of file scheduler.c.