summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-08-21 09:23:13 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-08-21 09:23:13 +0200
commit27fd1ba438eecbe184a5deda6d9f468509ec4f42 (patch)
tree1ef5c34198aee313b7f5e297a13d169c4f1bd6b1 /dev/kernel/HALKit/AMD64
parente5edad799f0f8dbe0b34baf55c30849c941a43f9 (diff)
feat: refactor and fixed python scripts.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit/AMD64')
-rw-r--r--dev/kernel/HALKit/AMD64/HalCoreInterruptHandler.cc3
-rw-r--r--dev/kernel/HALKit/AMD64/HalKernelMain.cc3
-rw-r--r--dev/kernel/HALKit/AMD64/Paging.h4
-rw-r--r--dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc9
-rw-r--r--dev/kernel/HALKit/AMD64/Storage/DMA+Generic.cc10
-rw-r--r--dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc13
6 files changed, 23 insertions, 19 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalCoreInterruptHandler.cc b/dev/kernel/HALKit/AMD64/HalCoreInterruptHandler.cc
index 0c2d0960..b837497e 100644
--- a/dev/kernel/HALKit/AMD64/HalCoreInterruptHandler.cc
+++ b/dev/kernel/HALKit/AMD64/HalCoreInterruptHandler.cc
@@ -61,7 +61,8 @@ EXTERN_C void idt_handle_scheduler(Kernel::UIntPtr rsp) {
hal_idt_send_eoi(32);
- while (kIsRunning);
+ while (kIsRunning)
+ ;
kIsRunning = YES;
diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
index c7a87b13..3c6e7d36 100644
--- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
@@ -168,6 +168,7 @@ EXTERN_C Kernel::Void hal_real_init(Kernel::Void) noexcept {
idt_loader.Load(idt_reg);
- while (YES);
+ while (YES)
+ ;
}
#endif // ifndef __NE_MODULAR_KERNEL_COMPONENTS__
diff --git a/dev/kernel/HALKit/AMD64/Paging.h b/dev/kernel/HALKit/AMD64/Paging.h
index cf297632..079acde4 100644
--- a/dev/kernel/HALKit/AMD64/Paging.h
+++ b/dev/kernel/HALKit/AMD64/Paging.h
@@ -57,9 +57,7 @@ namespace Detail {
PageEnable = 31,
};
- inline UInt8 control_register_cast(ControlRegisterBits reg) {
- return static_cast<UInt8>(reg);
- }
+ inline UInt8 control_register_cast(ControlRegisterBits reg) { return static_cast<UInt8>(reg); }
} // namespace Detail
auto mm_alloc_bitmap(Boolean wr, Boolean user, SizeT size, Bool is_page, SizeT pad = 0) -> VoidPtr;
diff --git a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
index 3363e809..77e3331d 100644
--- a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
+++ b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
@@ -294,7 +294,8 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz
goto ahci_io_end;
} else {
kout << "ahci: Disk still busy after command completion!\r";
- while (kSATAHba->Ports[kSATAIndex].Tfd & (kSATASRBsy | kSATASRDrq));
+ while (kSATAHba->Ports[kSATAIndex].Tfd & (kSATASRBsy | kSATASRDrq))
+ ;
}
ahci_io_end:
@@ -307,15 +308,13 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz
@brief Gets the number of sectors inside the drive.
@return Sector size in bytes.
*/
-STATIC ATTRIBUTE(unused)
-SizeT drv_get_sector_count_ahci() {
+STATIC ATTRIBUTE(unused) SizeT drv_get_sector_count_ahci() {
return kSATASectorCount;
}
/// @brief Get the drive size.
/// @return Disk size in bytes.
-STATIC ATTRIBUTE(unused)
-SizeT drv_get_size_ahci() {
+STATIC ATTRIBUTE(unused) SizeT drv_get_size_ahci() {
return drv_std_get_sector_count() * kAHCISectorSize;
}
diff --git a/dev/kernel/HALKit/AMD64/Storage/DMA+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/DMA+Generic.cc
index 4688203f..39efb7d3 100644
--- a/dev/kernel/HALKit/AMD64/Storage/DMA+Generic.cc
+++ b/dev/kernel/HALKit/AMD64/Storage/DMA+Generic.cc
@@ -105,7 +105,7 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + SectorSz - 1) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) &0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
@@ -123,7 +123,8 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz
rt_out8(kATADevice.Bar(0x20) + 0x00, 0x09); // Start DMA engine
- while (rt_in8(kATADevice.Bar(0x20) + ATA_REG_STATUS) & 0x01);
+ while (rt_in8(kATADevice.Bar(0x20) + ATA_REG_STATUS) & 0x01)
+ ;
rt_out8(kATADevice.Bar(0x20) + 0x00, 0x00); // Stop DMA engine
@@ -146,7 +147,7 @@ Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorS
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + (SectorSz - 1)) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) &0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
@@ -162,7 +163,8 @@ Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorS
rt_out8(IO + 0x00, 0x09); // Start DMA engine
- while (rt_in8(kATADevice.Bar(0x20) + ATA_REG_STATUS) & 0x01);
+ while (rt_in8(kATADevice.Bar(0x20) + ATA_REG_STATUS) & 0x01)
+ ;
rt_out8(kATADevice.Bar(0x20) + 0x00, 0x00); // Stop DMA engine
diff --git a/dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc
index 9c5b3931..6fccbdfa 100644
--- a/dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc
+++ b/dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc
@@ -83,7 +83,8 @@ ATAInit_Retry:
rt_out8(OutBus + ATA_REG_COMMAND, ATA_CMD_IDENTIFY);
- while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ));
+ while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ))
+ ;
/// fetch serial info
/// model, speed, number of sectors...
@@ -116,14 +117,15 @@ Void drv_pio_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT Sect
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + SectorSz) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) &0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
rt_out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
- while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ));
+ while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ))
+ ;
for (SizeT IndexOff = 0; IndexOff < Size; IndexOff += 2) {
drv_pio_std_wait_io(IO);
@@ -147,14 +149,15 @@ Void drv_pio_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT Sec
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + SectorSz) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) &0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
rt_out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);
- while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ));
+ while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ))
+ ;
for (SizeT IndexOff = 0; IndexOff < Size; IndexOff += 2) {
drv_pio_std_wait_io(IO);