summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-09 20:31:40 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-09 20:34:16 +0100
commitaf212d19d0b2f0fad608c78ca922d3db9cb326bd (patch)
tree5a21ba40baa50909331db7a67f112cc9969e750e
parentd9556c811b25a7c5533d1f61152ecb8863cfd042 (diff)
Kernel: See below.
- Rework some bootloader modules, will work on some. - Rework GKit to look like the DOM on a browser. Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
-rw-r--r--.gitignore2
-rw-r--r--Private/NewBoot/NetBoot/EfiModule.cxx (renamed from Private/NewBoot/NetBoot/module.cxx)8
-rw-r--r--Private/NewBoot/NetBoot/manifest.json6
-rw-r--r--Private/NewBoot/Source/CDROM/MAHROUSS/.keep0
-rw-r--r--Private/Source/PermissionSelector.cxx2
-rw-r--r--Private/StorageKit/ATA.hpp165
-rw-r--r--Private/StorageKit/NVME.hpp50
-rw-r--r--Private/StorageKit/PRDT.hpp2
-rw-r--r--Public/Kits/GKit/Core.hpp57
-rw-r--r--Public/Kits/GKit/Makefile2
10 files changed, 158 insertions, 136 deletions
diff --git a/.gitignore b/.gitignore
index ba873061..3102b158 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,8 +8,6 @@ build.ninja
cmake_install.cmake
qtcsettings.cmake
-MAHROUSS/
-
x86_64/
*.epm
diff --git a/Private/NewBoot/NetBoot/module.cxx b/Private/NewBoot/NetBoot/EfiModule.cxx
index b7e4727f..a0ce13a5 100644
--- a/Private/NewBoot/NetBoot/module.cxx
+++ b/Private/NewBoot/NetBoot/EfiModule.cxx
@@ -7,7 +7,9 @@
* ========================================================
*/
-extern "C" void __Module(const char* ip, long iplen)
-{
-
+#include <EFIKit/Api.hxx>
+#include <EFIKit/EFI.hxx>
+
+extern "C" Int32 EfiMain(EfiHandlePtr handle, EfiSystemTable* SystemTable) {
+ return kEfiOk;
}
diff --git a/Private/NewBoot/NetBoot/manifest.json b/Private/NewBoot/NetBoot/manifest.json
index 1a177877..8486cfc1 100644
--- a/Private/NewBoot/NetBoot/manifest.json
+++ b/Private/NewBoot/NetBoot/manifest.json
@@ -1,4 +1,4 @@
{
- "pluginName": "internetBoot",
- "description": "internetBoot your device from the network."
-} \ No newline at end of file
+ "pluginName": "interBoot",
+ "description": "Boot your device from your network infra."
+}
diff --git a/Private/NewBoot/Source/CDROM/MAHROUSS/.keep b/Private/NewBoot/Source/CDROM/MAHROUSS/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Private/NewBoot/Source/CDROM/MAHROUSS/.keep
diff --git a/Private/Source/PermissionSelector.cxx b/Private/Source/PermissionSelector.cxx
index 1943a567..34760b8f 100644
--- a/Private/Source/PermissionSelector.cxx
+++ b/Private/Source/PermissionSelector.cxx
@@ -5,7 +5,7 @@
* Copyright Mahrouss Logic, all rights reserved.
*
* File: PermissionSelector.cpp
- * Purpose: Permission primitive type.
+ * Purpose: Permission selectors.
*
* ========================================================
*/
diff --git a/Private/StorageKit/ATA.hpp b/Private/StorageKit/ATA.hpp
index 279258ca..33b976ae 100644
--- a/Private/StorageKit/ATA.hpp
+++ b/Private/StorageKit/ATA.hpp
@@ -1,104 +1,87 @@
/*
-* ========================================================
-*
-* HCore
-* Copyright Mahrouss Logic, all rights reserved.
-*
-* ========================================================
-*/
+ * ========================================================
+ *
+ * HCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
#pragma once
+#include <KernelKit/DebugOutput.hpp>
#include <KernelKit/PCI/Dma.hpp>
#include <KernelKit/PCI/IO.hpp>
#include <NewKit/Defines.hpp>
#include <StorageKit/PRDT.hpp>
-#include <KernelKit/DebugOutput.hpp>
-namespace HCore
-{
- enum class PATAType
- {
- kRead28,
- kRead48,
- kWrite28,
- kWrite48,
- kATAUnknown
- };
-
- const char* ata_read_28(ULong lba);
- const char* ata_read_48(ULong lba);
-
- Int32 ata_write_48(ULong lba, const char *text = nullptr);
- Int32 ata_write_28(ULong lba, const char *text = nullptr);
-
- class PATACommandManager final
- {
- public:
- PATACommandManager() = default;
- ~PATACommandManager() = default;
-
- PATACommandManager &operator=(const PATACommandManager &) = default;
- PATACommandManager(const PATACommandManager &) = default;
-
- public:
- static Ref<PATACommandManager> Shared()
- {
- static Ref<PATACommandManager> manager;
- return manager;
+namespace HCore {
+enum class PATAType { kRead28, kRead48, kWrite28, kWrite48, kATAUnknown };
+
+const char *ata_read_28(ULong lba);
+const char *ata_read_48(ULong lba);
+
+Int32 ata_write_48(ULong lba, const char *text = nullptr);
+Int32 ata_write_28(ULong lba, const char *text = nullptr);
+
+class PATACommandManager final {
+ public:
+ explicit PATACommandManager() = default;
+ ~PATACommandManager() = default;
+
+ PATACommandManager &operator=(const PATACommandManager &) = default;
+ PATACommandManager(const PATACommandManager &) = default;
+
+ public:
+ static Ref<PATACommandManager> Shared() {
+ static Ref<PATACommandManager> manager;
+ return manager;
+ }
+
+ public:
+ template <PATAType Command>
+ ErrorOr<const char *> operator()(ULong lba,
+ const char *text = nullptr) noexcept {
+ switch (Command) {
+ case PATAType::kRead28:
+ return ErrorOr<const char *>(ata_read_28(lba));
+ case PATAType::kRead48:
+ return ErrorOr<const char *>(ata_read_48(lba));
+ case PATAType::kWrite28: {
+ if (text) {
+ ata_write_28(lba, text);
+ kcout << "ErrorOr<CT> ata_read<CT, Command>: Write ATA Command... "
+ "(Write28)\n";
+
+ return {};
}
- public:
- template <PATAType Command>
- ErrorOr<const char*> operator()(ULong lba, const char *text = nullptr) noexcept
- {
- switch (Command)
- {
- case PATAType::kRead28:
- return ErrorOr<const char*>(ata_read_28(lba));
- case PATAType::kRead48:
- return ErrorOr<const char*>(ata_read_48(lba));
- case PATAType::kWrite28:
- {
- if (text)
- {
- ata_write_28(lba, text);
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Write ATA Command... "
- "(Write28)\n";
-
- return {};
- }
-
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Bad ATA Command... "
- "(Write28)\n";
-
- return {};
- }
- case PATAType::kWrite48:
- {
- if (text)
- {
- ata_write_48(lba, text);
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Write ATA Command... "
- "(Write48)\n";
-
- return {};
- }
-
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Bad ATA Command... "
- "(Write48)\n";
-
- return {};
- }
- case PATAType::kATAUnknown:
- {
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Unknown ATA Command...\n";
- return {};
- }
- }
-
- return ErrorOr<const char*>(nullptr);
+ kcout << "ErrorOr<CT> ata_read<CT, Command>: Bad ATA Command... "
+ "(Write28)\n";
+
+ return {};
+ }
+ case PATAType::kWrite48: {
+ if (text) {
+ ata_write_48(lba, text);
+ kcout << "ErrorOr<CT> ata_read<CT, Command>: Write ATA Command... "
+ "(Write48)\n";
+
+ return {};
}
- };
-} // namespace HCore
+ kcout << "ErrorOr<CT> ata_read<CT, Command>: Bad ATA Command... "
+ "(Write48)\n";
+
+ return {};
+ }
+ case PATAType::kATAUnknown: {
+ kcout << "ErrorOr<CT> ata_read<CT, Command>: Unknown ATA Command...\n";
+ return {};
+ }
+ }
+
+ return ErrorOr<const char *>(nullptr);
+ }
+};
+} // namespace HCore
diff --git a/Private/StorageKit/NVME.hpp b/Private/StorageKit/NVME.hpp
index 0bfbef52..1b638989 100644
--- a/Private/StorageKit/NVME.hpp
+++ b/Private/StorageKit/NVME.hpp
@@ -6,43 +6,35 @@
*
* ========================================================
*/
-
+
#pragma once
#include <KernelKit/Device.hpp>
#include <NewKit/OwnPtr.hpp>
-namespace HCore
-{
- class NVMEPacket;
-
- class NVMEDevice : public DeviceInterface<NVMEPacket>
- {
- public:
- NVMEDevice(void(*Out)(NVMEPacket outpacket),
- void(*In)(NVMEPacket inpacket),
- void(*Cleanup)(void))
- : DeviceInterface(Out, In), fCleanup(Cleanup)
- {}
-
- virtual ~NVMEDevice()
- {
- if (fCleanup)
- fCleanup();
- }
+namespace HCore {
+class NVMEPacket;
- public:
- NVMEDevice &operator=(const NVMEDevice &) = default;
- NVMEDevice(const NVMEDevice &) = default;
+class NVMEDevice : public DeviceInterface<NVMEPacket> {
+ public:
+ explicit NVMEDevice(void (*Out)(NVMEPacket outpacket),
+ void (*In)(NVMEPacket inpacket), void (*Cleanup)(void))
+ : DeviceInterface(Out, In), fCleanup(Cleanup) {}
- virtual const char *Name() const;
+ virtual ~NVMEDevice() {
+ if (fCleanup) fCleanup();
+ }
- public:
- OwnPtr<NVMEPacket> operator()(UInt32 dmaLow, UInt32 dmaHigh, SizeT sz);
+ public:
+ NVMEDevice &operator=(const NVMEDevice &) = default;
+ NVMEDevice(const NVMEDevice &) = default;
- private:
- void(*fCleanup)(void);
+ virtual const char *Name() const;
+ public:
+ OwnPtr<NVMEPacket> operator()(UInt32 dmaLow, UInt32 dmaHigh, SizeT sz);
- };
-} // namespace HCore
+ private:
+ void (*fCleanup)(void);
+};
+} // namespace HCore
diff --git a/Private/StorageKit/PRDT.hpp b/Private/StorageKit/PRDT.hpp
index d269ee3a..fb7d81ff 100644
--- a/Private/StorageKit/PRDT.hpp
+++ b/Private/StorageKit/PRDT.hpp
@@ -16,7 +16,7 @@
namespace HCore {
class PRDT final {
public:
- PRDT() = delete;
+ explicit PRDT() = delete;
explicit PRDT(const UIntPtr &physAddr);
~PRDT();
diff --git a/Public/Kits/GKit/Core.hpp b/Public/Kits/GKit/Core.hpp
index 7059eb5e..00ae524e 100644
--- a/Public/Kits/GKit/Core.hpp
+++ b/Public/Kits/GKit/Core.hpp
@@ -14,11 +14,20 @@
#pragma once
+#include <CompilerKit/CompilerKit.hpp>
#include <NewKit/Array.hpp>
#include <NewKit/Defines.hpp>
#include <NewKit/Ref.hpp>
#include <NewKit/String.hpp>
+#define $() HCore::GApplication::Shared()->Document()
+
+#ifdef __EXPORT_LIB
+#define G_API __attribute__((container(".EXPORT")))
+#else
+#define G_API __attribute__((container(".IMPORT")))
+#endif // ifdef __EXPORT_LIB
+
namespace HCore {
template <typename... T>
class GAction;
@@ -27,8 +36,11 @@ class GString;
class GNumber;
class GVector2;
class GBoolean;
+class GDocument;
+class GApplication;
+class GFrame;
-class GBoolean {
+class G_API GBoolean {
private:
explicit GBoolean() : m_Value(false) {}
@@ -46,7 +58,7 @@ class GBoolean {
};
template <typename... T>
-class GAction {
+class G_API GAction {
explicit GAction(HCore::StringView& sw) { m_Name = sw; }
HCore::StringView m_Name;
@@ -64,7 +76,7 @@ class GAction {
}
};
-class GVector2 {
+class G_API GVector2 {
explicit GVector2(HCore::StringView& sw) : m_Vec2() {}
HCore::Array<HCore::Int, 3> m_Vec2;
@@ -81,7 +93,7 @@ class GVector2 {
}
};
-class GNumber {
+class G_API GNumber {
HCore::Int m_Number{0};
friend class GForm;
@@ -94,7 +106,7 @@ class GNumber {
}
};
-class GString {
+class G_API GString {
explicit GString(HCore::StringView& content) {
m_Content = new HCore::StringView();
*m_Content = content;
@@ -110,4 +122,39 @@ class GString {
return str;
}
};
+
+class G_API GApplication final {
+ public:
+ explicit GApplication() = default;
+ ~GApplication() = default;
+
+ HCORE_COPY_DEFAULT(GApplication);
+
+ GDocument* Document() noexcept { return nullptr; }
+
+ GApplication* Shared() noexcept {
+ STATIC GApplication* gApp = nullptr;
+
+ if (!gApp) gApp = new GApplication();
+
+ return gApp;
+ }
+};
+
+class G_API GDocument final {
+ public:
+ explicit GDocument(StringView& sv) : mString(GString::Construct(sv)) {}
+ ~GDocument() = default;
+
+ HCORE_COPY_DEFAULT(GDocument);
+
+ GFrame** GetAddressOf() noexcept { return &mFrame; }
+ GFrame* Get() noexcept { return mFrame; }
+
+ GString& Name() { return mString; }
+
+ private:
+ GFrame* mFrame{nullptr};
+ GString mString;
+};
} // namespace HCore
diff --git a/Public/Kits/GKit/Makefile b/Public/Kits/GKit/Makefile
index 95ab0ee2..d8228fca 100644
--- a/Public/Kits/GKit/Makefile
+++ b/Public/Kits/GKit/Makefile
@@ -10,7 +10,7 @@ ASMFLAGS=-f elf64
.PHONY: build-gkit
build-gkit:
- $(CC) -I../ -I../../../Private/ $(CCFLAGS) *.cxx
+ $(CC) -I../ -I$(HOME) -I../../../Private/ $(CCFLAGS) *.cxx
.PHONY: all
all: build-gkit