summaryrefslogtreecommitdiffhomepage
path: root/Private/KernelKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-03 09:20:28 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-03 09:20:28 +0200
commit3facc32b746a44b0e3a91cbe1897127194396d1b (patch)
tree0725ebbf35a18e6933596ea5c765ac81adf7834f /Private/KernelKit
parentefc6b5d169d2b6eaabe7384141cec6054ae622a0 (diff)
MHR-3: See main changes below.
Kernel: Improve Disk interfaces regarding the struct they're using (all of them are using MountpountInterface now) SystemLib: Start adding PowerPC code to the SystemLib to be cross compiled as a PEF FAT binary. Kernel: Adding new builtins to support a wide range of hardware. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/KernelKit')
-rw-r--r--Private/KernelKit/DeviceManager.hpp8
-rw-r--r--Private/KernelKit/DriveManager.hxx28
2 files changed, 21 insertions, 15 deletions
diff --git a/Private/KernelKit/DeviceManager.hpp b/Private/KernelKit/DeviceManager.hpp
index 10d23604..0935c5b3 100644
--- a/Private/KernelKit/DeviceManager.hpp
+++ b/Private/KernelKit/DeviceManager.hpp
@@ -21,8 +21,10 @@
#include <NewKit/ErrorOr.hpp>
#include <NewKit/Ref.hpp>
+#define kDriveManagerCount 4U
+
// Last Rev
-// Sat Feb 24 CET 2024
+// Wed, Apr 3, 2024 9:09:41 AM
namespace NewOS {
template <typename T>
@@ -41,12 +43,12 @@ class DeviceInterface {
DeviceInterface(const DeviceInterface<T> &) = default;
public:
- DeviceInterface<T> &operator<<(T Data) {
+ virtual DeviceInterface<T> &operator<<(T Data) {
m_Out(Data);
return *this;
}
- DeviceInterface<T> &operator>>(T Data) {
+ virtual DeviceInterface<T> &operator>>(T Data) {
m_In(Data);
return *this;
}
diff --git a/Private/KernelKit/DriveManager.hxx b/Private/KernelKit/DriveManager.hxx
index d82c302b..d3d14f9a 100644
--- a/Private/KernelKit/DriveManager.hxx
+++ b/Private/KernelKit/DriveManager.hxx
@@ -54,11 +54,11 @@ struct DriveTrait final {
Void (*fInput)(DrivePacket* packetPtr);
Void (*fOutput)(DrivePacket* packetPtr);
Void (*fVerify)(DrivePacket* packetPtr);
+ const Char* (*fDriveKind)(Void);
};
-//! drive as a device.
-typedef DeviceInterface<DriveTrait> DriveDevice;
-typedef DriveDevice* DriveDevicePtr;
+///! drive as a device.
+typedef DriveTrait* DriveTraitPtr;
/**
* @brief Mounted drives interface.
@@ -73,12 +73,12 @@ class MountpointInterface final {
HCORE_COPY_DEFAULT(MountpointInterface);
public:
- DriveDevicePtr A() { return mA; }
- DriveDevicePtr B() { return mB; }
- DriveDevicePtr C() { return mC; }
- DriveDevicePtr D() { return mD; }
+ DriveTraitPtr A() { return mA; }
+ DriveTraitPtr B() { return mB; }
+ DriveTraitPtr C() { return mC; }
+ DriveTraitPtr D() { return mD; }
- DriveDevicePtr* GetAddressOf(Int32 index) {
+ DriveTraitPtr* GetAddressOf(Int32 index) {
DbgLastError() = kErrorSuccess;
switch (index) {
@@ -102,22 +102,26 @@ class MountpointInterface final {
}
private:
- DriveDevicePtr mA, mB, mC, mD = nullptr;
+ DriveTraitPtr mA, mB, mC, mD = nullptr;
};
-
/// @brief Unimplemented drive.
/// @param pckt
/// @return
Void ke_drv_unimplemented(DriveTrait::DrivePacket* pckt);
+/// @brief Gets the drive kind (ATA, SCSI, AHCI...)
+/// @param
+/// @return
+const Char* ke_drive_kind(Void);
+
/// @brief Makes a new drive.
/// @return the new drive.
-DriveTrait construct_drive() noexcept;
+DriveTrait construct_drive(void) noexcept;
/// @brief Fetches the main drive.
/// @return the new drive.
-DriveTrait main_drive() noexcept;
+DriveTrait main_drive(void) noexcept;
} // namespace NewOS
#endif /* ifndef __DRIVE_MANAGER__ */