summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-13 08:04:32 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-04-13 08:22:23 +0200
commitf30470c40229806a33c914ebdd1dbdf037c9698d (patch)
treef67922ba36b8a4847b0f1854f77da4466e64f7e6 /dev/kernel/HALKit
parent2d995049f660b7cee41d9e9bd2718fbcf76172e9 (diff)
dev, scheduler, ahci, dev: Refactor scheduler, and fix minor mistakes.
Add kDeviceTypeATA in DeviceMgr.h, making NeKernel aware that ATA devices can exist too. The scheduler now won't have to reimplement new classes, I refactor the names to signal that, and they're already generic enough to signal that. The AHCI-Generic driver got cleaned up of any irrelevant code, such as aligning the newly allocated pointer. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit')
-rw-r--r--dev/kernel/HALKit/AMD64/HalKernelMain.cc2
-rw-r--r--dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc2
-rw-r--r--dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc20
-rw-r--r--dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc2
4 files changed, 5 insertions, 21 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
index cc346b5c..cc3c8e93 100644
--- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
@@ -22,7 +22,7 @@ STATIC Kernel::Void hal_init_scheduler_team()
{
for (Kernel::SizeT i = 0U; i < Kernel::UserProcessScheduler::The().CurrentTeam().AsArray().Count(); ++i)
{
- Kernel::UserProcessScheduler::The().CurrentTeam().AsArray()[i] = Kernel::UserProcess();
+ Kernel::UserProcessScheduler::The().CurrentTeam().AsArray()[i] = Kernel::Process();
Kernel::UserProcessScheduler::The().CurrentTeam().AsArray()[i].Status = Kernel::ProcessStatusKind::kKilled;
}
}
diff --git a/dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc b/dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc
index dea3b3d4..ba5710e3 100644
--- a/dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc
+++ b/dev/kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc
@@ -14,7 +14,7 @@ namespace Kernel
/// @param
/***********************************************************************************/
- EXTERN_C Void __zka_pure_call(UserProcess* process)
+ EXTERN_C Void __zka_pure_call(Process* process)
{
if (process)
process->Crash();
diff --git a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
index f0893e2d..728b20ed 100644
--- a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
+++ b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
@@ -66,22 +66,6 @@ STATIC Int32 drv_find_cmd_slot_ahci(HbaPort* port) noexcept;
STATIC Void drv_compute_disk_ahci() noexcept;
-namespace AHCI::Detail
-{
- template <typename RetType>
- STATIC RetType* ahci_align_address(RetType* address, Int32 alignement)
- {
- if (!address)
- return nullptr;
-
- UIntPtr addr = (UIntPtr)address;
-
- UIntPtr aligned_addr = (addr + alignement - 1) & (~alignement - 1);
-
- return (RetType*)aligned_addr;
- }
-} // namespace AHCI::Detail
-
STATIC Void drv_compute_disk_ahci() noexcept
{
kSATASectorCount = 0UL;
@@ -90,18 +74,18 @@ STATIC Void drv_compute_disk_ahci() noexcept
const UInt16 kSzIdent = 512;
/// Push it to the stack
- UInt16* identify_data = AHCI::Detail::ahci_align_address<UInt16>(new UInt16[kSzIdent], kib_cast(1));
+ UInt16* identify_data = new UInt16[kSzIdent];
/// Send AHCI command for identification.
drv_std_input_output_ahci<NO, YES, YES>(0, (UInt8*)identify_data, kAHCISectorSize, kSzIdent);
/// Extract 48-bit LBA.
-
UInt64 lba48_sectors = 0;
lba48_sectors |= (UInt64)identify_data[100];
lba48_sectors |= (UInt64)identify_data[101] << 16;
lba48_sectors |= (UInt64)identify_data[102] << 32;
+ /// Now verify if lba48
if (lba48_sectors == 0)
kSATASectorCount = (identify_data[61] << 16) | identify_data[60];
else
diff --git a/dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc b/dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc
index 2f5c92e5..594ee76e 100644
--- a/dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc
+++ b/dev/kernel/HALKit/ARM64/HalSchedulerCorePrimitivesARM64.cc
@@ -14,7 +14,7 @@ namespace Kernel
/// @param void
/***********************************************************************************/
- EXTERN_C Void __zka_pure_call(UserProcess* process)
+ EXTERN_C Void __zka_pure_call(Process* process)
{
if (process)
process->Crash();