summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit
diff options
context:
space:
mode:
Diffstat (limited to 'dev/kernel/HALKit')
-rw-r--r--dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc26
-rw-r--r--dev/kernel/HALKit/AMD64/HalCoreSystemCalls.cc4
-rw-r--r--dev/kernel/HALKit/AMD64/HalInterruptAPI.asm2
-rw-r--r--dev/kernel/HALKit/AMD64/HalKernelMain.cc28
4 files changed, 25 insertions, 35 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc b/dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
index 84c35615..c72a109a 100644
--- a/dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
+++ b/dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
@@ -16,7 +16,9 @@ STATIC BOOL kIsScheduling = NO;
EXTERN_C void idt_handle_gpf(Kernel::UIntPtr rsp) {
auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
- if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) return;
+ if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) {
+ MUST_PASS(NO);
+ }
kIsScheduling = NO;
@@ -38,7 +40,9 @@ EXTERN_C void idt_handle_gpf(Kernel::UIntPtr rsp) {
EXTERN_C void idt_handle_pf(Kernel::UIntPtr rsp) {
auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
- if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) return;
+ if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) {
+ MUST_PASS(NO);
+ }
kIsScheduling = NO;
@@ -83,7 +87,9 @@ EXTERN_C void idt_handle_scheduler(Kernel::UIntPtr rsp) {
EXTERN_C void idt_handle_math(Kernel::UIntPtr rsp) {
auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
- if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) return;
+ if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) {
+ MUST_PASS(NO);
+ }
kIsScheduling = NO;
@@ -105,7 +111,9 @@ EXTERN_C void idt_handle_math(Kernel::UIntPtr rsp) {
EXTERN_C void idt_handle_generic(Kernel::UIntPtr rsp) {
auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
- if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) return;
+ if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) {
+ MUST_PASS(NO);
+ }
kIsScheduling = NO;
@@ -126,10 +134,12 @@ EXTERN_C Kernel::Void idt_handle_breakpoint(Kernel::UIntPtr rip) {
auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) {
+ (Void)(Kernel::kout << "Kernel: Kernel RIP: " << Kernel::hex_number(rip) << Kernel::kendl);
Kernel::kout << "Kernel: SIGTRAP\r";
- while (YES)
- ;
+ kIsScheduling = NO;
+
+ while (YES);
}
kIsScheduling = NO;
@@ -152,7 +162,9 @@ EXTERN_C Kernel::Void idt_handle_breakpoint(Kernel::UIntPtr rip) {
EXTERN_C void idt_handle_ud(Kernel::UIntPtr rsp) {
auto process = Kernel::UserProcessScheduler::The().CurrentProcess();
- if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) return;
+ if (process.Leak().Status != Kernel::ProcessStatusKind::kRunning) {
+ MUST_PASS(NO);
+ }
kIsScheduling = NO;
diff --git a/dev/kernel/HALKit/AMD64/HalCoreSystemCalls.cc b/dev/kernel/HALKit/AMD64/HalCoreSystemCalls.cc
index 8581950f..11e773a8 100644
--- a/dev/kernel/HALKit/AMD64/HalCoreSystemCalls.cc
+++ b/dev/kernel/HALKit/AMD64/HalCoreSystemCalls.cc
@@ -3,3 +3,7 @@
Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
+
+#include <ArchKit/ArchKit.h>
+
+using namespace Kernel;
diff --git a/dev/kernel/HALKit/AMD64/HalInterruptAPI.asm b/dev/kernel/HALKit/AMD64/HalInterruptAPI.asm
index cc34b99f..cf2870c8 100644
--- a/dev/kernel/HALKit/AMD64/HalInterruptAPI.asm
+++ b/dev/kernel/HALKit/AMD64/HalInterruptAPI.asm
@@ -98,7 +98,7 @@ __NE_INT_3:
out 0x20, al
push rcx
- call idt_handle_generic
+ call idt_handle_breakpoint
pop rcx
std
diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
index 2747439a..70b07193 100644
--- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
@@ -126,32 +126,6 @@ EXTERN_C Kernel::Void hal_real_init(Kernel::Void) noexcept {
idt_loader.Load(idt_reg);
- /// after the scheduler runs, we must look over teams, every 5000s in order to schedule every
- /// process according to their affinity fairly.
-
- auto constexpr kSchedTeamSwitchMS = 5U; /// @brief Team switch time in milliseconds.
-
- Kernel::HardwareTimer timer(rtl_milliseconds(kSchedTeamSwitchMS));
-
- STATIC Kernel::Array<UserProcessTeam, kSchedTeamCount> kTeams;
-
- static SizeT team_index = 0U;
-
- /// @brief This just loops over the teams and switches between them.
- /// @details Not even round-robin, just a simple loop in this boot core we're at.
- while (YES) {
- if (team_index > (kSchedTeamCount - 1)) {
- team_index = 0U;
- }
-
- kTeams[team_index].Id() = team_index;
-
- while (!UserProcessScheduler::The().SwitchTeam(kTeams[team_index]))
- ;
-
- timer.Wait();
-
- ++team_index;
- }
+ dbg_break_point();
}
#endif // ifndef __NE_MODULAR_KERNEL_COMPONENTS__