GitOS
Operating system exercise
|
#include "task.h"
#include <common/assert.h>
#include "common/status.h"
#include "memory/paging/paging.h"
#include "memory/heap/kheap.h"
#include "gdt/gdt.h"
#include "idt/idt.h"
#include "memory/memory.h"
#include "process.h"
#include "kernel.h"
#include "common/string.h"
Functions | |
int | task_init (struct task *task, struct process *process) |
Initializes task struct's ip,ss,esp registers and created new paging directory. | |
struct task * | task_current () |
Returns currently running task. | |
void | task_save_state (struct task *task, struct interrupt_frame *frame) |
void | task_current_save_state (struct interrupt_frame *frame) |
struct task * | task_get_next () |
Returns next task in list (or first if there is no next task in current_task) | |
int | task_free (struct task *task) |
Frees all data associated with task struct. | |
int | task_switch (struct task *task) |
Switch current task (switch pages) | |
int | task_page () |
Loads into the task's page. | |
void | task_run_first_ever_task () |
struct task * | task_new (struct process *process) |
int | task_copy_string_from (struct task *task, void *virtual_address, void *physical_address, int max) |
void | task_page_task (struct task *task) |
void * | task_peek_stack (struct task *task, int offset) |
Variables | |
struct task * | current_task = 0 |
struct task * | task_tail = 0 |
struct task * | task_head = 0 |
int task_copy_string_from | ( | struct task * | task, |
void * | virtual_address, | ||
void * | physical_address, | ||
int | max | ||
) |
struct task * task_current | ( | ) |
void task_current_save_state | ( | struct interrupt_frame * | frame | ) |
References kernel_panic(), task_current(), and task_save_state().
int task_free | ( | struct task * | task | ) |
Frees all data associated with task struct.
task | Task to free |
References kfree(), task::page_directory, and paging_free_directory().
struct task * task_get_next | ( | ) |
Returns next task in list (or first if there is no next task in current_task)
References current_task, task::next, and task_head.
Initializes task struct's ip,ss,esp registers and created new paging directory.
task | Struct to be initialized |
References registers::cs, EIO, process::elf_entry, registers::esp, registers::flags, registers::ip, memset(), task::page_directory, PAGING_ACCESS_FROM_ALL, PAGING_IS_PRESENT, paging_new_directory(), task::process, PROGRAM_VIRTUAL_STACK_ADDRESS_START, task::registers, registers::ss, USER_CODE_SELECTOR, and USER_DATA_SELECTOR.
References current_task, ENOMEM, ERROR, ISERR, kzalloc(), task::next, task::prev, task_free(), task_head, task_init(), and task_tail.
int task_page | ( | ) |
Loads into the task's page.
References current_task, task_switch(), and user_registers().
void task_page_task | ( | struct task * | task | ) |
References task_switch(), and user_registers().
void * task_peek_stack | ( | struct task * | task, |
int | offset | ||
) |
References registers::esp, kernel_page(), offset, task::registers, and task_page_task().
void task_run_first_ever_task | ( | ) |
References current_task, kernel_panic(), task::registers, task_head, task_return(), and task_switch().
void task_save_state | ( | struct task * | task, |
struct interrupt_frame * | frame | ||
) |
References interrupt_frame::cs, registers::cs, interrupt_frame::eax, registers::eax, interrupt_frame::ebp, registers::ebp, interrupt_frame::ebx, registers::ebx, interrupt_frame::ecx, registers::ecx, interrupt_frame::edi, registers::edi, interrupt_frame::edx, registers::edx, interrupt_frame::esi, registers::esi, interrupt_frame::esp, registers::esp, interrupt_frame::flags, registers::flags, interrupt_frame::ip, registers::ip, task::registers, interrupt_frame::ss, and registers::ss.
int task_switch | ( | struct task * | task | ) |
Switch current task (switch pages)
task | Task to switch to |
References current_task, task::page_directory, and paging_switch().
struct task* current_task = 0 |
struct task* task_head = 0 |
struct task* task_tail = 0 |