summaryrefslogtreecommitdiffhomepage
path: root/Private/HALKit
diff options
context:
space:
mode:
Diffstat (limited to 'Private/HALKit')
-rw-r--r--Private/HALKit/AMD64/HalInterruptHandlerAMD64.cxx34
-rw-r--r--Private/HALKit/AMD64/HalInterruptRouting.asm41
2 files changed, 38 insertions, 37 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