diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-27 19:38:51 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-27 19:42:30 +0100 |
| commit | c6c908167e37e0f82e272f6f9fd6462c0dd4502c (patch) | |
| tree | cb5b6337cc413da9c95e9aa0406ed023b6ce9614 | |
| parent | 2f7c48ef9172ba48fa177600a12ab0d51cb9e566 (diff) | |
Kernel: Last refactor of the kernel.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | Private/KernelKit/CodeManager.hpp | 4 | ||||
| -rw-r--r-- | Private/KernelKit/FileManager.hpp | 4 | ||||
| -rw-r--r-- | Private/KernelKit/Timer.hpp | 16 | ||||
| -rw-r--r-- | Private/NewKit/ErrorID.hpp | 14 | ||||
| -rw-r--r-- | Private/Source/CodeManager.cxx | 4 | ||||
| -rw-r--r-- | Private/Source/PermissionSelector.cxx | 2 | ||||
| -rw-r--r-- | Private/Source/Timer.cxx | 7 | ||||
| -rw-r--r-- | Private/html/hCore::Ref.html | 2 |
8 files changed, 27 insertions, 26 deletions
diff --git a/Private/KernelKit/CodeManager.hpp b/Private/KernelKit/CodeManager.hpp index 04d5647b..f470bb01 100644 --- a/Private/KernelKit/CodeManager.hpp +++ b/Private/KernelKit/CodeManager.hpp @@ -59,14 +59,14 @@ namespace hCore /// This is read-only by design. /// It handles different kind of code. /// PowerPC <-> AMD64 for example. - typedef struct UniversalProcedureTable + typedef struct UniversalProcedureTable final { const Char NAME[kPefNameLen]; const VoidPtr TRAP; const SizeT ARCH; } __attribute__((packed)) UniversalProcedureTableType; - bool execute_from_image(PEFLoader& exec); + bool execute_from_image(PEFLoader& exec) noexcept; } } diff --git a/Private/KernelKit/FileManager.hpp b/Private/KernelKit/FileManager.hpp index 311527f9..04055815 100644 --- a/Private/KernelKit/FileManager.hpp +++ b/Private/KernelKit/FileManager.hpp @@ -136,7 +136,7 @@ namespace hCore ErrorOr<Int64> WriteAll(const VoidPtr data) noexcept { if (data == nullptr) - return ErrorOr<Int64>(ME_INVALID_DATA); + return ErrorOr<Int64>(H_INVALID_DATA); auto man = FSClass::GetMounted(); @@ -146,7 +146,7 @@ namespace hCore return ErrorOr<Int64>(0); } - return ErrorOr<Int64>(ME_INVALID_DATA); + return ErrorOr<Int64>(H_INVALID_DATA); } VoidPtr ReadAll() noexcept diff --git a/Private/KernelKit/Timer.hpp b/Private/KernelKit/Timer.hpp index 32559ee3..6e694ceb 100644 --- a/Private/KernelKit/Timer.hpp +++ b/Private/KernelKit/Timer.hpp @@ -16,24 +16,24 @@ namespace hCore { - class ITimer; class HardwareTimer; + class HardwareTimerInterface; - class ITimer + class HardwareTimerInterface { public: - ITimer() = default; - virtual ~ITimer() = default; + HardwareTimerInterface() = default; + virtual ~HardwareTimerInterface() = default; public: - HCORE_COPY_DEFAULT(ITimer); + HCORE_COPY_DEFAULT(HardwareTimerInterface); public: - virtual Int32 Wait() { return ME_UNIMPLEMENTED; } + virtual Int32 Wait() noexcept; }; - class HardwareTimer final : public ITimer + class HardwareTimer final : public HardwareTimerInterface { public: explicit HardwareTimer(Int64 seconds); @@ -43,7 +43,7 @@ namespace hCore HCORE_COPY_DEFAULT(HardwareTimer); public: - Int32 Wait() override; + Int32 Wait() noexcept override; public: IntPtr* fDigitalTimer{ nullptr }; diff --git a/Private/NewKit/ErrorID.hpp b/Private/NewKit/ErrorID.hpp index 6ea886a4..84dbe559 100644 --- a/Private/NewKit/ErrorID.hpp +++ b/Private/NewKit/ErrorID.hpp @@ -12,10 +12,10 @@ #include <NewKit/ErrorOr.hpp> #include <NewKit/Defines.hpp> -#define ME_EXEC_ERROR -30 -#define ME_FILE_NOT_FOUND -31 -#define ME_DIR_NOT_FOUND -32 -#define ME_FILE_EXISTS -33 -#define ME_TOO_LONG -34 -#define ME_INVALID_DATA -35 -#define ME_UNIMPLEMENTED -36 +#define H_EXEC_ERROR -30 +#define H_FILE_NOT_FOUND -31 +#define H_DIR_NOT_FOUND -32 +#define H_FILE_EXISTS -33 +#define H_TOO_LONG -34 +#define H_INVALID_DATA -35 +#define H_UNIMPLEMENTED -36 diff --git a/Private/Source/CodeManager.cxx b/Private/Source/CodeManager.cxx index ba117346..1928683b 100644 --- a/Private/Source/CodeManager.cxx +++ b/Private/Source/CodeManager.cxx @@ -115,14 +115,14 @@ namespace hCore if (auto sym = this->FindSymbol("__start", kPefCode); sym) return ErrorOr<VoidPtr>(sym); - return ErrorOr<VoidPtr>(ME_EXEC_ERROR); + return ErrorOr<VoidPtr>(H_EXEC_ERROR); } bool PEFLoader::IsLoaded() noexcept { return !fBad && fCachedBlob; } namespace Utils { - bool execute_from_image(PEFLoader& exec) + bool execute_from_image(PEFLoader& exec) noexcept { auto errOrStart = exec.LoadStart(); diff --git a/Private/Source/PermissionSelector.cxx b/Private/Source/PermissionSelector.cxx index 22d7f5e7..a14f146d 100644 --- a/Private/Source/PermissionSelector.cxx +++ b/Private/Source/PermissionSelector.cxx @@ -30,4 +30,4 @@ namespace hCore bool PermissionSelector::operator!=(const PermissionSelector& lhs) { return lhs.fRing != this->fRing; } const RingKind& PermissionSelector::Ring() noexcept { return this->fRing; } -} +} // namespace hCore diff --git a/Private/Source/Timer.cxx b/Private/Source/Timer.cxx index 9b8c5448..73343fad 100644 --- a/Private/Source/Timer.cxx +++ b/Private/Source/Timer.cxx @@ -13,16 +13,17 @@ using namespace hCore; +Int32 HardwareTimerInterface::Wait() noexcept { return H_UNIMPLEMENTED; } + HardwareTimer::HardwareTimer(Int64 seconds) : fWaitFor(seconds) {} HardwareTimer::~HardwareTimer() { fWaitFor = 0; } -Int32 HardwareTimer::Wait() +Int32 HardwareTimer::Wait() noexcept { if (fWaitFor < 1) return -1; - while (*fDigitalTimer < (*fDigitalTimer + fWaitFor)) - ; + while (*fDigitalTimer < (*fDigitalTimer + fWaitFor)) {} return 0; }
\ No newline at end of file diff --git a/Private/html/hCore::Ref.html b/Private/html/hCore::Ref.html index 7d2db9bf..89c82dab 100644 --- a/Private/html/hCore::Ref.html +++ b/Private/html/hCore::Ref.html @@ -10,7 +10,7 @@ <li>Ref::Ref()</li> <li>Ref::~Ref()</li> - <li>Ref::Ref(T cls, const bool &strong = false)</li> + <li>Ref::Ref(T cls, const bool& strong = false)</li> <li>T operator->() const</li> <li>T operator*()</li> |
