summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKAKit/HALKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-11-21 08:50:57 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-11-21 08:51:40 +0100
commit6ed8a39c1bd3083297b41e981a2bf4bdbe2abd1f (patch)
tree183713eb331a92e4e1ce061263cf91a208c7c400 /dev/ZKAKit/HALKit
parent50439432a85976605dbb18e3cd2161f888d2e17d (diff)
IMP: Add UserProcessImage structure to hold the code/entrypoint of the process.
IMP: Use IDLLObject instead of IPEFDLLObject. IMP: Refactor DeviceInterface to IDeviceObject. ADD: rt_jump_to_address when you want to use a custom stack. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/HALKit')
-rw-r--r--dev/ZKAKit/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc2
-rw-r--r--dev/ZKAKit/HALKit/AMD64/HalKernelMain.cc11
-rw-r--r--dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc15
3 files changed, 9 insertions, 19 deletions
diff --git a/dev/ZKAKit/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc b/dev/ZKAKit/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
index 149f2391..71e6f037 100644
--- a/dev/ZKAKit/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
+++ b/dev/ZKAKit/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc
@@ -174,6 +174,6 @@ EXTERN_C Kernel::Void hal_kernel_call_enter(Kernel::UIntPtr rcx_kerncall_index,
kcout << "kerncall: Kernel call isn't hooked at all! (is set to false)\r";
}
- kcout << "kerncall: Exit Kernel Calls.\r";
+ kcout << "kerncall: Exit Kernel Call List.\r";
}
}
diff --git a/dev/ZKAKit/HALKit/AMD64/HalKernelMain.cc b/dev/ZKAKit/HALKit/AMD64/HalKernelMain.cc
index 9ceefbc2..79dbf4ad 100644
--- a/dev/ZKAKit/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/ZKAKit/HALKit/AMD64/HalKernelMain.cc
@@ -83,17 +83,6 @@ EXTERN_C Kernel::Void hal_real_init(Kernel::Void) noexcept
{
/* Initialize filesystem. */
Kernel::NeFileSystemMgr::Mount(new Kernel::NeFileSystemMgr());
- Kernel::UserProcessHelper::InitScheduler();
-
- const Kernel::Char process_name[] = "Kernel";
-
- Kernel::rtl_create_process([]() -> void {
- while (Yes)
- {
- kcout << "Scheduling...\r";
- }
- },
- process_name);
/* Load interrupts and start SMP. */
diff --git a/dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc b/dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc
index 06ba1c6f..4341da04 100644
--- a/dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc
+++ b/dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc
@@ -23,8 +23,9 @@
#ifdef __AHCI__
-#define kAhciCmdTblBase mib_cast(1) // 4M
+#define AHCI_START_ADDRESS mib_cast(4) // 4M
+#define HBA_ERR_TFE (1 << 30)
#define HBA_PxCMD_ST 0x0001
#define HBA_PxCMD_FRE 0x0010
#define HBA_PxCMD_FR 0x4000
@@ -52,7 +53,7 @@ STATIC Kernel::Lba kCurrentDiskSectorCount = 0UL;
Kernel::Void drv_calculate_disk_geometry()
{
kCurrentDiskSectorCount = 0UL;
- kcout << "Max LBA: " << Kernel::number(kCurrentDiskSectorCount) << endl;
+ kcout << "Highest AHCI LBA (48-bit): " << Kernel::number(kCurrentDiskSectorCount) << endl;
}
/// @brief Initializes an AHCI disk.
@@ -124,13 +125,13 @@ Kernel::Boolean drv_std_init(Kernel::UInt16& PortsImplemented)
// do in-between
- kAhciPort->Clb = kAhciCmdTblBase + (ahci_index << 10);
+ kAhciPort->Clb = AHCI_START_ADDRESS + (ahci_index << 10);
kAhciPort->Clbu = 0;
rt_set_memory((void*)(kAhciPort->Clb), 0, 1024);
// FIS offset: 32K+256*ahci_index
// FIS entry size = 256 bytes per port
- kAhciPort->Fb = kAhciCmdTblBase + (32 << 10) + (ahci_index << 8);
+ kAhciPort->Fb = AHCI_START_ADDRESS + (32 << 10) + (ahci_index << 8);
kAhciPort->Fbu = 0;
rt_set_memory((void*)(kAhciPort->Fb), 0, 256);
@@ -143,7 +144,7 @@ Kernel::Boolean drv_std_init(Kernel::UInt16& PortsImplemented)
cmdheader[i].Prdtl = 8; // 8 prdt entries per command table
// 256 bytes per command table, 64+16+48+16*8
// Command table offset: 40K + 8K*ahci_index + cmdheader_index*256
- cmdheader[i].Ctba = kAhciCmdTblBase + (40 << 10) + (ahci_index << 13) + (i << 8);
+ cmdheader[i].Ctba = AHCI_START_ADDRESS + (40 << 10) + (ahci_index << 13) + (i << 8);
cmdheader[i].Ctbau = 0;
rt_set_memory((void*)cmdheader[i].Ctba, 0, 256);
@@ -268,7 +269,7 @@ Kernel::Void drv_std_read(Kernel::UInt64 lba, Kernel::Char* buffer, Kernel::Size
// in the PxIS port field as well (1 << 5)
if ((kAhciPort->Ci & (1 << port)) == 0)
break;
- if (kAhciPort->Is & (1 << 30)) // Task file error
+ if (kAhciPort->Is & HBA_ERR_TFE) // Task file error
{
kcout << ("Read disk error\r");
return;
@@ -276,7 +277,7 @@ Kernel::Void drv_std_read(Kernel::UInt64 lba, Kernel::Char* buffer, Kernel::Size
}
// Check again for the last time.
- if (kAhciPort->Is & (1 << 30)) // task file error status
+ if (kAhciPort->Is & HBA_ERR_TFE) // task file error status
{
kcout << ("Read disk error\r");
*buffer = 0;