summaryrefslogtreecommitdiffhomepage
path: root/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp')
-rw-r--r--Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp86
1 files changed, 39 insertions, 47 deletions
diff --git a/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp b/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp
index 5f64cc20..657ab622 100644
--- a/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp
+++ b/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp
@@ -12,90 +12,82 @@
/// @param rsp
EXTERN_C void idt_handle_gpf(NewOS::UIntPtr rsp)
{
- MUST_PASS(NewOS::ProcessScheduler::The().Leak().GetCurrent());
-
- NewOS::kcout << "newoskrnl: Stack Pointer: "
- << NewOS::StringBuilder::FromInt("rsp{%}", rsp);
-
NewOS::kcout
<< "newoskrnl: General Protection Fault, caused by "
- << NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().GetName();
+ << NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().GetName();
- NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().Crash();
-}
-
-/// @brief Handle the scheduler interrupt, raised from the HPET timer.
-/// @param rsp
-EXTERN_C void idt_handle_scheduler(NewOS::UIntPtr rsp)
-{
- NewOS::kcout << NewOS::StringBuilder::FromInt("rsp{%}", rsp);
-
- NewOS::kcout
- << "newoskrnl: Will be scheduled back later "
- << NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().GetName()
- << NewOS::end_line();
-
- /// schedule another process.
- if (!NewOS::ProcessHelper::StartScheduling())
- {
- NewOS::kcout << "newoskrnl: Continue schedule this process...\r";
- }
+ NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().Crash();
}
/// @brief Handle page fault.
/// @param rsp
EXTERN_C void idt_handle_pf(NewOS::UIntPtr rsp)
{
- MUST_PASS(NewOS::ProcessScheduler::The().Leak().GetCurrent());
- NewOS::kcout << NewOS::StringBuilder::FromInt("rsp{%}", rsp);
-
NewOS::kcout
<< "newoskrnl: Segmentation Fault, caused by "
- << NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().GetName();
+ << NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().GetName();
- NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().Crash();
+ NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().Crash();
}
/// @brief Handle math fault.
/// @param rsp
EXTERN_C void idt_handle_math(NewOS::UIntPtr rsp)
{
- MUST_PASS(NewOS::ProcessScheduler::The().Leak().GetCurrent());
- NewOS::kcout << NewOS::StringBuilder::FromInt("rsp{%}", rsp);
-
NewOS::kcout
<< "newoskrnl: Math error, caused by "
- << NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().GetName();
+ << NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().GetName();
- NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().Crash();
+ NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().Crash();
}
/// @brief Handle any generic fault.
/// @param rsp
EXTERN_C void idt_handle_generic(NewOS::UIntPtr rsp)
{
- MUST_PASS(NewOS::ProcessScheduler::The().Leak().GetCurrent());
- NewOS::kcout << NewOS::StringBuilder::FromInt("sp{%}", rsp);
-
NewOS::kcout
<< "newoskrnl: Execution error, caused by "
- << NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().GetName();
+ << NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().GetName();
- NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().Crash();
+ NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().Crash();
}
/// @brief Handle #UD fault.
/// @param rsp
EXTERN_C void idt_handle_ud(NewOS::UIntPtr rsp)
{
- MUST_PASS(NewOS::ProcessScheduler::The().Leak().GetCurrent());
-
- NewOS::kcout << "newoskrnl: Stack Pointer: "
- << NewOS::StringBuilder::FromInt("rsp{%}", rsp);
-
NewOS::kcout
<< "newoskrnl: Invalid interrupt, caused by "
- << NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().GetName();
+ << NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().GetName();
+
+ NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().Crash();
+}
+
+/// @brief Enter syscall from assembly.
+/// @param stack the stack pushed from assembly routine.
+/// @return nothing.
+EXTERN_C NewOS::Void hal_system_call_enter(NewOS::UIntPtr rcx, NewOS::UIntPtr rdx)
+{
+ if (rcx <= (kSyscalls.Count() - 1))
+ {
+ NewOS::kcout << "newoskrnl: syscall: enter.\r";
+
+ if (kSyscalls[rcx].Leak().Leak()->fHooked)
+ (kSyscalls[rcx].Leak().Leak()->fProc)((NewOS::VoidPtr)rdx);
- NewOS::ProcessScheduler::The().Leak().GetCurrent().Leak().Crash();
+ NewOS::kcout << "newoskrnl: syscall: exit.\r";
+ }
+}
+
+/// @brief Enter kernel call from assembly (DDK only).
+/// @param stack the stack pushed from assembly routine.
+/// @return nothing.
+EXTERN_C NewOS::Void hal_kernel_call_enter(NewOS::UIntPtr rcx, NewOS::UIntPtr rdx, NewOS::UIntPtr r8, NewOS::UIntPtr r9)
+{
+ if (rcx != 0)
+ {
+ NewOS::kcout << "newoskrnl: kerncall: enter.\r";
+
+ NewOS::kcout << "newoskrnl: kerncall: exit.\r";
+ }
}