MushOS  0.1
A UNIX-like OS prototype, written from scratch
Loading...
Searching...
No Matches
task.h
1#ifndef MUSHOS_TASK_H
2#define MUSHOS_TASK_H
3
4#include "../../lib/base/generic.h"
5
6#include "pages.h"
7
8
9// This structure defines a 'task' - a process.
10typedef struct task_struct {
11 int id; // Process ID.
12 u_dword esp, ebp; // Stack and base pointers.
13 u_dword eip; // Instruction pointer.
14 page_folder *page_directory; // Page directory.
15 struct task_struct *next; // The next task in a linked list.
16} task;
17
18// Initialises the tasking system.
19void initialise_tasking();
20
21// Called by the timer hook, this changes the running process.
22void switch_task();
23
24// Forks the current process, spawning a new one with a different
25// memory space.
26u_dword fork();
27
28// Returns the pid of the current process.
29int getpid();
30
31#endif //MUSHOS_TASK_H