UnnamedOS
task.h File Reference
#include <stdint.h>
#include <interrupts/isr.h>
#include <mem/vmm.h>
+ Include dependency graph for task.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  task_t
 internal representation of a task More...
 

Macros

#define _4KB   0x1000
 4KB are 4096 bytes, often used for stacks
 

Typedefs

typedef uint8_t task_stack_t
 stacks are measured in bytes
 
typedef uint32_t task_pid_t
 unique process ID
 

Enumerations

enum  task_state_t { TASK_STOPPED, TASK_RUNNING }
 state of a task
 

Functions

task_pid_t task_add (task_t *task)
 Adds a new task to the task list and associates a PID. 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...