mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-25 22:14:37 +00:00
More tasking stub
This commit is contained in:
parent
51c096c743
commit
2f7b871aa0
8
KThread.cpp
Normal file
8
KThread.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "kernel.h"
|
||||
|
||||
void KernelMainThread()
|
||||
{
|
||||
KPrint("Kernel main thread started!");
|
||||
// asm("int $0x1");
|
||||
CPU::Stop();
|
||||
}
|
@ -19,6 +19,7 @@ Video::Display *Display = nullptr;
|
||||
SymbolResolver::Symbols *KernelSymbolTable = nullptr;
|
||||
Power::Power *PowerManager = nullptr;
|
||||
PCI::PCI *PCIManager = nullptr;
|
||||
Tasking::Task *TaskManager = nullptr;
|
||||
|
||||
KernelConfig Config;
|
||||
Time BootClock;
|
||||
@ -83,6 +84,6 @@ EXTERNC void Entry(BootInfo *Info)
|
||||
SMP::Initialize(PowerManager->GetMADT());
|
||||
KPrint("\e058C19######## \eE85230END \e058C19########");
|
||||
CPU::Interrupts(CPU::Enable);
|
||||
// asm("int $0x1");
|
||||
TaskManager = new Tasking::Task((Tasking::IP)KernelMainThread);
|
||||
CPU::Stop();
|
||||
}
|
||||
|
26
Tasking/Task.cpp
Normal file
26
Tasking/Task.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <task.hpp>
|
||||
#include <debug.h>
|
||||
|
||||
namespace Tasking
|
||||
{
|
||||
PCB *Task::CreateProcess(char *Name, ExecutionElevation Elevation)
|
||||
{
|
||||
PCB *Process = new PCB;
|
||||
return Process;
|
||||
}
|
||||
|
||||
TCB *Task::CreateThread(PCB *Parent, IP EntryPoint)
|
||||
{
|
||||
TCB *Thread = new TCB;
|
||||
return Thread;
|
||||
}
|
||||
|
||||
Task::Task(const IP EntryPoint)
|
||||
{
|
||||
trace("Starting tasking with IP: %#lx", EntryPoint);
|
||||
}
|
||||
|
||||
Task::~Task()
|
||||
{
|
||||
}
|
||||
}
|
@ -3,6 +3,60 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
namespace Tasking
|
||||
{
|
||||
typedef unsigned long IP;
|
||||
typedef unsigned long UPID;
|
||||
typedef unsigned long UTID;
|
||||
|
||||
enum ExecutionElevation
|
||||
{
|
||||
UnknownElevation,
|
||||
Kernel,
|
||||
System,
|
||||
Idle,
|
||||
User
|
||||
};
|
||||
|
||||
enum ExecutionStatus
|
||||
{
|
||||
UnknownStatus,
|
||||
Running,
|
||||
Sleeping,
|
||||
Waiting,
|
||||
Stopped,
|
||||
Terminated
|
||||
};
|
||||
|
||||
struct ExecutionSecurity
|
||||
{
|
||||
ExecutionElevation Elevation;
|
||||
};
|
||||
|
||||
struct PCB
|
||||
{
|
||||
UPID PID;
|
||||
char Name[256];
|
||||
ExecutionSecurity Security;
|
||||
ExecutionStatus Status;
|
||||
};
|
||||
|
||||
struct TCB
|
||||
{
|
||||
UTID TID;
|
||||
PCB *Parent;
|
||||
IP EntryPoint;
|
||||
};
|
||||
|
||||
class Task
|
||||
{
|
||||
public:
|
||||
PCB *CreateProcess(char *Name, ExecutionElevation Elevation);
|
||||
TCB *CreateThread(PCB *Parent, IP EntryPoint);
|
||||
|
||||
Task(const IP EntryPoint);
|
||||
~Task();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // !__FENNIX_KERNEL_TASKING_H__
|
||||
|
3
kernel.h
3
kernel.h
@ -9,6 +9,7 @@
|
||||
#include <symbols.hpp>
|
||||
#include <kconfig.hpp>
|
||||
#include <power.hpp>
|
||||
#include <task.hpp>
|
||||
#include <pci.hpp>
|
||||
#endif
|
||||
|
||||
@ -19,9 +20,11 @@ extern SymbolResolver::Symbols *KernelSymbolTable;
|
||||
extern Power::Power *PowerManager;
|
||||
extern PCI::PCI *PCIManager;
|
||||
extern KernelConfig Config;
|
||||
extern Tasking::Task *TaskManager;
|
||||
#endif
|
||||
|
||||
EXTERNC void KPrint(const char *format, ...);
|
||||
EXTERNC void Entry(struct BootInfo *Info);
|
||||
EXTERNC void KernelMainThread();
|
||||
|
||||
#endif // !__FENNIX_KERNEL_KERNEL_H__
|
||||
|
Loading…
x
Reference in New Issue
Block a user