GitOS
Operating system exercise
Loading...
Searching...
No Matches
task.h
Go to the documentation of this file.
1#pragma once
4#include "idt/idt.h"
7 uint32_t edi; //0
8 uint32_t esi; //4
9 uint32_t ebp; //8
10 uint32_t ebx; //12
11 uint32_t edx; //16
12 uint32_t ecx; //20
13 uint32_t eax; //24
14
15 uint32_t ip; //28
16 uint32_t cs; //32
17 uint32_t flags; //36
18 uint32_t esp; //40
19 uint32_t ss; //44
20} __attribute__((packed));
21
22struct process;
23
24struct task
25{
31
37
43
48 struct task* next;
49
54 struct task* prev;
55};
56
57#define PROGRAM_VIRTUAL_ADDRESS 0x400000
58#define PROGRAM_VIRTUAL_STACK_SIZE 1024 * 16
59#define PROGRAM_VIRTUAL_STACK_ADDRESS_START 0x3FF000
60#define PROGRAM_VIRTUAL_STACK_ADDRESS_END PROGRAM_VIRTUAL_STACK_ADDRESS_START - PROGRAM_VIRTUAL_STACK_SIZE
61
62struct task* task_current();
63struct task* task_get_next();
64struct task* task_new(struct process* process);
65int task_free(struct task* task);
67
70int task_switch(struct task* task);
71int task_page();
72void task_page_task(struct task* task);
74
75int task_copy_string_from(struct task* task, void* virtual_address, void* physical_address, int max);
76void* task_peek_stack(struct task* task, int offset);
uint32_t offset
Definition BMPFile.hpp:3
Definition idt.h:22
Definition paging.h:14
Definition process.h:12
Definition task.h:6
uint32_t edi
Definition task.h:7
uint32_t ss
Definition task.h:19
uint32_t ip
Definition task.h:15
uint32_t esp
Definition task.h:18
uint32_t flags
Definition task.h:17
uint32_t cs
Definition task.h:16
uint32_t eax
Definition task.h:13
uint32_t ebp
Definition task.h:9
uint32_t esi
Definition task.h:8
uint32_t edx
Definition task.h:11
uint32_t ebx
Definition task.h:10
uint32_t ecx
Definition task.h:12
Definition task.h:25
struct task * prev
Previous task.
Definition task.h:54
struct paging_chunk * page_directory
The page directory of the task.
Definition task.h:30
struct process * process
Process of task.
Definition task.h:42
struct task * next
Next task.
Definition task.h:48
int task_switch(struct task *task)
Switch current task (switch pages)
Definition task.c:113
void user_registers()
struct task __attribute__
int task_page()
Loads into the task's page.
Definition task.c:125
struct task * task_get_next()
Returns next task in list (or first if there is no next task in current_task)
Definition task.c:65
struct task * task_new(struct process *process)
Definition task.c:169
int task_copy_string_from(struct task *task, void *virtual_address, void *physical_address, int max)
Definition task.c:206
void * task_peek_stack(struct task *task, int offset)
Definition task.c:237
int task_free(struct task *task)
Frees all data associated with task struct.
Definition task.c:99
void task_run_first_ever_task()
Definition task.c:132
void task_return(struct registers *registers)
struct task * task_current()
Returns currently running task.
Definition task.c:27
void task_current_save_state(struct interrupt_frame *frame)
Definition task.c:49
void task_page_task(struct task *task)
Definition task.c:231