GitOS
Operating system exercise
Loading...
Searching...
No Matches
task.h File Reference
#include "memory/paging/paging.h"
#include "idt/idt.h"

Go to the source code of this file.

Data Structures

struct  registers
 
struct  task
 

Macros

#define PROGRAM_VIRTUAL_ADDRESS   0x400000
 
#define PROGRAM_VIRTUAL_STACK_SIZE   1024 * 16
 
#define PROGRAM_VIRTUAL_STACK_ADDRESS_START   0x3FF000
 
#define PROGRAM_VIRTUAL_STACK_ADDRESS_END   PROGRAM_VIRTUAL_STACK_ADDRESS_START - PROGRAM_VIRTUAL_STACK_SIZE
 

Functions

struct registers __attribute__ ((packed))
 
struct tasktask_current ()
 Returns currently running task.
 
struct tasktask_get_next ()
 Returns next task in list (or first if there is no next task in current_task)
 
struct tasktask_new (struct process *process)
 
int task_free (struct task *task)
 Frees all data associated with task struct.
 
void task_return (struct registers *registers)
 
void task_run_first_ever_task ()
 
void user_registers ()
 
int task_switch (struct task *task)
 Switch current task (switch pages)
 
int task_page ()
 Loads into the task's page.
 
void task_page_task (struct task *task)
 
void task_current_save_state (struct interrupt_frame *frame)
 
int task_copy_string_from (struct task *task, void *virtual_address, void *physical_address, int max)
 
void * task_peek_stack (struct task *task, int offset)
 

Variables

uint32_t edi
 
uint32_t esi
 
uint32_t ebp
 
uint32_t ebx
 
uint32_t edx
 
uint32_t ecx
 
uint32_t eax
 
uint32_t ip
 
uint32_t cs
 
uint32_t flags
 
uint32_t esp
 
uint32_t ss
 
struct task __attribute__
 

Macro Definition Documentation

◆ PROGRAM_VIRTUAL_ADDRESS

#define PROGRAM_VIRTUAL_ADDRESS   0x400000

◆ PROGRAM_VIRTUAL_STACK_ADDRESS_END

#define PROGRAM_VIRTUAL_STACK_ADDRESS_END   PROGRAM_VIRTUAL_STACK_ADDRESS_START - PROGRAM_VIRTUAL_STACK_SIZE

◆ PROGRAM_VIRTUAL_STACK_ADDRESS_START

#define PROGRAM_VIRTUAL_STACK_ADDRESS_START   0x3FF000

◆ PROGRAM_VIRTUAL_STACK_SIZE

#define PROGRAM_VIRTUAL_STACK_SIZE   1024 * 16

Function Documentation

◆ __attribute__()

struct registers __attribute__ ( (packed)  )

◆ task_copy_string_from()

int task_copy_string_from ( struct task task,
void *  virtual_address,
void *  physical_address,
int  max 
)

◆ task_current()

struct task * task_current ( )

Returns currently running task.

Returns
struct task* Current task

References current_task.

◆ task_current_save_state()

void task_current_save_state ( struct interrupt_frame frame)

◆ task_free()

int task_free ( struct task task)

Frees all data associated with task struct.

Parameters
taskTask to free
Returns
int Error code

References kfree(), task::page_directory, and paging_free_directory().

◆ task_get_next()

struct task * task_get_next ( )

Returns next task in list (or first if there is no next task in current_task)

Returns
struct task* Next task

References current_task, task::next, and task_head.

◆ task_new()

struct task * task_new ( struct process process)

◆ task_page()

int task_page ( )

Loads into the task's page.

Returns
int Error code

References current_task, task_switch(), and user_registers().

◆ task_page_task()

void task_page_task ( struct task task)

References task_switch(), and user_registers().

◆ task_peek_stack()

void * task_peek_stack ( struct task task,
int  offset 
)

◆ task_return()

void task_return ( struct registers registers)

◆ task_run_first_ever_task()

void task_run_first_ever_task ( )

◆ task_switch()

int task_switch ( struct task task)

Switch current task (switch pages)

Parameters
taskTask to switch to
Returns
int Error code

References current_task, task::page_directory, and paging_switch().

◆ user_registers()

void user_registers ( )

Variable Documentation

◆ __attribute__

struct task __attribute__

◆ cs

uint32_t cs

◆ eax

uint32_t eax

◆ ebp

uint32_t ebp

◆ ebx

uint32_t ebx

◆ ecx

uint32_t ecx

◆ edi

uint32_t edi

◆ edx

uint32_t edx

◆ esi

uint32_t esi

◆ esp

uint32_t esp

◆ flags

uint32_t flags

◆ ip

uint32_t ip

◆ ss

uint32_t ss