summaryrefslogtreecommitdiffhomepage
path: root/Private/KernelKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-28 11:04:21 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-28 11:04:21 +0100
commit93079836948ce3832f3690167e4aa9b9bb8795fc (patch)
tree334697452ba826b8656d7effc969f7b24c85883c /Private/KernelKit
parentc6c908167e37e0f82e272f6f9fd6462c0dd4502c (diff)
Kernel: refactoring stuff.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/KernelKit')
-rw-r--r--Private/KernelKit/CodeManager.hpp102
-rw-r--r--Private/KernelKit/Defines.hpp4
-rw-r--r--Private/KernelKit/DriveManager.hpp121
3 files changed, 113 insertions, 114 deletions
diff --git a/Private/KernelKit/CodeManager.hpp b/Private/KernelKit/CodeManager.hpp
index f470bb01..5aa35a5b 100644
--- a/Private/KernelKit/CodeManager.hpp
+++ b/Private/KernelKit/CodeManager.hpp
@@ -1,11 +1,11 @@
/*
-* ========================================================
-*
-* hCore
-* Copyright 2024 Mahrouss Logic, all rights reserved.
-*
-* ========================================================
-*/
+ * ========================================================
+ *
+ * hCore
+ * Copyright 2024 Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
#ifndef _INC_CODE_MANAGER_
#define _INC_CODE_MANAGER_
@@ -16,58 +16,58 @@
namespace hCore
{
- ///
- /// \name PEFLoader
- /// PEF container format implementation.
- ///
- class PEFLoader : public Loader
- {
- PEFLoader() = delete;
-
- public:
- explicit PEFLoader(const char* path);
- ~PEFLoader() override;
+///
+/// \name PEFLoader
+/// \brief PEF loader class.
+///
+class PEFLoader : public Loader
+{
+ private:
+ explicit PEFLoader() = delete;
- public:
- HCORE_COPY_DEFAULT(PEFLoader);
+ public:
+ explicit PEFLoader(const char *path);
+ ~PEFLoader() override;
- public:
- typedef void(*MainKind)(void);
+ public:
+ HCORE_COPY_DEFAULT(PEFLoader);
- public:
- const char* Path() override;
- const char* Format() override;
- const char* MIME() override;
+ public:
+ typedef void (*MainKind)(void);
- public:
- ErrorOr<VoidPtr> LoadStart() override;
- VoidPtr FindSymbol(const char* name, Int32 kind) override;
+ public:
+ const char *Path() override;
+ const char *Format() override;
+ const char *MIME() override;
- public:
- bool IsLoaded() noexcept;
+ public:
+ ErrorOr<VoidPtr> LoadStart() override;
+ VoidPtr FindSymbol(const char *name, Int32 kind) override;
- private:
- Ref<StringView> fPath;
- VoidPtr fCachedBlob;
- bool fBad;
+ public:
+ bool IsLoaded() noexcept;
- };
+ private:
+ Ref<StringView> fPath;
+ VoidPtr fCachedBlob;
+ bool fBad;
+};
- namespace Utils
- {
- /// \brief Much like Mac OS's UPP.
- /// This is read-only by design.
- /// It handles different kind of code.
- /// PowerPC <-> AMD64 for example.
- typedef struct UniversalProcedureTable final
- {
- const Char NAME[kPefNameLen];
- const VoidPtr TRAP;
- const SizeT ARCH;
- } __attribute__((packed)) UniversalProcedureTableType;
+namespace Utils
+{
+/// \brief Much like Mac OS's UPP.
+/// This is read-only by design.
+/// It handles different kind of code.
+/// PowerPC <-> AMD64 for example.
+typedef struct UniversalProcedureTable final
+{
+ const Char NAME[kPefNameLen];
+ const VoidPtr TRAP;
+ const SizeT ARCH;
+} __attribute__((packed)) UniversalProcedureTableType;
- bool execute_from_image(PEFLoader& exec) noexcept;
- }
-}
+bool execute_from_image(PEFLoader &exec) noexcept;
+} // namespace Utils
+} // namespace hCore
#endif // ifndef _INC_CODE_MANAGER_
diff --git a/Private/KernelKit/Defines.hpp b/Private/KernelKit/Defines.hpp
index 9e00cf00..d87d2b28 100644
--- a/Private/KernelKit/Defines.hpp
+++ b/Private/KernelKit/Defines.hpp
@@ -11,5 +11,5 @@
#include <NewKit/Defines.hpp>
-#define KERNELKIT_VERSION "1.0.0"
-#define KERNELKIT_RELEASE "Baldur" \ No newline at end of file
+#define KERNELKIT_VERSION "1.0.1"
+#define KERNELKIT_RELEASE "Cairo"
diff --git a/Private/KernelKit/DriveManager.hpp b/Private/KernelKit/DriveManager.hpp
index 9951c9cf..b5c0ad0c 100644
--- a/Private/KernelKit/DriveManager.hpp
+++ b/Private/KernelKit/DriveManager.hpp
@@ -20,68 +20,67 @@
namespace hCore
{
- enum
- {
- kInvalidDrive = -1,
- kBlockDevice = 0xAD,
- kMassStorage = 0xDA,
- kFloppyDisc = 0xCD,
- kOpticalDisc = 0xDC, // CD-ROM/DVD-ROM/Blu-Ray
- kReadOnly = 0x10, // Read only drive
- kXPMDrive = 0x11, // eXplicit Partition Map.
- kXPTDrive = 0x12, // GPT w/ XPM partition.
- kMBRDrive = 0x13, // IBM PC classic partition scheme
- };
-
- typedef Int64 DriveID;
-
- // Mounted drive.
- struct DriveTraits final
+enum
+{
+ kInvalidDrive = -1,
+ kBlockDevice = 0xAD,
+ kMassStorage = 0xDA,
+ kFloppyDisc = 0xCD,
+ kOpticalDisc = 0xDC, // CD-ROM/DVD-ROM/Blu-Ray
+ kReadOnly = 0x10, // Read only drive
+ kXPMDrive = 0x11, // eXplicit Partition Map.
+ kXPTDrive = 0x12, // GPT w/ XPM partition.
+ kMBRDrive = 0x13, // IBM PC classic partition scheme
+};
+
+typedef Int64 DriveID;
+
+// Mounted drive.
+struct DriveTraits final
+{
+ char fName[kDriveNameLen]; // /system, /boot...
+ Int32 fKind; // fMassStorage, fFloppy, fOpticalDisc.
+ DriveID fId; // Drive id.
+ Int32 fFlags; // fReadOnly, fXPMDrive, fXPTDrive
+
+ //! disk mount, unmount operations
+ void (*fMount)(void);
+ void (*fUnmount)(void);
+
+ bool (*fReady)(void); //! is drive ready?
+
+ //! for StorageKit.
+ struct DrivePacket final
{
- char fName[kDriveNameLen]; // /system, /boot...
- Int32 fKind; // fMassStorage, fFloppy, fOpticalDisc.
- DriveID fId; // Drive id.
- Int32 fFlags; // fReadOnly, fXPMDrive, fXPTDrive
-
- //! disk mount, unmount operations
- void(*fMount)(void);
- void(*fUnmount)(void);
-
- bool(*fReady)(void); //! is drive ready?
-
- //! for StorageKit.
- struct
- {
- voidPtr fPacketContent; // packet body.
- Char fPacketMime[32]; //! identify what we're sending.
- SizeT fPacketSize; // packet size
- } fPacket;
- };
+ voidPtr fPacketContent; // packet body.
+ Char fPacketMime[32]; //! identify what we're sending.
+ SizeT fPacketSize; // packet size
+ } fPacket;
+};
#define kPacketBinary "file/x-binary"
#define kPacketSource "file/x-source"
-#define kPacketASCII "file/x-ascii"
-#define kPacketZip "file/x-zip"
-
- //! drive as a device.
- typedef DeviceInterface<DriveTraits> Drive;
- typedef Drive* DrivePtr;
-
- class DriveSelector final
- {
- public:
- explicit DriveSelector();
- ~DriveSelector();
-
- public:
- HCORE_COPY_DEFAULT(DriveSelector);
-
- DriveTraits& GetMounted();
- bool Mount(DriveTraits* drive);
- DriveTraits* Unmount();
-
- private:
- DriveTraits* fDrive;
-
- };
-}
+#define kPacketASCII "file/x-ascii"
+#define kPacketZip "file/x-zip"
+
+//! drive as a device.
+typedef DeviceInterface<DriveTraits> Drive;
+typedef Drive *DrivePtr;
+
+class DriveSelector final
+{
+ public:
+ explicit DriveSelector();
+ ~DriveSelector();
+
+ public:
+ HCORE_COPY_DEFAULT(DriveSelector);
+
+ DriveTraits &GetMounted();
+ bool Mount(DriveTraits *drive);
+ DriveTraits *Unmount();
+
+ private:
+ DriveTraits *fDrive;
+};
+} // namespace hCore