More tasking stubs

This commit is contained in:
Alex 2022-10-21 03:49:56 +03:00
parent 8b27051f48
commit 3de8e1c932
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
4 changed files with 70 additions and 8 deletions

View File

@ -1,2 +0,0 @@
#include <task.hpp>

View File

@ -1,2 +0,0 @@
#include <task.hpp>

View File

@ -1,26 +1,74 @@
#include <task.hpp> #include <task.hpp>
#include <debug.h> #include <debug.h>
#include <smp.hpp>
#include <lock.hpp>
NewLock(TaskingLock);
#if defined(__amd64__)
#include "../Architecture/amd64/cpu/gdt.hpp"
#elif defined(__i386__)
#elif defined(__aarch64__)
#endif
namespace Tasking namespace Tasking
{ {
PCB *Task::CreateProcess(char *Name, ExecutionElevation Elevation) #if defined(__amd64__)
#elif defined(__i386__)
#elif defined(__aarch64__)
#endif
void a()
{ {
return;
}
PCB *Task::GetCurrentProcess()
{
SmartCriticalSection(TaskingLock);
return GetCurrentCPU()->CurrentProcess;
}
TCB *Task::GetCurrentThread()
{
SmartCriticalSection(TaskingLock);
return GetCurrentCPU()->CurrentThread;
}
PCB *Task::CreateProcess(PCB *Parent,
char *Name,
ExecutionElevation Elevation)
{
SmartCriticalSection(TaskingLock);
PCB *Process = new PCB; PCB *Process = new PCB;
#if defined(__amd64__)
#elif defined(__i386__)
#elif defined(__aarch64__)
#endif
return Process; return Process;
} }
TCB *Task::CreateThread(PCB *Parent, IP EntryPoint) TCB *Task::CreateThread(PCB *Parent,
IP EntryPoint)
{ {
SmartCriticalSection(TaskingLock);
TCB *Thread = new TCB; TCB *Thread = new TCB;
#if defined(__amd64__)
#elif defined(__i386__)
#elif defined(__aarch64__)
#endif
return Thread; return Thread;
} }
Task::Task(const IP EntryPoint) Task::Task(const IP EntryPoint)
{ {
SmartCriticalSection(TaskingLock);
trace("Starting tasking with IP: %#lx", EntryPoint); trace("Starting tasking with IP: %#lx", EntryPoint);
} }
Task::~Task() Task::~Task()
{ {
SmartCriticalSection(TaskingLock);
trace("Stopping tasking");
} }
} }

View File

@ -8,6 +8,7 @@ namespace Tasking
typedef unsigned long IP; typedef unsigned long IP;
typedef unsigned long UPID; typedef unsigned long UPID;
typedef unsigned long UTID; typedef unsigned long UTID;
typedef unsigned long Token;
enum ExecutionElevation enum ExecutionElevation
{ {
@ -31,6 +32,7 @@ namespace Tasking
struct ExecutionSecurity struct ExecutionSecurity
{ {
ExecutionElevation Elevation; ExecutionElevation Elevation;
Token Token;
}; };
struct PCB struct PCB
@ -51,8 +53,24 @@ namespace Tasking
class Task class Task
{ {
public: public:
PCB *CreateProcess(char *Name, ExecutionElevation Elevation); /**
TCB *CreateThread(PCB *Parent, IP EntryPoint); * @brief Get the Current Process object
* @return PCB*
*/
PCB *GetCurrentProcess();
/**
* @brief Get the Current Thread object
* @return TCB*
*/
TCB *GetCurrentThread();
PCB *CreateProcess(PCB *Parent,
char *Name,
ExecutionElevation Elevation);
TCB *CreateThread(PCB *Parent,
IP EntryPoint);
Task(const IP EntryPoint); Task(const IP EntryPoint);
~Task(); ~Task();