summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Private/HALKit/AMD64/HalInterruptHandlerAMD64.cxx34
-rw-r--r--Private/HALKit/AMD64/HalInterruptRouting.asm41
-rw-r--r--Private/NewKit/KernelCheck.hpp2
-rw-r--r--Private/Source/FileManager.cxx6
-rw-r--r--Private/Source/KernelCheck.cxx21
5 files changed, 61 insertions, 43 deletions
diff --git a/Private/HALKit/AMD64/HalInterruptHandlerAMD64.cxx b/Private/HALKit/AMD64/HalInterruptHandlerAMD64.cxx
deleted file mode 100644
index 5d5e61a5..00000000
--- a/Private/HALKit/AMD64/HalInterruptHandlerAMD64.cxx
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-//! @file InterruptHandler.cxx
-//! @brief x64 interrupt handler.
-
-#include <ArchKit/ArchKit.hpp>
-
-#define kInterruptId 0x21
-
-/// @brief Runtime interrupt handler
-/// @param sf The stack frame pushed by the isr.
-/// @return the stackframe pointer.
-EXTERN_C ATTRIBUTE(naked) HCore::UIntPtr rt_handle_interrupts(HCore::UIntPtr sf)
-{
- HCore::HAL::StackFramePtr stackPtr = reinterpret_cast<HCore::HAL::StackFramePtr>(sf);
- MUST_PASS(stackPtr);
-
- switch (stackPtr->IntNum)
- {
- case kInterruptId:
- {
- /* TODO: HcOpenDevice and such syscalls. */
- break;
- }
- default:
- break;
- }
-
- return sf;
-} \ No newline at end of file
diff --git a/Private/HALKit/AMD64/HalInterruptRouting.asm b/Private/HALKit/AMD64/HalInterruptRouting.asm
index a835d031..99bba00a 100644
--- a/Private/HALKit/AMD64/HalInterruptRouting.asm
+++ b/Private/HALKit/AMD64/HalInterruptRouting.asm
@@ -11,6 +11,8 @@
[bits 64]
+%define kInterruptId 0x21
+
%macro IntExp 1
global __HCR_INT_%1
__HCR_INT_%1:
@@ -30,11 +32,12 @@ __HCR_INT_%1:
; This file handles the core interrupt table
; Last edited 31/01/24
-extern rt_handle_interrupts
global _ke_power_on_self_test
global ke_handle_irq
global kInterruptVectorTable
+extern ke_io_print
+
section .text
IntNormal 0
@@ -68,10 +71,34 @@ IntNormal 27
IntNormal 28
IntNormal 29
IntExp 30
+
IntNormal 31
+IntNormal 32
+
+__HCR_INT_33:
+ cli
+
+ push rax
+
+ mov rcx, kSystemCallLabelEnter
+ call ke_io_print
+
+ pop rax
+
+ push rax
+
+ ;; Find and execute system call TODO
+
+ mov rcx, kSystemCallLabelExit
+ call ke_io_print
-%assign i 32
-%rep 224
+ pop rax
+
+ sti
+ iretq
+
+%assign i 34
+%rep 222
IntNormal i
%assign i i+1
%endrep
@@ -79,6 +106,7 @@ IntNormal 31
;; this one is doing a POST for us.
;; testing interrupts.
_ke_power_on_self_test:
+ mov rcx, 0
int 0x21
int 0x21
int 0x21
@@ -110,9 +138,16 @@ rt_load_idt:
sti
ret
+section .data
+
kInterruptVectorTable:
%assign i 0
%rep 256
dq __HCR_INT_%+i
%assign i i+1
%endrep
+
+kSystemCallLabelEnter:
+ db "HCoreKrnl.exe: SystemCall: Enter", 0xa, 0xd, 0
+kSystemCallLabelExit:
+ db "HCoreKrnl.exe: SystemCall: Exit", 0xa, 0xd, 0 \ No newline at end of file
diff --git a/Private/NewKit/KernelCheck.hpp b/Private/NewKit/KernelCheck.hpp
index 5eb81761..77dc558a 100644
--- a/Private/NewKit/KernelCheck.hpp
+++ b/Private/NewKit/KernelCheck.hpp
@@ -26,13 +26,13 @@ enum RUNTIME_CHECK {
RUNTIME_CHECK_FILE,
RUNTIME_CHECK_IPC,
RUNTIME_CHECK_TLS,
- RUNTIME_CHECK_LD,
RUNTIME_CHECK_HANDSHAKE,
RUNTIME_CHECK_ACPI,
RUNTIME_CHECK_INVALID_PRIVILEGE,
RUNTIME_CHECK_PROCESS,
RUNTIME_CHECK_BAD_BEHAVIOR,
RUNTIME_CHECK_BOOTSTRAP,
+ RUNTIME_CHECK_UNEXCPECTED,
RUNTIME_CHECK_COUNT,
};
diff --git a/Private/Source/FileManager.cxx b/Private/Source/FileManager.cxx
index addd5e02..0e5499d6 100644
--- a/Private/Source/FileManager.cxx
+++ b/Private/Source/FileManager.cxx
@@ -18,8 +18,8 @@ static IFilesystemManager* kMounted = nullptr;
/// @return The mounted filesystem.
IFilesystemManager* IFilesystemManager::GetMounted() { return kMounted; }
-/// @brief Unmount drive
-/// @return the unmounted drive.
+/// @brief Unmount filesystem.
+/// @return the unmounted filesystem.
IFilesystemManager* IFilesystemManager::Unmount() {
if (kMounted) {
auto mount = kMounted;
@@ -31,7 +31,7 @@ IFilesystemManager* IFilesystemManager::Unmount() {
return nullptr;
}
-/// @brief Mount filesystem
+/// @brief Mount filesystem.
/// @param pMount the filesystem to mount.
/// @return if it succeeded true, otherwise false.
bool IFilesystemManager::Mount(IFilesystemManager* pMount) {
diff --git a/Private/Source/KernelCheck.cxx b/Private/Source/KernelCheck.cxx
index ae8326a5..593190e1 100644
--- a/Private/Source/KernelCheck.cxx
+++ b/Private/Source/KernelCheck.cxx
@@ -27,35 +27,52 @@ void ke_stop(const HCore::Int &id) {
switch (id) {
case RUNTIME_CHECK_PROCESS: {
kcout << "*** CAUSE: RUNTIME_CHECK_PROCESS *** \r\n";
+ kcout << "*** WHAT: BAD DRIVER. *** \r\n";
break;
}
case RUNTIME_CHECK_ACPI: {
kcout << "*** CAUSE: RUNTIME_CHECK_ACPI *** \r\n";
+ kcout << "*** WHAT: ACPI DEFECT. *** \r\n";
break;
}
case RUNTIME_CHECK_POINTER: {
kcout << "*** CAUSE: RUNTIME_CHECK_POINTER *** \r\n";
+ kcout << "*** WHAT: BAD POINTER. *** \r\n";
break;
}
case RUNTIME_CHECK_BAD_BEHAVIOR: {
kcout << "*** CAUSE: RUNTIME_CHECK_BAD_BEHAVIOR *** \r\n";
+ kcout << "*** WHAT: KERNEL BECAME UNSTABLE. *** \r\n";
break;
}
case RUNTIME_CHECK_BOOTSTRAP: {
kcout << "*** CAUSE: RUNTIME_CHECK_BOOTSTRAP *** \r\n";
+ kcout << "*** WHAT: BAD BOOT. *** \r\n";
break;
}
case RUNTIME_CHECK_HANDSHAKE: {
kcout << "*** CAUSE: RUNTIME_CHECK_HANDSHAKE *** \r\n";
+ kcout << "*** WHAT: BAD HANDSHAKE. *** \r\n";
break;
}
- case RUNTIME_CHECK_LD: {
- kcout << "*** CAUSE: RUNTIME_CHECK_LD *** \r\n";
+ case RUNTIME_CHECK_IPC: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_IPC *** \r\n";
+ kcout << "*** WHAT: RICH CALL VIOLATION. *** \r\n";
break;
}
case RUNTIME_CHECK_INVALID_PRIVILEGE: {
kcout << "*** CAUSE: RUNTIME_CHECK_INVALID_PRIVILEGE *** \r\n";
+ kcout << "*** WHAT: RING-0 POLICY VIOLATION. *** \r\n";
break;
+ case RUNTIME_CHECK_UNEXCPECTED: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_UNEXCPECTED *** \r\n";
+ kcout << "*** WHAT: CATASROPHIC FAILURE! *** \r\n";
+ break;
+ }
+ default: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_GENERIC *** \r\n";
+ break;
+ }
}
};