diff options
| author | Amlal <amlal@zka.com> | 2024-07-14 00:37:06 +0200 |
|---|---|---|
| committer | Amlal <amlal@zka.com> | 2024-07-14 00:37:06 +0200 |
| commit | b038c3eff8c80be2e6e10bea16634523fff4a6b5 (patch) | |
| tree | d4c9b5c1931d6e5029243446b66e8edb608072b8 | |
| parent | 062ba0a060929c18a2734835cd426e3d808093b7 (diff) | |
[IMP]
- IsUndefined returns const bool& now.
- Replace kUndefined with kNull now.
- Remove ML_ from macros in newstd.hxx.
- Rename NSyscall to NSyscallInterface, which is a ref counted class now.
- Rename MBCIType to PowerID
- Update ToDos.
- Update NewFS root catalog name.
- Fix JSON 'null' initialization.
- Add Json to variant object.
- Replace kPointer with kBlob in variant kinds.
- Add Leak() method to variant.
Signed-off-by: Amlal <amlal@zka.com>
| -rw-r--r-- | Boot/Modules/.keep (renamed from Boot/NetBoot/.hgkeep) | 0 | ||||
| -rw-r--r-- | Boot/Modules/NetBoot/.hgkeep | 0 | ||||
| -rw-r--r-- | Boot/Modules/NetBoot/Module.cxx (renamed from Boot/NetBoot/Module.cxx) | 0 | ||||
| -rw-r--r-- | Boot/Modules/NetBoot/NetBoot.hxx (renamed from Boot/NetBoot/NetBoot.hxx) | 0 | ||||
| -rw-r--r-- | Boot/Modules/NetBoot/compile_flags.txt (renamed from Boot/NetBoot/compile_flags.txt) | 0 | ||||
| -rw-r--r-- | Boot/Modules/NetBoot/manifest.json | 4 | ||||
| -rw-r--r-- | Boot/NetBoot/manifest.json | 4 | ||||
| -rw-r--r-- | Boot/ReadMe.md | 4 | ||||
| -rw-r--r-- | Boot/ovmf.ps1 (renamed from Boot/download-ovmf.ps1) | 0 | ||||
| -rw-r--r-- | Comm/newstd.hxx | 38 | ||||
| -rw-r--r-- | Kernel/Docs/TODO-LIST.md | 10 | ||||
| -rw-r--r-- | Kernel/FSKit/NewFS.hxx | 2 | ||||
| -rw-r--r-- | Kernel/KernelKit/DebugOutput.hpp | 2 | ||||
| -rw-r--r-- | Kernel/NewKit/Json.hxx | 18 | ||||
| -rw-r--r-- | Kernel/NewKit/Variant.hpp | 20 | ||||
| -rw-r--r-- | Kernel/Sources/FS/NewFS.cxx | 4 | ||||
| -rw-r--r-- | Kernel/Sources/Json.cxx | 2 | ||||
| -rw-r--r-- | Kernel/Sources/Main.cxx | 8 | ||||
| -rw-r--r-- | Kernel/Sources/Variant.cxx | 10 |
19 files changed, 71 insertions, 55 deletions
diff --git a/Boot/NetBoot/.hgkeep b/Boot/Modules/.keep index e69de29b..e69de29b 100644 --- a/Boot/NetBoot/.hgkeep +++ b/Boot/Modules/.keep diff --git a/Boot/Modules/NetBoot/.hgkeep b/Boot/Modules/NetBoot/.hgkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Boot/Modules/NetBoot/.hgkeep diff --git a/Boot/NetBoot/Module.cxx b/Boot/Modules/NetBoot/Module.cxx index 3bc71d0e..3bc71d0e 100644 --- a/Boot/NetBoot/Module.cxx +++ b/Boot/Modules/NetBoot/Module.cxx diff --git a/Boot/NetBoot/NetBoot.hxx b/Boot/Modules/NetBoot/NetBoot.hxx index 1a474501..1a474501 100644 --- a/Boot/NetBoot/NetBoot.hxx +++ b/Boot/Modules/NetBoot/NetBoot.hxx diff --git a/Boot/NetBoot/compile_flags.txt b/Boot/Modules/NetBoot/compile_flags.txt index f9ca281f..f9ca281f 100644 --- a/Boot/NetBoot/compile_flags.txt +++ b/Boot/Modules/NetBoot/compile_flags.txt diff --git a/Boot/Modules/NetBoot/manifest.json b/Boot/Modules/NetBoot/manifest.json new file mode 100644 index 00000000..5f94c677 --- /dev/null +++ b/Boot/Modules/NetBoot/manifest.json @@ -0,0 +1,4 @@ +{ + "pluginName": "iBoot", + "description": "OTA updates." +} diff --git a/Boot/NetBoot/manifest.json b/Boot/NetBoot/manifest.json deleted file mode 100644 index 825677f7..00000000 --- a/Boot/NetBoot/manifest.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pluginName": "iBoot", - "description": "Boot your device from your network infrastructure." -} diff --git a/Boot/ReadMe.md b/Boot/ReadMe.md index 47e76793..1c2b95af 100644 --- a/Boot/ReadMe.md +++ b/Boot/ReadMe.md @@ -1,4 +1,4 @@ -# newosldr +# newosldr (Zeta Bootloader Architecture) You need: @@ -11,7 +11,7 @@ Start by cloning the repo: git clone git@bitbucket.org:mahrouss/microkernel.git ``` -And execute: +And then execute: ``` make all diff --git a/Boot/download-ovmf.ps1 b/Boot/ovmf.ps1 index 5a2c5f0e..5a2c5f0e 100644 --- a/Boot/download-ovmf.ps1 +++ b/Boot/ovmf.ps1 diff --git a/Comm/newstd.hxx b/Comm/newstd.hxx index 65a28205..d8ef3123 100644 --- a/Comm/newstd.hxx +++ b/Comm/newstd.hxx @@ -14,15 +14,15 @@ Purpose: System Call Interface. #error !!! including header in kernel mode !!!
#endif // __KERNEL__
-#define ML_IMPORT_CXX extern "C++"
-#define ML_IMPORT_C extern "C"
+#define IMPORT_CXX extern "C++"
+#define IMPORT_C extern "C"
#define cRestrictR "r"
#define cRestrictRB "rb"
#define cRestrictW "w"
#define cRestrictRW "rw"
-class NSyscall; /// @brief System call class.
+class NSSyscallInterface; /// @brief System call class.
typedef int OSType;
typedef bool Bool;
@@ -42,35 +42,35 @@ typedef __INT8_TYPE__ SInt8; typedef char UTFChar;
-typedef UInt32 MBCIType;
+typedef UInt32 PowerID;
/**
@brief System call class.
*/
-class NSyscall
+class NSSyscallInterface
{
public:
- explicit NSyscall() = default;
- virtual ~NSyscall() = default;
+ explicit NSSyscallInterface() = default;
+ virtual ~NSSyscallInterface() = default;
- NSyscall& operator=(const NSyscall&) = default;
- NSyscall(const NSyscall&) = default;
+ NSSyscallInterface& operator=(const NSSyscallInterface&) = default;
+ NSSyscallInterface(const NSSyscallInterface&) = default;
public:
/// @brief disable device.
- virtual UInt0 PowerOff(MBCIType) = 0;
+ virtual UInt0 PowerOff(PowerID) = 0;
/// @brief enable device.
- virtual UInt0 PowerOn(MBCIType) = 0;
+ virtual UInt0 PowerOn(PowerID) = 0;
/// @brief reboot device.
- virtual UInt0 PowerReboot(MBCIType) = 0;
+ virtual UInt0 PowerReboot(PowerID) = 0;
/// @brief check if MBCI device is wokeup.
- virtual Bool PowerIsWokeup(MBCIType) = 0;
+ virtual Bool PowerIsWokeup(PowerID) = 0;
- /// @brief probe MBCI device from phone.
- virtual MBCIType PowerProbeDevice(const char* namepace, const int index) = 0;
+ /// @brief probe MBCI/ACPI device from phone.
+ virtual PowerID PowerProbeDevice(const char* namepace, const int index) = 0;
// THOSE DOESNT REQUIRE PERMISSIONS FROM THE USER. //
@@ -116,12 +116,8 @@ public: virtual UInt0* WriteStorage(const UTFChar* cmdNameOrData, SizeT cmdSize, OSType descriptorType) = 0;
};
-/// @brief Request syscall object.
+/// @brief Get shared syscall object.
/// @return Syscall implementation.
-ML_IMPORT_C NSyscall* NRequestSyscall(UInt0);
-
-/// @brief Release syscall object.
-/// @param syscall System call object.
-ML_IMPORT_C UInt0 NReleaseSyscall(NSyscall* syscall);
+IMPORT_C NSSyscallInterface* NSGetSharedSyscallInterface(UInt0);
#endif // ifndef _INC_COMM_NEWSTD_HXX_
diff --git a/Kernel/Docs/TODO-LIST.md b/Kernel/Docs/TODO-LIST.md index ed7b1cf9..62cc886c 100644 --- a/Kernel/Docs/TODO-LIST.md +++ b/Kernel/Docs/TODO-LIST.md @@ -13,11 +13,13 @@ - AHCI driver [ WiP ] - Context switch x87/SSE/AVX registers [ X ] - Framebuffer [ X ] -- AHCI support [ ] -- Make installer [ ] +- ATA support [ X ] +- Make installer [ X ] Status: -newosldr: Need to boot from EPM partition. +newosldr: Need to boot from EPM partition. [ X ] <br> -NewKernel: New Filesystem in progress. +NewKernel: New Filesystem is done. [ X ] + +**Refer to Jira!** diff --git a/Kernel/FSKit/NewFS.hxx b/Kernel/FSKit/NewFS.hxx index 25b85ee0..27ce95d5 100644 --- a/Kernel/FSKit/NewFS.hxx +++ b/Kernel/FSKit/NewFS.hxx @@ -71,7 +71,7 @@ default. #define kNewFSSeparator '\\' #define kNewFSUpDir ".." -#define kNewFSRoot "C:\\" +#define kNewFSRoot "\\" #define kNewFSLF '\r' #define kNewFSEOF (-1) diff --git a/Kernel/KernelKit/DebugOutput.hpp b/Kernel/KernelKit/DebugOutput.hpp index 10895c1a..02b73fc9 100644 --- a/Kernel/KernelKit/DebugOutput.hpp +++ b/Kernel/KernelKit/DebugOutput.hpp @@ -205,4 +205,4 @@ namespace Kernel #endif // ifdef kcout #define kcout TerminalDevice::The() -#define endl end_line() +#define endl kcout << Kernel::end_line() diff --git a/Kernel/NewKit/Json.hxx b/Kernel/NewKit/Json.hxx index 4b994606..9371bf15 100644 --- a/Kernel/NewKit/Json.hxx +++ b/Kernel/NewKit/Json.hxx @@ -16,7 +16,8 @@ #include <NewKit/Utils.hpp> #define cMaxJsonPath 4096 -#define cUndefinedLen 32 +#define cJSONLen 32 +#define cJSONNull "null" namespace Kernel { @@ -25,10 +26,13 @@ namespace Kernel { public: explicit JsonType() - : Kernel::JsonType(cUndefinedLen, cUndefinedLen) { - this->AsKey() += "undefined"; - this->AsValue() += "undefined"; + auto len = cJSONLen; + StringView key = StringView(len); + key += cJSONNull; + + this->AsKey() = key; + this->AsValue() = key; } explicit JsonType(SizeT lhsLen, SizeT rhsLen) @@ -40,7 +44,7 @@ namespace Kernel NEWOS_COPY_DEFAULT(JsonType); - Bool IsUndefined() { return fUndefined; } + const Bool& IsUndefined() { return fUndefined; } private: Bool fUndefined; // is this instance undefined? @@ -62,7 +66,7 @@ namespace Kernel return fValue; } - static JsonType kUndefined; + static JsonType kNull; }; /// @brief Json stream reader helper. @@ -71,7 +75,7 @@ namespace Kernel STATIC JsonType In(const Char* full_array) { if (full_array[0] != '{') - return JsonType::kUndefined; + return JsonType::kNull; SizeT len = rt_string_len(full_array); Boolean probe_value = false; diff --git a/Kernel/NewKit/Variant.hpp b/Kernel/NewKit/Variant.hpp index 27cd29cc..c118eda1 100644 --- a/Kernel/NewKit/Variant.hpp +++ b/Kernel/NewKit/Variant.hpp @@ -8,6 +8,7 @@ #include <NewKit/Defines.hpp> #include <NewKit/String.hpp> +#include <NewKit/Json.hxx> namespace Kernel { @@ -17,8 +18,9 @@ namespace Kernel enum class VariantKind { kString, - kPointer, - kUndefined + kBlob, + kNull, + kJson, }; public: @@ -35,20 +37,28 @@ namespace Kernel : fPtr((voidPtr)stringView), fKind(VariantKind::kString) { } + + explicit Variant(JsonType* json) + : fPtr((voidPtr)json), fKind(VariantKind::kJson) + { + } + explicit Variant(nullPtr) - : fPtr(nullptr), fKind(VariantKind::kUndefined) + : fPtr(nullptr), fKind(VariantKind::kNull) { } + explicit Variant(voidPtr ptr) - : fPtr(ptr), fKind(VariantKind::kPointer) + : fPtr(ptr), fKind(VariantKind::kBlob) { } public: const Char* ToString(); + VoidPtr Leak(); private: voidPtr fPtr{nullptr}; - VariantKind fKind{VariantKind::kUndefined}; + VariantKind fKind{VariantKind::kNull}; }; } // namespace Kernel diff --git a/Kernel/Sources/FS/NewFS.cxx b/Kernel/Sources/FS/NewFS.cxx index 85926ff9..f796dd97 100644 --- a/Kernel/Sources/FS/NewFS.cxx +++ b/Kernel/Sources/FS/NewFS.cxx @@ -39,8 +39,8 @@ Kernel::SizeT drv_std_get_drv_size(); /***********************************************************************************/ /// This file implements the New File System. /// New File System implements a B-Tree based algortihm. -/// C:\\ -/// \\Path1\\ /\\ath2\\ +/// \\ +/// \\Path1\\ \\ath2\\ /// \\readme.rtf \\ListContents.pef \\readme.lnk <-- symlink. /// \\Path1\\readme.rtf /***********************************************************************************/ diff --git a/Kernel/Sources/Json.cxx b/Kernel/Sources/Json.cxx index 6ecd8e47..ffec19ce 100644 --- a/Kernel/Sources/Json.cxx +++ b/Kernel/Sources/Json.cxx @@ -9,4 +9,4 @@ using namespace Kernel; /// @brief Undefined object, is null in length. -cInitObject(Kernel::JsonType::kUndefined, Kernel::JsonType); +cInitObject(Kernel::JsonType::kNull, Kernel::JsonType); diff --git a/Kernel/Sources/Main.cxx b/Kernel/Sources/Main.cxx index 8c80d70c..c30b26e6 100644 --- a/Kernel/Sources/Main.cxx +++ b/Kernel/Sources/Main.cxx @@ -58,8 +58,8 @@ namespace Kernel::Detail constexpr auto cFolderInfo = "META-INF"; const auto cDirCount = 9; const char* cDirStr[cDirCount] = { - "C:\\Boot\\", "C:\\System\\", "C:\\Support\\", "C:\\Applications\\", - "C:\\Users\\", "C:\\Library\\", "C:\\Mount\\", "C:\\DCIM\\", "C:\\Storage\\"}; + "\\Boot\\", "\\System\\", "\\Support\\", "\\Applications\\", + "\\Users\\", "\\Library\\", "\\Mount\\", "\\DCIM\\", "\\Storage\\"}; for (Kernel::SizeT dirIndx = 0UL; dirIndx < cDirCount; ++dirIndx) { @@ -119,7 +119,7 @@ namespace Kernel::Detail } NewCatalog* catalogDisk = - this->fNewFS->GetParser()->GetCatalog("C:\\Mount\\SIM:"); + this->fNewFS->GetParser()->GetCatalog("\\Mount\\SIM:"); const Kernel::Char* cSrcName = "DISK-INF"; @@ -130,7 +130,7 @@ namespace Kernel::Detail else { catalogDisk = - (NewCatalog*)this->Leak()->CreateAlias("C:\\Mount\\SIM:"); + (NewCatalog*)this->Leak()->CreateAlias("\\Mount\\SIM:"); Kernel::StringView diskFolder(kNewFSSectorSz); diff --git a/Kernel/Sources/Variant.cxx b/Kernel/Sources/Variant.cxx index 9788f18c..7dc71df5 100644 --- a/Kernel/Sources/Variant.cxx +++ b/Kernel/Sources/Variant.cxx @@ -12,13 +12,17 @@ namespace Kernel { switch (fKind) { + case VariantKind::kJson: + return ("Class:{Json}"); case VariantKind::kString: return ("Class:{String}"); - case VariantKind::kPointer: - return ("Class:{Pointer}"); + case VariantKind::kBlob: + return ("Class:{Blob}"); default: - return ("Class:{Undefined}"); + return ("Class:{Null}"); } } + /// @brief Leak variant's instance. + VoidPtr Variant::Leak() { return fPtr; } } // namespace Kernel |
