summaryrefslogtreecommitdiffhomepage
path: root/Kernel/Sources
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-13 19:55:30 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-13 19:55:30 +0200
commit12126f9eebfa7fc6b2cd6148f13585ff71cf5425 (patch)
tree9fbf2130329eac51fc0dfae30527f5dabad6d41e /Kernel/Sources
parent7327f305efb1c6678722308cc5f9645dd39f451e (diff)
MHR-31: Rework scheduler, remove the concept of user driver and rings.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Kernel/Sources')
-rw-r--r--Kernel/Sources/CodeManager.cxx4
-rw-r--r--Kernel/Sources/KeMain.cxx7
-rw-r--r--Kernel/Sources/ProcessScheduler.cxx24
3 files changed, 6 insertions, 29 deletions
diff --git a/Kernel/Sources/CodeManager.cxx b/Kernel/Sources/CodeManager.cxx
index 33121edf..9f374c18 100644
--- a/Kernel/Sources/CodeManager.cxx
+++ b/Kernel/Sources/CodeManager.cxx
@@ -20,11 +20,11 @@ namespace NewOS
return false;
ProcessHeader proc((VoidPtr)main);
- proc.Kind = ProcessHeader::kDriverKind;
+ proc.Kind = ProcessHeader::kAppKind;
rt_copy_memory((VoidPtr)processName, proc.Name, rt_string_len(proc.Name));
Ref<ProcessHeader> refProc = proc;
return ProcessScheduler::The().Leak().Add(refProc);
}
-} // namespace NewOS \ No newline at end of file
+} // namespace NewOS
diff --git a/Kernel/Sources/KeMain.cxx b/Kernel/Sources/KeMain.cxx
index 60494ee3..9be8a026 100644
--- a/Kernel/Sources/KeMain.cxx
+++ b/Kernel/Sources/KeMain.cxx
@@ -204,9 +204,7 @@ namespace NewOS::Detail
NewOS::Utils::execute_from_image(stageBoard,
NewOS::ProcessHeader::kAppKind);
- NewOS::kcout << "SystemLauncher: done, sleeping...";
-
- while (true) {}
+ /// TODO: now jump to user mode using the HAL.
}
} // namespace NewOS::Detail
@@ -218,6 +216,5 @@ EXTERN_C NewOS::Void KeMain(NewOS::Void)
/// Now run kernel loop, until no process are running.
NewOS::Detail::FilesystemWizard wizard; // automatic.
- auto cLoaderName = "SystemLauncher";
- NewOS::execute_from_image(NewOS::Detail::SystemLauncher_Main, cLoaderName);
+ NewOS::Detail::SystemLauncher_Main();
}
diff --git a/Kernel/Sources/ProcessScheduler.cxx b/Kernel/Sources/ProcessScheduler.cxx
index 7008eafe..d9d013c6 100644
--- a/Kernel/Sources/ProcessScheduler.cxx
+++ b/Kernel/Sources/ProcessScheduler.cxx
@@ -46,11 +46,6 @@ namespace NewOS
kcout.Number(kErrorProcessFault);
kcout << ")\r";
- if (this->Ring != kRingUserKind)
- {
- MUST_PASS(ke_bug_check());
- }
-
this->Exit(kErrorProcessFault);
}
@@ -167,24 +162,8 @@ namespace NewOS
ProcessScheduler::The().Leak().GetCurrent().Leak().ProcessId)
ke_stop(RUNTIME_CHECK_PROCESS);
- if (this->Ring == (Int32)ProcessSelector::kRingKernel &&
- ProcessScheduler::The().Leak().GetCurrent().Leak().Ring > 0)
- ke_stop(RUNTIME_CHECK_PROCESS);
-
kLastExitCode = exit_code;
- if (this->Ring != (Int32)ProcessSelector::kRingDriver)
- {
- if (this->HeapPtr)
- rt_free_heap(this->HeapPtr);
-
- this->HeapPtr = nullptr;
- this->HeapCursor = nullptr;
-
- this->FreeMemory = 0UL;
- this->UsedMemory = 0UL;
- }
-
//! Delete image if not done already.
if (this->Image)
ke_delete_ke_heap(this->Image);
@@ -352,7 +331,8 @@ namespace NewOS
auto& processRef = ProcessScheduler::The().Leak();
SizeT ret = processRef.Run();
- kcout << "newoskrnl: Iterated over: " << number(ret);
+ kcout << "newoskrnl: Iterated over: ";
+ kcout.Number(ret);
kcout << " processes.\r";
return true;