summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-18 15:15:52 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-18 15:15:52 +0200
commit0266d8058990a496b935abd76417abcfe4e9cffd (patch)
treedb4ffa8b49575ff2f81b98d3dfc078d87a4eb2f5 /dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
parent163f32fbfbfa2fb0744787769fb3d4865f57d8dd (diff)
dev(sched): Improvements and work in progress fixes.
what? - The main algorithm got improved for real time tasks, and SMP usage. - The SMP usage was present before, I just reintroduced it after realizing that it won't scale well from what I have right now. - Also removed weird implementations quirks from previous sketch. - Such as the core 0 being reserved for the boot core. - Also moved FS init code after IDT initalization. - To avoid weird FS format behavior. - Wrap HPET signature in a macro. next? - Work on the HAL's userspace transition mechanism. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc')
-rw-r--r--dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc30
1 files changed, 26 insertions, 4 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc b/dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
index 7e2b8957..eac6c389 100644
--- a/dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
+++ b/dev/kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
@@ -37,6 +37,9 @@ EXTERN_C Kernel::Void idt_handle_gpf(Kernel::UIntPtr rsp) {
auto& process = Kernel::UserProcessScheduler::The().TheCurrentProcess();
+ if (!process) {
+ ke_panic(RUNTIME_CHECK_BAD_BEHAVIOR, "General Access Fault.");
+ }
if (process.Leak().Signal.SignalID == SIGKILL || process.Leak().Signal.SignalID == SIGABRT ||
process.Leak().Signal.SignalID == SIGTRAP) {
dbg_break_point();
@@ -62,6 +65,10 @@ EXTERN_C void idt_handle_pf(Kernel::UIntPtr rsp) {
auto& process = Kernel::UserProcessScheduler::The().TheCurrentProcess();
+ if (!process) {
+ ke_panic(RUNTIME_CHECK_BAD_BEHAVIOR, "Access Fault.");
+ }
+
if (process.Leak().Signal.SignalID == SIGKILL || process.Leak().Signal.SignalID == SIGABRT ||
process.Leak().Signal.SignalID == SIGTRAP) {
dbg_break_point();
@@ -101,6 +108,9 @@ EXTERN_C void idt_handle_math(Kernel::UIntPtr rsp) {
auto& process = Kernel::UserProcessScheduler::The().TheCurrentProcess();
+ if (!process) {
+ ke_panic(RUNTIME_CHECK_BAD_BEHAVIOR, "Math Fault.");
+ }
if (process.Leak().Signal.SignalID == SIGKILL || process.Leak().Signal.SignalID == SIGABRT ||
process.Leak().Signal.SignalID == SIGTRAP) {
dbg_break_point();
@@ -126,6 +136,10 @@ EXTERN_C void idt_handle_generic(Kernel::UIntPtr rsp) {
auto& process = Kernel::UserProcessScheduler::The().TheCurrentProcess();
+ if (!process) {
+ ke_panic(RUNTIME_CHECK_BAD_BEHAVIOR, "Generic Fault.");
+ }
+
if (process.Leak().Signal.SignalID == SIGKILL || process.Leak().Signal.SignalID == SIGABRT ||
process.Leak().Signal.SignalID == SIGTRAP) {
dbg_break_point();
@@ -146,10 +160,15 @@ EXTERN_C void idt_handle_generic(Kernel::UIntPtr rsp) {
}
EXTERN_C Kernel::Void idt_handle_breakpoint(Kernel::UIntPtr rip) {
- hal_idt_send_eoi(3);
-
auto& process = Kernel::UserProcessScheduler::The().TheCurrentProcess();
+ if (!process) {
+ while (YES)
+ ;
+ }
+
+ hal_idt_send_eoi(3);
+
if (process.Leak().Signal.SignalID == SIGKILL || process.Leak().Signal.SignalID == SIGABRT ||
process.Leak().Signal.SignalID == SIGTRAP) {
dbg_break_point();
@@ -167,8 +186,6 @@ EXTERN_C Kernel::Void idt_handle_breakpoint(Kernel::UIntPtr rip) {
Kernel::kout << "Kernel: SIGTRAP status.\r";
process.Leak().Status = Kernel::ProcessStatusKind::kFrozen;
-
- idt_handle_scheduler(rip);
}
/// @brief Handle #UD fault.
@@ -180,6 +197,11 @@ EXTERN_C void idt_handle_ud(Kernel::UIntPtr rsp) {
auto& process = Kernel::UserProcessScheduler::The().TheCurrentProcess();
+ if (!process) {
+ while (YES)
+ ;
+ }
+
if (process.Leak().Signal.SignalID == SIGKILL || process.Leak().Signal.SignalID == SIGABRT ||
process.Leak().Signal.SignalID == SIGTRAP) {
dbg_break_point();