summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/Storage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-29 22:38:43 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-29 22:38:43 +0100
commita8c17ccd6d97cc78830917dc6282b040b21ba16c (patch)
tree2181e96ccf9c89c677d2208661bce5584a667470 /Private/Source/Storage
parent78861f1b16f18a85e9f6890e16eb320412b6ab80 (diff)
Kernel: Update SPECS and TODO list.
Cleaned up the SPECS to get into the point. Current Task: Load kernel into memory. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/Storage')
-rw-r--r--Private/Source/Storage/ATA.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/Private/Source/Storage/ATA.cxx b/Private/Source/Storage/ATA.cxx
index f960907b..ed62df4f 100644
--- a/Private/Source/Storage/ATA.cxx
+++ b/Private/Source/Storage/ATA.cxx
@@ -10,8 +10,12 @@
#include <ArchKit/Arch.hpp>
#include <StorageKit/ATA.hpp>
-//! @brief Driver for ATA, listens to a specific address for data to come.
-//! mapped by NewFirmware.
+#include "NewKit/Utils.hpp"
+
+//! @brief ATA DMA Driver
+//! mapped by UEFI.
+
+/// bugs 0
#define kATAError 2
@@ -51,10 +55,13 @@ const char* ata_read_28(ULong lba) {
return buffer;
}
+#define kBufferLen 512
+
const char* ata_read_48(ULong lba) {
- static char buffer[512];
+ static char buffer[kBufferLen];
+ rt_set_memory(buffer, 0, kBufferLen);
- UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
+ UIntPtr* packet = reinterpret_cast<UIntPtr*>(kPrdt.Leak()->PhysicalAddress());
packet[0] = k48BitRead;
packet[1] = (UIntPtr)&buffer;
@@ -65,11 +72,11 @@ const char* ata_read_48(ULong lba) {
return buffer;
}
-Int32 ata_write_48(ULong lba, const char* text) {
- UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
+Int32 ata_write_48(ULong lba, const char* buffer) {
+ UIntPtr* packet = reinterpret_cast<UIntPtr*>(kPrdt.Leak()->PhysicalAddress());
packet[0] = k48BitWrite;
- packet[1] = (UIntPtr)&text;
+ packet[1] = (UIntPtr)&buffer;
packet[2] = lba;
rt_wait_for_io();