From 2f7c48ef9172ba48fa177600a12ab0d51cb9e566 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 27 Jan 2024 17:06:30 +0100 Subject: Kernel: Fix ABI for MP-CC, rename FilesystemIndexer to IndexableProperty. Public/ZipKit: Add impl for deflate/inflate. Signed-off-by: Amlal El Mahrouss --- Private/FSKit/FilesystemIndexer.hxx | 48 ------------------------------------ Private/FSKit/IndexableProperty.hxx | 48 ++++++++++++++++++++++++++++++++++++ Private/FSKit/NewFS.hxx | 2 +- Private/FSKit/NewFSIndexer.hxx | 2 +- Private/KernelKit/Device.hpp | 9 +++---- Private/Source/CxxAbi.cxx | 45 ++++++++++++++++++++++++--------- Private/Source/IndexableProperty.cxx | 2 +- 7 files changed, 88 insertions(+), 68 deletions(-) delete mode 100644 Private/FSKit/FilesystemIndexer.hxx create mode 100644 Private/FSKit/IndexableProperty.hxx (limited to 'Private') diff --git a/Private/FSKit/FilesystemIndexer.hxx b/Private/FSKit/FilesystemIndexer.hxx deleted file mode 100644 index 4ba68056..00000000 --- a/Private/FSKit/FilesystemIndexer.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ======================================================== - * - * hCore - * Copyright 2024 Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#pragma once - -#include -#include - -namespace hCore -{ - namespace Indexer - { - struct IndexProperty final - { - public: - Char Drive[kDriveNameLen]; - Char Path[256]; - Char From[256]; - Char To[256]; - - }; - - class IndexableProperty final : public Property - { - public: - explicit IndexableProperty() : Property(StringBuilder::Construct("IndexableProperty").Leak().Leak()) {} - ~IndexableProperty() override = default; - - public: - IndexProperty& LeakProperty() noexcept; - - public: - void AddFlag(Int16 flag); - void RemoveFlag(Int16 flag); - - private: - IndexProperty fIndex; - UInt32 fFlags; - - }; - } -} diff --git a/Private/FSKit/IndexableProperty.hxx b/Private/FSKit/IndexableProperty.hxx new file mode 100644 index 00000000..4ba68056 --- /dev/null +++ b/Private/FSKit/IndexableProperty.hxx @@ -0,0 +1,48 @@ +/* + * ======================================================== + * + * hCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include +#include + +namespace hCore +{ + namespace Indexer + { + struct IndexProperty final + { + public: + Char Drive[kDriveNameLen]; + Char Path[256]; + Char From[256]; + Char To[256]; + + }; + + class IndexableProperty final : public Property + { + public: + explicit IndexableProperty() : Property(StringBuilder::Construct("IndexableProperty").Leak().Leak()) {} + ~IndexableProperty() override = default; + + public: + IndexProperty& LeakProperty() noexcept; + + public: + void AddFlag(Int16 flag); + void RemoveFlag(Int16 flag); + + private: + IndexProperty fIndex; + UInt32 fFlags; + + }; + } +} diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx index f9725e22..0e935cd5 100644 --- a/Private/FSKit/NewFS.hxx +++ b/Private/FSKit/NewFS.hxx @@ -175,7 +175,7 @@ namespace hCore virtual bool WriteCatalog(NewCatalog& catalog, voidPtr data) = 0; virtual bool RemoveCatalog(NewCatalog& catalog) = 0; - void FormatDrive(DriveTraits& drive); + virtual bool Format(DriveTraits& drive) = 0; }; diff --git a/Private/FSKit/NewFSIndexer.hxx b/Private/FSKit/NewFSIndexer.hxx index fd22e4bd..c5f63059 100644 --- a/Private/FSKit/NewFSIndexer.hxx +++ b/Private/FSKit/NewFSIndexer.hxx @@ -9,7 +9,7 @@ #pragma once -#include +#include #include namespace hCore diff --git a/Private/KernelKit/Device.hpp b/Private/KernelKit/Device.hpp index b117cf7f..4ae968c2 100644 --- a/Private/KernelKit/Device.hpp +++ b/Private/KernelKit/Device.hpp @@ -35,22 +35,19 @@ namespace hCore DeviceInterface(const DeviceInterface &) = default; public: - DeviceInterface &operator<<(T Data) + DeviceInterface& operator<<(T Data) { m_Out(Data); return *this; } - DeviceInterface &operator>>(T Data) + DeviceInterface& operator>>(T Data) { m_In(Data); return *this; } - virtual const char* Name() const - { - return ("DeviceInterface"); - } + virtual const char* Name() const { return "DeviceInterface"; } operator bool() { return m_Out && m_In; } bool operator!() { return !m_Out && !m_In; } diff --git a/Private/Source/CxxAbi.cxx b/Private/Source/CxxAbi.cxx index 324c878d..4984c81a 100644 --- a/Private/Source/CxxAbi.cxx +++ b/Private/Source/CxxAbi.cxx @@ -29,7 +29,8 @@ extern "C" void __stack_chk_fail() hCore::panic(RUNTIME_CHECK_POINTER); } -extern "C" int __cxa_atexit(void (*f)(void *), void *arg, void *dso) { +extern "C" int __cxa_atexit(void (*f)(void *), void *arg, void *dso) +{ if (__atexit_func_count >= DSO_MAX_OBJECTS) return -1; @@ -42,11 +43,15 @@ extern "C" int __cxa_atexit(void (*f)(void *), void *arg, void *dso) { return 0; } -extern "C" void __cxa_finalize(void *f) { +extern "C" void __cxa_finalize(void *f) +{ uarch_t i = __atexit_func_count; - if (!f) { - while (i--) { - if (__atexit_funcs[i].destructor_func) { + if (!f) + { + while (i--) + { + if (__atexit_funcs[i].destructor_func) + { (*__atexit_funcs[i].destructor_func)(__atexit_funcs[i].obj_ptr); }; } @@ -54,26 +59,32 @@ extern "C" void __cxa_finalize(void *f) { return; } - while (i--) { - if (__atexit_funcs[i].destructor_func) { + while (i--) + { + if (__atexit_funcs[i].destructor_func) + { (*__atexit_funcs[i].destructor_func)(__atexit_funcs[i].obj_ptr); __atexit_funcs[i].destructor_func = 0; }; } } -namespace cxxabiv1 { - extern "C" int __cxa_guard_acquire(__guard *g) { +namespace cxxabiv1 +{ + extern "C" int __cxa_guard_acquire(__guard *g) + { (void) g; return 0; } - extern "C" int __cxa_guard_release(__guard *g) { + extern "C" int __cxa_guard_release(__guard *g) + { *(char *) g = 1; return 0; } - extern "C" void __cxa_guard_abort(__guard *g) { + extern "C" void __cxa_guard_abort(__guard *g) + { (void) g; } } // namespace cxxabiv1 @@ -87,6 +98,18 @@ namespace cxxkit for (int i = 0; i < cnt; ++i) (finis[i])(); } + + extern "C" void __init_local(void(**init)(void), int cnt) + { + for (int i = 0; i < cnt; ++i) + (init[i])(); + } + + extern "C" void __fini_local(void(**finis)(void), int cnt) + { + for (int i = 0; i < cnt; ++i) + (finis[i])(); + } } #endif diff --git a/Private/Source/IndexableProperty.cxx b/Private/Source/IndexableProperty.cxx index bb1393b5..5b49d6c1 100644 --- a/Private/Source/IndexableProperty.cxx +++ b/Private/Source/IndexableProperty.cxx @@ -9,7 +9,7 @@ //! @brief hCore NewFS Indexer. -#include +#include #include #include #include -- cgit v1.2.3