summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Private/KernelKit/Device.hpp18
-rw-r--r--Private/Source/Storage/ATA.cxx15
-rw-r--r--Private/Source/Storage/Storage.cxx1
-rw-r--r--Public/TODO_LIST.TXT3
4 files changed, 19 insertions, 18 deletions
diff --git a/Private/KernelKit/Device.hpp b/Private/KernelKit/Device.hpp
index 097af85a..9a689b26 100644
--- a/Private/KernelKit/Device.hpp
+++ b/Private/KernelKit/Device.hpp
@@ -81,15 +81,13 @@ class IOBuf final {
///! @brief Device types enum.
enum {
- kDeviceIde,
- kDeviceNetwork,
- kDevicePrinter,
- kDeviceGSDB,
- kDeviceScsi,
- kDeviceSata,
- kDeviceUsb,
- kDeviceCD,
- kDeviceSwap,
- kDeviceCnt,
+ kDeviceTypeIDE,
+ kDeviceTypeEthernet,
+ kDeviceTypeWiFi,
+ kDeviceTypeRS232,
+ kDeviceTypeSCSI,
+ kDeviceTypeSHCI,
+ kDeviceTypeUSB,
+ kDeviceTypeCount,
};
} // namespace HCore
diff --git a/Private/Source/Storage/ATA.cxx b/Private/Source/Storage/ATA.cxx
index 47c05ac8..6027e6f9 100644
--- a/Private/Source/Storage/ATA.cxx
+++ b/Private/Source/Storage/ATA.cxx
@@ -10,8 +10,10 @@
#include <ArchKit/ArchKit.hpp>
#include <StorageKit/ATA.hpp>
+#define kBufferLen 512
+
//! @brief ATA DMA Driver
-//! @todo: Rework into a proper ATA DMA.
+//! The idea is to let a driver do the transfer.
/// bugs 0
@@ -42,25 +44,24 @@ enum {
const char* ata_read_28(ULong lba) {
if (!kPrdt) return nullptr;
- static char buffer[512];
+ char* buffer = reinterpret_cast<char*>(Alloca(sizeof(char) * kBufferLen));
+ rt_set_memory(buffer, 0, kBufferLen);
- UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
+ UIntPtr* packet = reinterpret_cast<UIntPtr*>(kPrdt.Leak()->PhysicalAddress());
packet[0] = k28BitRead;
packet[1] = (UIntPtr)&buffer;
- packet[2] = lba;
+ packet[4] = lba;
rt_wait_for_io();
return buffer;
}
-#define kBufferLen 512
-
const char* ata_read_48(ULong lba) {
if (!kPrdt) return nullptr;
- static char buffer[kBufferLen];
+ char* buffer = reinterpret_cast<char*>(Alloca(sizeof(char) * kBufferLen));
rt_set_memory(buffer, 0, kBufferLen);
UIntPtr* packet = reinterpret_cast<UIntPtr*>(kPrdt.Leak()->PhysicalAddress());
diff --git a/Private/Source/Storage/Storage.cxx b/Private/Source/Storage/Storage.cxx
index 7d4ba70a..2fd5b29b 100644
--- a/Private/Source/Storage/Storage.cxx
+++ b/Private/Source/Storage/Storage.cxx
@@ -9,5 +9,6 @@
#include <StorageKit/Storage.hpp>
+///! @brief ATAPI SCSI packet.
const SKScsiPacket kCDRomPacketTemplate = {0x43, 0, 1, 0, 0, 0,
0, 12, 0x40, 0, 0};
diff --git a/Public/TODO_LIST.TXT b/Public/TODO_LIST.TXT
index b89c0659..18e20e4f 100644
--- a/Public/TODO_LIST.TXT
+++ b/Public/TODO_LIST.TXT
@@ -4,7 +4,8 @@
- We need a bootloader for AMD64/ARM [ X ]
- Implement Boot Services [ X ]
- Design Handover [ X ]
- - Load kernel into memory [ ]
+ - Load kernel into memory [ X ]
+ - Fix bug in kernel loader, which causes a 06 #UD.
- Jump to kernel [ ]
- Context switch x87/SSE/AVX registers [ ]
- Framebuffer and ATA support [ ]