UnnamedOS
task.c File Reference
#include <common.h>
#include <tasks/task.h>
#include <tasks/schedule.h>
#include <tasks/elf.h>
#include <interrupts/isr.h>
#include <mem/gdt.h>
#include <mem/mmu.h>
#include <mem/vmm.h>
#include <boot/multiboot.h>
#include <string.h>
+ Include dependency graph for task.c:

Go to the source code of this file.

Macros

#define MAX_TASKS   1024
 maximum number of tasks
 

Functions

static task_ttask_get (task_pid_t pid)
 Returns the internal task structure associated with the given PID. More...
 
task_pid_t task_add (task_t *task)
 Adds a new task to the task list and associates a PID. More...
 
static void task_remove (task_pid_t pid)
 Removes a task from the task list. More...
 
static task_pid_t task_create_detailed (void *entry_point, page_directory_t *page_directory, size_t kernel_stack_len, size_t user_stack_len, elf_t *elf, size_t code_segment, size_t data_segment)
 Creates a task. More...
 
task_pid_t task_create_kernel (void *entry_point, page_directory_t *page_directory, size_t kernel_stack_len)
 Creates a kernel task. More...
 
task_pid_t task_create_user (void *entry_point, page_directory_t *page_directory, size_t kernel_stack_len, size_t user_stack_len, void *elf)
 Creates a user task. More...
 
void task_stop (task_pid_t pid)
 Stops a task. More...
 
void task_destroy (task_pid_t pid)
 Destroys a task. More...
 
task_pid_t task_get_next_task (task_pid_t pid)
 Returns the next task from the task list. More...
 
task_pid_t task_get_next_task_with_state (task_pid_t pid, task_state_t state)
 Returns the next task from the task list with a specified state. More...
 
task_state_t task_get_ticks (task_pid_t pid)
 Returns a task's number of remaining ticks. More...
 
uint32_t task_set_ticks (task_pid_t pid, uint32_t ticks)
 Sets a task's number of remaining ticks. More...
 
cpu_state_ttask_get_cpu (task_pid_t pid)
 Returns a task's CPU state. More...
 
void task_set_cpu (task_pid_t pid, cpu_state_t *cpu)
 Sets a task's CPU state. More...
 
page_directory_ttask_get_page_directory (task_pid_t pid)
 Returns a task's page directory. More...
 
uint8_t task_get_vm86 (task_pid_t pid)
 Returns whether a task is a VM86 task. More...
 
void * task_get_elf (task_pid_t pid)
 Returns a task's ELF file. More...
 
void task_dump ()
 Dumps the task list. More...
 

Variables

static task_ttasks [MAX_TASKS]
 Array of tasks. More...