summaryrefslogtreecommitdiff
path: root/Source/Kernel/TaskManager/Task.ns.h
blob: 4d2a48df3d0d01a35d9f79ceb6f27e3e24f50ca2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef DEF_TASK_NS_H
#define DEF_TASK_NS_H

#include <TaskManager/Thread.class.h>
#include <VTManager/VirtualTerminal.proto.h>
#include <SimpleList.class.h>

namespace Task {
	Thread* currThread();
	Process* currProcess();

	extern SimpleList <Process*> *processes;
	extern SimpleList <Thread*> *threads;

	void initialize(String cmdline, VirtualTerminal *vt);	//cmdline should be the bootloader kernel command line, if anybody needs it
	void doSwitch();
	void triggerSwitch();
	u32int nextPid();
	bool IRQwakeup(u8int irq);

	void allocKernelPageTable(u32int id, page_table_t *table, u32int tablePhys);
	Process* getKernelProcess();	//Returns first registered process

	void currentThreadExits(u32int errcode); 	//Syscall called when a thread finishes

	//These are used by the constructors/destructors of Thread and Process
	void registerThread(Thread* t);
	void unregisterThread(Thread* t);
	void registerProcess(Process* p);
	void unregisterProcess(Process* p);
}

#endif