mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Fixed race conditions
This commit is contained in:
parent
07738ddb0a
commit
3f3db40026
12
KThread.cpp
12
KThread.cpp
@ -163,16 +163,15 @@ void KernelMainThread()
|
|||||||
KPrint("Starting Network Interface Manager...");
|
KPrint("Starting Network Interface Manager...");
|
||||||
NIManager->StartService();
|
NIManager->StartService();
|
||||||
|
|
||||||
KPrint("Setting up userspace");
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
TreeFS(vfs->GetRootNode(), 0);
|
TreeFS(vfs->GetRootNode(), 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Time::Clock tm = Time::ReadClock();
|
||||||
|
printf("\eCCCCCC[\e00AEFF%02d:%02d:%02d\eCCCCCC] ", tm.Hour, tm.Minute, tm.Second);
|
||||||
const char *USpace_msg = "Setting up userspace";
|
const char *USpace_msg = "Setting up userspace";
|
||||||
for (size_t i = 0; i < strlen(USpace_msg); i++)
|
for (size_t i = 0; i < strlen(USpace_msg); i++)
|
||||||
Display->Print(USpace_msg[i], 0);
|
Display->Print(USpace_msg[i], 0);
|
||||||
|
|
||||||
Display->SetBuffer(0);
|
Display->SetBuffer(0);
|
||||||
|
|
||||||
Execute::SpawnData ret = {Execute::ExStatus::Unknown, nullptr, nullptr};
|
Execute::SpawnData ret = {Execute::ExStatus::Unknown, nullptr, nullptr};
|
||||||
@ -186,9 +185,6 @@ void KernelMainThread()
|
|||||||
Display->Print('.', 0);
|
Display->Print('.', 0);
|
||||||
Display->SetBuffer(0);
|
Display->SetBuffer(0);
|
||||||
|
|
||||||
/* Prevent race conditions */
|
|
||||||
CPU::Interrupts(CPU::Disable);
|
|
||||||
|
|
||||||
ret = SpawnInit();
|
ret = SpawnInit();
|
||||||
|
|
||||||
Display->Print('.', 0);
|
Display->Print('.', 0);
|
||||||
@ -207,11 +203,9 @@ void KernelMainThread()
|
|||||||
Display->Print('\n', 0);
|
Display->Print('\n', 0);
|
||||||
Display->SetBuffer(0);
|
Display->SetBuffer(0);
|
||||||
|
|
||||||
/* Prevent the init process to execute syscalls without being trusted by the kernel */
|
|
||||||
CPU::Interrupts(CPU::Enable);
|
|
||||||
|
|
||||||
KPrint("Waiting for \e22AAFF%s\eCCCCCC to start...", Config.InitPath);
|
KPrint("Waiting for \e22AAFF%s\eCCCCCC to start...", Config.InitPath);
|
||||||
TaskManager->GetCurrentThread()->SetPriority(Tasking::Idle);
|
TaskManager->GetCurrentThread()->SetPriority(Tasking::Idle);
|
||||||
|
|
||||||
TaskManager->WaitForThread(ret.Thread);
|
TaskManager->WaitForThread(ret.Thread);
|
||||||
ExitCode = ret.Thread->GetExitCode();
|
ExitCode = ret.Thread->GetExitCode();
|
||||||
if (ExitCode != 0)
|
if (ExitCode != 0)
|
||||||
|
@ -154,10 +154,8 @@ namespace NetworkInterfaceManager
|
|||||||
|
|
||||||
void NetworkInterface::StartService()
|
void NetworkInterface::StartService()
|
||||||
{
|
{
|
||||||
CPU::Interrupts(CPU::Disable);
|
|
||||||
this->NetSvcThread = TaskManager->CreateThread(TaskManager->GetCurrentProcess(), (Tasking::IP)CallStartNetworkStackWrapper);
|
this->NetSvcThread = TaskManager->CreateThread(TaskManager->GetCurrentProcess(), (Tasking::IP)CallStartNetworkStackWrapper);
|
||||||
this->NetSvcThread->Rename("Network Service");
|
this->NetSvcThread->Rename("Network Service");
|
||||||
CPU::Interrupts(CPU::Enable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkInterface::DrvSend(unsigned int DriverID, unsigned char *Data, unsigned short Size)
|
void NetworkInterface::DrvSend(unsigned int DriverID, unsigned char *Data, unsigned short Size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user