summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/HALKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-01-07 07:39:26 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-01-07 07:40:47 +0100
commitecf2a09a48ef029d09075af744c04e643661ec27 (patch)
treeb492c7cbbe1fcdc1779e62ce56e4c06960328849 /dev/Kernel/HALKit
parent395148f821e118f587cf31b0d1c724f06e2398da (diff)
ADD: Moved system call handler in HalCommonAPI.asm (AMD64)
ADD: Replace make_container with make_app. ADD: Reference SwapDisk.h and TeamScheduler.h in unix_layer for future POSIX work too. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/HALKit')
-rw-r--r--dev/Kernel/HALKit/AMD64/HalCommonAPI.asm27
-rw-r--r--dev/Kernel/HALKit/AMD64/HalDescriptorLoader.cc8
-rw-r--r--dev/Kernel/HALKit/AMD64/HalInterruptAPI.asm28
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/ATA-PIO.cc16
4 files changed, 39 insertions, 40 deletions
diff --git a/dev/Kernel/HALKit/AMD64/HalCommonAPI.asm b/dev/Kernel/HALKit/AMD64/HalCommonAPI.asm
index 6339fa8d..dd3901e8 100644
--- a/dev/Kernel/HALKit/AMD64/HalCommonAPI.asm
+++ b/dev/Kernel/HALKit/AMD64/HalCommonAPI.asm
@@ -51,3 +51,30 @@ rt_in32:
mov rdx, rcx
in eax, dx
ret
+
+extern hal_system_call_enter
+global mp_system_call_handler
+
+mp_system_call_handler:
+
+ push r8
+ push r9
+ push r10
+ push r11
+ push r12
+ push r13
+ push r14
+ push r15
+
+ jmp hal_system_call_enter
+
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+
+ o64 sysret
diff --git a/dev/Kernel/HALKit/AMD64/HalDescriptorLoader.cc b/dev/Kernel/HALKit/AMD64/HalDescriptorLoader.cc
index 680aa6ed..2edbdc60 100644
--- a/dev/Kernel/HALKit/AMD64/HalDescriptorLoader.cc
+++ b/dev/Kernel/HALKit/AMD64/HalDescriptorLoader.cc
@@ -7,7 +7,7 @@
#include <ArchKit/ArchKit.h>
#include <HALKit/AMD64/Processor.h>
-#define kPITDefaultTicks (100U)
+#define kPITDefaultTicks (1000U)
namespace Kernel::HAL
{
@@ -26,11 +26,11 @@ namespace Kernel::HAL
// Configure PIT to receieve scheduler interrupts.
- UInt16 cCommDivisor = kPITFrequency / ticks; // 100 Hz.
+ UInt16 kPITCommDivisor = kPITFrequency / ticks; // 100 Hz.
HAL::rt_out8(kPITControlPort, 0x36); // Command to PIT
- HAL::rt_out8(kPITChannel0Port, cCommDivisor & 0xFF); // Send low byte
- HAL::rt_out8(kPITChannel0Port, (cCommDivisor >> 8) & 0xFF); // Send high byte
+ HAL::rt_out8(kPITChannel0Port, kPITCommDivisor & 0xFF); // Send low byte
+ HAL::rt_out8(kPITChannel0Port, (kPITCommDivisor >> 8) & 0xFF); // Send high byte
hal_clear_irq_mask(32);
}
diff --git a/dev/Kernel/HALKit/AMD64/HalInterruptAPI.asm b/dev/Kernel/HALKit/AMD64/HalInterruptAPI.asm
index 02031c4c..53654d08 100644
--- a/dev/Kernel/HALKit/AMD64/HalInterruptAPI.asm
+++ b/dev/Kernel/HALKit/AMD64/HalInterruptAPI.asm
@@ -369,34 +369,6 @@ hal_reload_segments:
ret
global hal_load_idt
-global hal_user_code_start
-
-extern hal_system_call_enter
-global mp_system_call_handler
-
-mp_system_call_handler:
-
- push r8
- push r9
- push r10
- push r11
- push r12
- push r13
- push r14
- push r15
-
- jmp hal_system_call_enter
-
- pop r15
- pop r14
- pop r13
- pop r12
- pop r11
- pop r10
- pop r9
- pop r8
-
- o64 sysret
hal_load_idt:
lidt [rcx]
diff --git a/dev/Kernel/HALKit/AMD64/Storage/ATA-PIO.cc b/dev/Kernel/HALKit/AMD64/Storage/ATA-PIO.cc
index 9fc261ef..1829a25a 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/ATA-PIO.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/ATA-PIO.cc
@@ -37,18 +37,18 @@ Boolean drv_std_wait_io(UInt16 IO)
rt_in8(IO + ATA_REG_STATUS);
ATAWaitForIO_Retry:
- auto statRdy = rt_in8(IO + ATA_REG_STATUS);
+ auto rdy = rt_in8(IO + ATA_REG_STATUS);
- if ((statRdy & ATA_SR_BSY))
+ if ((rdy & ATA_SR_BSY))
goto ATAWaitForIO_Retry;
ATAWaitForIO_Retry2:
- statRdy = rt_in8(IO + ATA_REG_STATUS);
+ rdy = rt_in8(IO + ATA_REG_STATUS);
- if (statRdy & ATA_SR_ERR)
+ if (rdy & ATA_SR_ERR)
return false;
- if (!(statRdy & ATA_SR_DRDY))
+ if (!(rdy & ATA_SR_DRDY))
goto ATAWaitForIO_Retry2;
return true;
@@ -74,16 +74,16 @@ ATAInit_Retry:
// identify until it's good
- auto statRdy = rt_in8(IO + ATA_REG_STATUS);
+ auto rdy = rt_in8(IO + ATA_REG_STATUS);
- if (statRdy & ATA_SR_ERR)
+ if (rdy & ATA_SR_ERR)
{
kcout << "ATA Error, aborting...\r";
return false;
}
- if ((statRdy & ATA_SR_BSY))
+ if ((rdy & ATA_SR_BSY))
{
kcout << "Retrying as controller is busy...\r";
goto ATAInit_Retry;