summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Private/Documentation/hCore::Ref.html (renamed from Private/html/hCore::Ref.html)0
-rw-r--r--Private/EFIKit/EFI.hxx136
-rw-r--r--Private/EFIKit/EPM.hxx8
-rw-r--r--Private/KernelKit/DriveManager.hpp4
-rw-r--r--Private/KernelKit/PCI/Dma.hpp95
-rw-r--r--Private/KernelKit/SharedObjectCore.hxx4
-rw-r--r--Private/NewBoot/CxxRuntime/manifest.json4
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx11
-rw-r--r--Private/NewBoot/Source/makefile1
-rw-r--r--Private/NewKit/Variant.hpp2
-rw-r--r--Private/Source/DriveManager.cxx76
-rw-r--r--Private/makefile5
-rw-r--r--Public/Documentation/hCore::CWindowLookAndFeel.html (renamed from Public/HTML/hCore::CWindowLookAndFeel.html)0
13 files changed, 209 insertions, 137 deletions
diff --git a/Private/html/hCore::Ref.html b/Private/Documentation/hCore::Ref.html
index 89c82dab..89c82dab 100644
--- a/Private/html/hCore::Ref.html
+++ b/Private/Documentation/hCore::Ref.html
diff --git a/Private/EFIKit/EFI.hxx b/Private/EFIKit/EFI.hxx
index fac59f8b..fd4e31aa 100644
--- a/Private/EFIKit/EFI.hxx
+++ b/Private/EFIKit/EFI.hxx
@@ -7,7 +7,8 @@
* ========================================================
*/
-#pragma once
+#ifndef __EFI__
+#define __EFI__
/**
@brief HCore Implementation of UEFI protocols.
@@ -17,12 +18,15 @@
using namespace hCore;
+typedef VoidPtr EfiHandlePtr;
+
struct EfiTableHeader;
struct EfiLoadFileProtocol;
struct EfiSimpleTextOutputProtocol;
struct EfiDevicePathProtocol;
+struct EfiBootServices;
-/// What's boot policy?
+/// What's BootBolicy?
/// If TRUE, indicates that the request originates from the boot manager, and that the boot manager is attempting to
/// load FilePath as a boot selection. If FALSE, then FilePath must match an exact file to be loaded.
@@ -113,64 +117,124 @@ typedef enum EfiMemoryType
EfiMaxMemoryType,
} EfiMemoryType;
-typedef UInt64 (*EfiAllocatePool)(EfiMemoryType PoolType, UInt32 Size, Void **Buffer);
-typedef UInt64 (*EfiFreePool)(Void *Buffer);
+typedef UInt64 (*EfiAllocatePool)(EfiMemoryType PoolType, UInt32 Size, VoidPtr *Buffer);
+typedef UInt64 (*EfiFreePool)(VoidPtr Buffer);
typedef struct EfiTableHeader
{
- UInt64 signature;
- UInt32 revision;
- UInt32 headerSize;
- UInt32 crc32;
- UInt32 reserved;
+ UInt64 Signature;
+ UInt32 Revision;
+ UInt32 HeaderSize;
+ UInt32 Crc32;
+ UInt32 Reserved;
} EfiTableHeader;
typedef struct EfiLoadFileProtocol
{
- EfiLoadFile loadFile;
+ EfiLoadFile LoadFile;
} EfiLoadFileProtocol;
typedef struct EfiDevicePathProtocol
{
- UInt8 type;
- UInt8 subType;
- UInt8 lenData[2];
+ UInt8 Type;
+ UInt8 SubType;
+ UInt8 LengthData[2];
} EfiDevicePathProtocol;
+typedef UInt64 (*EfiExitBootServices)(VoidPtr ImageHandle, UInt32 MapKey);
+
+/**
+@name EfiBootServices
+@brief UEFI Boot Services record, it contains functions necessary to a firmware level application.
+*/
+typedef struct EfiBootServices
+{
+ EfiTableHeader SystemTable;
+ UIntPtr RaiseTPL;
+ UIntPtr RestoreTPL;
+ UIntPtr AllocatePages;
+ UIntPtr FreePages;
+ UIntPtr GetMemoryMap;
+ EfiAllocatePool AllocatePool;
+ EfiFreePool FreePool;
+ UIntPtr CreateEvent;
+ UIntPtr SetTimer;
+ UIntPtr WaitForEvent;
+ UIntPtr SignalEvent;
+ UIntPtr CloseEvent;
+ UIntPtr CheckEvent;
+ UIntPtr InstallProtocolInterface;
+ UIntPtr ReinstallProtocolInterface;
+ UIntPtr UninstallProtocolInterface;
+ UIntPtr HandleProtocol;
+ VoidPtr Reserved;
+ UIntPtr RegisterProtocolNotify;
+ UIntPtr LocateHandle;
+ UIntPtr LocateDevicePath;
+ UIntPtr InstallConfigurationTable;
+ UIntPtr LoadImage;
+ UIntPtr StartImage;
+ UIntPtr Exit;
+ UIntPtr UnloadImage;
+ EfiExitBootServices ExitBootServices;
+ UIntPtr GetNextMonotonicCount;
+ UIntPtr Stall;
+ UIntPtr SetWatchdogTimer;
+ UIntPtr ConnectController;
+ UIntPtr DisconnectController;
+ UIntPtr OpenProtocol;
+ UIntPtr CloseProtocol;
+ UIntPtr OpenProtocolInformation;
+ UIntPtr ProtocolsPerHandle;
+ UIntPtr LocateHandleBuffer;
+ UIntPtr LocateProtocol;
+ UIntPtr InstallMultipleProtocolInterfaces;
+ UIntPtr UninstallMultipleProtocolInterfaces;
+ UIntPtr CalculateCrc32;
+ UIntPtr CopyMem;
+ UIntPtr SetMem;
+ UIntPtr CreateEventEx;
+} EfiBootServices;
+
#define kEntireDevPath 0xFF
#define kThisInstancePath 0x01
typedef struct EfiSimpleTextOutputProtocol
{
- UInt64 reset;
- EfiTextString outputString;
- UInt64 testString;
- UInt64 queryMode;
- UInt64 setMode;
- UInt64 setAttribute;
- UInt64 clearScreen;
- UInt64 setCursorPosition;
- UInt64 enableCursor;
- UInt64 mode;
+ UInt64 Reset;
+ EfiTextString OutputString;
+ UInt64 TestString;
+ UInt64 QueryMode;
+ UInt64 SetMode;
+ UInt64 SetAttribute;
+ UInt64 ClearScreen;
+ UInt64 SetCursorPosition;
+ UInt64 EnableCursor;
+ UInt64 Mode;
} EfiSimpleTextOutputProtocol;
typedef struct EfiSystemTable
{
- EfiTableHeader hdr;
- WideChar *firmwareVendor;
- UInt32 firmwareRevision;
- VoidPtr consoleInHandle;
- UInt64 conIn;
- VoidPtr consoleOutHandle;
- EfiSimpleTextOutputProtocol *conOut;
- VoidPtr standardErrorHandle;
- UInt64 stdErr;
- UInt64 runtimeServices;
- UInt64 bootServices;
- UInt64 numberOfTableEntries;
- UInt64 configurationTable;
+ EfiTableHeader SystemHeader;
+ WideChar *FirmwareVendor;
+ UInt32 FirmwareRevision;
+ VoidPtr ConsoleInHandle;
+ UInt64 ConIn;
+ VoidPtr ConsoleOutHandle;
+ EfiSimpleTextOutputProtocol *ConOut;
+ VoidPtr StandardErrorHandle;
+ UInt64 StdErr;
+ UInt64 RuntimeServices;
+ EfiBootServices *BootServices;
+ UInt64 NumberOfTableEntries;
+ UInt64 ConfigurationTable;
} EfiSystemTable;
#define EfiMain efi_main
#define kEfiOk 0
+#define kEfiFail -1
+
+#define EFI_EXTERN_C extern "C"
+
+#endif // __EFI__
diff --git a/Private/EFIKit/EPM.hxx b/Private/EFIKit/EPM.hxx
index 07de7d7c..4b88c4cd 100644
--- a/Private/EFIKit/EPM.hxx
+++ b/Private/EFIKit/EPM.hxx
@@ -10,7 +10,9 @@
#ifndef __PARTITION_MAP__
#define __PARTITION_MAP__
-inline constexpr int kUUIDLen = 37;
+inline consteval int kUUIDLen = 37;
+inline consteval int kNameLen = 32;
+inline consteval int kMagicLen = 4;
/* the first 512 > x > 1024 bytes of a disk contains this headers. */
@@ -20,8 +22,8 @@ inline constexpr int kUUIDLen = 37;
*/
struct __attribute__((packed)) BootBlock
{
- char magic[4];
- char name[32];
+ char magic[kMagicLen];
+ char name[kNameLen];
char uuid[kUUIDLen];
int version;
long long int num_blocks;
diff --git a/Private/KernelKit/DriveManager.hpp b/Private/KernelKit/DriveManager.hpp
index b5c0ad0c..3d77dd56 100644
--- a/Private/KernelKit/DriveManager.hpp
+++ b/Private/KernelKit/DriveManager.hpp
@@ -28,8 +28,8 @@ enum
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.
+ kEPMDrive = 0x11, // Explicit Partition Map.
+ kEPTDrive = 0x12, // ESP w/ EPM partition.
kMBRDrive = 0x13, // IBM PC classic partition scheme
};
diff --git a/Private/KernelKit/PCI/Dma.hpp b/Private/KernelKit/PCI/Dma.hpp
index 025192f0..87cd78cf 100644
--- a/Private/KernelKit/PCI/Dma.hpp
+++ b/Private/KernelKit/PCI/Dma.hpp
@@ -17,66 +17,65 @@
namespace hCore
{
- enum class DmaKind
- {
- PCI, // Bus mastering is required to be turned on. Basiaclly a request
- // control system. 64-Bit access depends on the PAE bit and the device
- // (if Double Address Cycle is available)
- ISA, // Four DMA channels 0-3; 8 bit transfers and only a megabyte of RAM.
- Invalid,
- };
-
- class DMAWrapper final
- {
- public:
- DMAWrapper() = delete;
-
- public:
- DMAWrapper(nullPtr) = delete;
- DMAWrapper(voidPtr Ptr, DmaKind Kind = DmaKind::PCI) : m_Address(Ptr), m_Kind(Kind) {}
+enum class DmaKind
+{
+ PCI, // Bus mastering is required to be turned on. Basiaclly a request
+ // control system. 64-Bit access depends on the PAE bit and the device
+ // (if Double Address Cycle is available)
+ ISA, // Four DMA channels 0-3; 8 bit transfers and only a megabyte of RAM.
+ Invalid,
+};
+
+class DMAWrapper final
+{
+ public:
+ explicit DMAWrapper() = delete;
- public:
- DMAWrapper &operator=(voidPtr Ptr);
+ public:
+ explicit DMAWrapper(nullPtr) = delete;
+ explicit DMAWrapper(voidPtr Ptr, DmaKind Kind = DmaKind::PCI) : m_Address(Ptr), m_Kind(Kind)
+ {
+ }
- public:
- DMAWrapper &operator=(const DMAWrapper &) = default;
- DMAWrapper(const DMAWrapper &) = default;
+ public:
+ DMAWrapper &operator=(voidPtr Ptr);
- public:
- ~DMAWrapper() = default;
+ public:
+ DMAWrapper &operator=(const DMAWrapper &) = default;
+ DMAWrapper(const DMAWrapper &) = default;
- template<class T>
- T *operator->();
+ public:
+ ~DMAWrapper() = default;
- template<class T>
- T *Get(const UIntPtr off = 0);
+ template <class T> T *operator->();
- public:
- operator bool();
- bool operator!();
+ template <class T> T *Get(const UIntPtr off = 0);
- public:
- bool Write(const UIntPtr &bit, const UIntPtr &offset);
- UIntPtr Read(const UIntPtr &offset);
- Boolean Check(UIntPtr offset) const;
+ public:
+ operator bool();
+ bool operator!();
- public:
- UIntPtr operator[](const UIntPtr &offset);
+ public:
+ bool Write(const UIntPtr &bit, const UIntPtr &offset);
+ UIntPtr Read(const UIntPtr &offset);
+ Boolean Check(UIntPtr offset) const;
- private:
- voidPtr m_Address{nullptr};
- DmaKind m_Kind{DmaKind::Invalid};
+ public:
+ UIntPtr operator[](const UIntPtr &offset);
- private:
- friend class DMAFactory;
- };
+ private:
+ voidPtr m_Address{nullptr};
+ DmaKind m_Kind{DmaKind::Invalid};
- class DMAFactory final
- {
- public:
- static OwnPtr<IOBuf<Char*>> Construct(OwnPtr <DMAWrapper> &dma);
+ private:
+ friend class DMAFactory;
+};
- };
+class DMAFactory final
+{
+ public:
+ static OwnPtr<IOBuf<Char *>> Construct(OwnPtr<DMAWrapper> &dma);
+};
} // namespace hCore
#include <KernelKit/PCI/Dma.inl>
diff --git a/Private/KernelKit/SharedObjectCore.hxx b/Private/KernelKit/SharedObjectCore.hxx
index 07b261d0..784e6e52 100644
--- a/Private/KernelKit/SharedObjectCore.hxx
+++ b/Private/KernelKit/SharedObjectCore.hxx
@@ -10,8 +10,8 @@
#ifndef __KERNELKIT_SHARED_OBJECT_CORE_HXX__
#define __KERNELKIT_SHARED_OBJECT_CORE_HXX__
-#include "CodeManager.hpp"
-#include "PEF.hpp"
+#include <KernelKit/CodeManager.hpp>
+#include <KernelKit/PEF.hpp>
#include <KernelKit/Loader.hpp>
#include <NewKit/Defines.hpp>
diff --git a/Private/NewBoot/CxxRuntime/manifest.json b/Private/NewBoot/CxxRuntime/manifest.json
index 42b5d166..e4afd692 100644
--- a/Private/NewBoot/CxxRuntime/manifest.json
+++ b/Private/NewBoot/CxxRuntime/manifest.json
@@ -1,3 +1,3 @@
{
- "pluginName": "C++Kit"
-} \ No newline at end of file
+ "pluginName": "MP-C++ Runtime for HCore."
+}
diff --git a/Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx b/Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx
index a6b80fc1..0102fa8c 100644
--- a/Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/EfiMain.cxx
@@ -11,14 +11,15 @@
#include <BootKit/Processor.hxx>
#include <BootKit/Protocol.hxx>
-extern "C" int EfiMain(void *ImageHandle, EfiSystemTable *SystemTable)
+EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle, EfiSystemTable *SystemTable)
{
- SystemTable->conOut->outputString(SystemTable->conOut, L"HCoreLdr: Starting HCore...\r\n");
+ SystemTable->ConOut->OutputString(SystemTable->ConOut, L"HCoreLdr: Starting \\EPM\\HCore...\r\n");
- while (true)
+ if (SystemTable->BootServices->ExitBootServices(ImageHandle, kBaseHandoverStruct) != kEfiOk)
{
- rt_cli();
- rt_halt();
+ SystemTable->ConOut->OutputString(SystemTable->ConOut, L"HCoreLdr: Could not Exit UEFI!\r\nHanging...\r\n");
+
+ return kEfiFail;
}
return kEfiOk;
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index b84f4425..6ccec377 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -1,5 +1,6 @@
##################################################
# ; (C) Mahrouss Logic, 2024, all rights reserved.
+# This is the bootloader makefile.
##################################################
CC_GNU=x86_64-w64-mingw32-g++
diff --git a/Private/NewKit/Variant.hpp b/Private/NewKit/Variant.hpp
index 4088d438..3493da01 100644
--- a/Private/NewKit/Variant.hpp
+++ b/Private/NewKit/Variant.hpp
@@ -25,7 +25,7 @@ namespace hCore
};
public:
- Variant() = delete;
+ explicit Variant() = delete;
public:
Variant &operator=(const Variant &) = default;
diff --git a/Private/Source/DriveManager.cxx b/Private/Source/DriveManager.cxx
index fa3deec1..be35e275 100644
--- a/Private/Source/DriveManager.cxx
+++ b/Private/Source/DriveManager.cxx
@@ -12,51 +12,51 @@
namespace hCore
{
- DriveSelector::DriveSelector() : fDrive(nullptr) {}
-
- DriveSelector::~DriveSelector()
- {
- if (fDrive)
- {
- this->Unmount();
- }
- }
-
- DriveTraits& DriveSelector::GetMounted()
+DriveSelector::DriveSelector() : fDrive(nullptr)
+{
+}
+
+DriveSelector::~DriveSelector()
+{
+ if (fDrive)
{
- MUST_PASS(fDrive != nullptr);
- return *fDrive;
+ this->Unmount();
}
-
- bool DriveSelector::Mount(DriveTraits* drive)
+}
+
+DriveTraits &DriveSelector::GetMounted()
+{
+ MUST_PASS(fDrive != nullptr);
+ return *fDrive;
+}
+
+bool DriveSelector::Mount(DriveTraits *drive)
+{
+ if (drive && drive->fReady() && fDrive == nullptr)
{
- if (drive &&
- drive->fReady() &&
- fDrive == nullptr)
- {
- fDrive = drive;
- fDrive->fMount();
-
- kcout << "[Mount] Mount drive: " << fDrive->fName << "\n";
-
- return true;
- }
-
- return false;
+ fDrive = drive;
+ fDrive->fMount();
+
+ kcout << "[Mount] drive: " << fDrive->fName << "\n";
+
+ return true;
}
- DriveTraits* DriveSelector::Unmount()
- {
- if (!fDrive)
- return nullptr;
+ return false;
+}
- auto drivePointer = fDrive;
+DriveTraits *DriveSelector::Unmount()
+{
+ if (!fDrive)
+ return nullptr;
- fDrive->fUnmount();
- fDrive = nullptr;
+ auto drivePointer = fDrive;
- kcout << "[Unmount] Mount drive: " << drivePointer->fName << "\n";
+ fDrive->fUnmount();
+ fDrive = nullptr;
- return drivePointer;
- }
+ kcout << "[Unmount] drive: " << drivePointer->fName << "\n";
+
+ return drivePointer;
+}
} // namespace hCore
diff --git a/Private/makefile b/Private/makefile
index 8acbd5c3..4c3b8f5b 100644
--- a/Private/makefile
+++ b/Private/makefile
@@ -1,3 +1,8 @@
+##################################################
+# ; (C) Mahrouss Logic, 2024, all rights reserved.
+# This is the microkernel makefile.
+##################################################
+
CC = x86_64-elf-gcc
LD = x86_64-elf-ld
CCFLAGS = -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__hCore__ -I../ -I./ -I$(HOME)/
diff --git a/Public/HTML/hCore::CWindowLookAndFeel.html b/Public/Documentation/hCore::CWindowLookAndFeel.html
index 36ff1dc6..36ff1dc6 100644
--- a/Public/HTML/hCore::CWindowLookAndFeel.html
+++ b/Public/Documentation/hCore::CWindowLookAndFeel.html