diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-28 22:49:17 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-28 22:50:22 +0100 |
| commit | 39040dde3a6eef2e9b08ce6d3c5ca23aa4566ce6 (patch) | |
| tree | 439405d1f2546320d6a2954f952284089acc398d /Public/SDK/SystemKit | |
| parent | 59f1fd3491c91cca9c47e9a7e61d454b685bfb6a (diff) | |
Public: ZipKit compiles correctly now.
Public: Also Did reworked System APIs.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Public/SDK/SystemKit')
| -rw-r--r-- | Public/SDK/SystemKit/CoreAPI.hxx | 17 | ||||
| -rw-r--r-- | Public/SDK/SystemKit/FileAPI.hxx | 41 | ||||
| -rw-r--r-- | Public/SDK/SystemKit/HeapAPI.hxx | 68 | ||||
| -rw-r--r-- | Public/SDK/SystemKit/SystemKit.hxx | 12 | ||||
| -rw-r--r-- | Public/SDK/SystemKit/TIB.hxx | 41 | ||||
| -rw-r--r-- | Public/SDK/SystemKit/ThreadAPI.hxx | 42 |
6 files changed, 180 insertions, 41 deletions
diff --git a/Public/SDK/SystemKit/CoreAPI.hxx b/Public/SDK/SystemKit/CoreAPI.hxx new file mode 100644 index 00000000..f3e67e96 --- /dev/null +++ b/Public/SDK/SystemKit/CoreAPI.hxx @@ -0,0 +1,17 @@ +/* + * ======================================================== + * + * h-core + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#ifdef MUST_PASS +#undef MUST_PASS +#endif + +// unused by user side, it's a kernel thing. +#define MUST_PASS(e) ((void)e) diff --git a/Public/SDK/SystemKit/FileAPI.hxx b/Public/SDK/SystemKit/FileAPI.hxx new file mode 100644 index 00000000..88bf9bfb --- /dev/null +++ b/Public/SDK/SystemKit/FileAPI.hxx @@ -0,0 +1,41 @@ +/* + * ======================================================== + * + * h-core + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#ifndef _SYSTEM_KIT_HCORE_FILE_HPP +#define _SYSTEM_KIT_HCORE_FILE_HPP + +#include <CompilerKit/Compiler.hpp> +#include <NewKit/Defines.hpp> + +using namespace hCore; + +class MeFile final +{ + public: + explicit MeFile(const char *path); + ~MeFile(); + + public: + HCORE_COPY_DEFAULT(MeFile); + + public: + void *Read(SizeT off, SizeT sz); + void Write(void *buf, SizeT off, SizeT sz); + void Seek(SizeT off); + void *Read(SizeT sz); + void Write(void *buf, SizeT sz); + void Rewind(); + + public: + void SetMIME(const char *mime); +}; + +typedef MeFile *MeFilePtr; + +#endif // ifndef _SYSTEM_KIT_HCORE_FILE_HPP diff --git a/Public/SDK/SystemKit/HeapAPI.hxx b/Public/SDK/SystemKit/HeapAPI.hxx new file mode 100644 index 00000000..a1d7f51d --- /dev/null +++ b/Public/SDK/SystemKit/HeapAPI.hxx @@ -0,0 +1,68 @@ +/* + * ======================================================== + * + * h-core + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include <CompilerKit/Compiler.hpp> +#include <NewKit/Defines.hpp> + +using namespace hCore; + +class MeMemoryException; + +typedef void *MeHeapPtr; + +enum +{ + kHeapExpandable = 2, + kHeapNoExecute = 4, + kHeapShared = 6, + kHeapReadOnly = 8, + kHeapNoFlags = 0 +}; + +class MeHeap final +{ + private: + explicit MeHeap(); + + public: + ~MeHeap(); + + public: + HCORE_COPY_DEFAULT(MeHeap); + + public: + static MeHeap *Shared() noexcept; + + public: + void Dispose(MeHeapPtr me) noexcept; + SizeT Tell(MeHeapPtr me) noexcept; + MeHeapPtr New(const SizeT &sz, const Int32 flags = kHeapNoFlags); +}; + +class MeMemoryException final +{ + public: + MeMemoryException() = default; + ~MeMemoryException() = default; + + public: + HCORE_COPY_DEFAULT(MeMemoryException); + + public: + const char *Name(); + const char *Reason(); + + private: + const char *mReason{"Memory error!"}; + + private: + friend MeHeap; +}; diff --git a/Public/SDK/SystemKit/SystemKit.hxx b/Public/SDK/SystemKit/SystemKit.hxx new file mode 100644 index 00000000..9e1443cc --- /dev/null +++ b/Public/SDK/SystemKit/SystemKit.hxx @@ -0,0 +1,12 @@ +/*** =========================================== + (C) Mahrouss Logic + ===========================================*/ + +#pragma once + +#include <SystemKit/CoreAPI.hxx> +#include <SystemKit/FileAPI.hxx> +#include <SystemKit/HeapAPI.hxx> +#include <SystemKit/ThreadAPI.hxx> + +using namespace hCore; diff --git a/Public/SDK/SystemKit/TIB.hxx b/Public/SDK/SystemKit/TIB.hxx deleted file mode 100644 index 3a1c038b..00000000 --- a/Public/SDK/SystemKit/TIB.hxx +++ /dev/null @@ -1,41 +0,0 @@ -/* -* ======================================================== -* -* h-core -* Copyright Mahrouss Logic, all rights reserved. -* -* ======================================================== -*/ - -// -// Created by Amlal on 1/27/24. -// - -#ifndef HCORE_TIB_HXX -#define HCORE_TIB_HXX - -#include <Private/NewKit/Defines.hpp> - -namespace hCore -{ - /// @brief Thread Information Block for Local Storage. - /// Located in GS on AMD64, Virtual Address 0x10000 (64x0, 32x0, ARM64) - struct ThreadInformationBlock final - { - const Char TIB_NAME[255]; // Module Name - const UIntPtr TIB_START; // Start Address - const UIntPtr TIB_ALLOC; // Allocation Heap - const UIntPtr TIB_STACK; // Stack Pointer. - const Int32 TIB_ARCH; // Architecture and/or platform. - }; - - enum - { - kPC_IA64, - kPC_ARM, - kMACS_64x0, - kMACS_32x0, - }; -} - -#endif // HCORE_TIB_HXX diff --git a/Public/SDK/SystemKit/ThreadAPI.hxx b/Public/SDK/SystemKit/ThreadAPI.hxx new file mode 100644 index 00000000..f99da698 --- /dev/null +++ b/Public/SDK/SystemKit/ThreadAPI.hxx @@ -0,0 +1,42 @@ +/* + * ======================================================== + * + * h-core + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +// +// Created by Amlal on 1/27/24. +// + +#ifndef __THREAD_API__ +#define __THREAD_API__ + +#include <NewKit/Defines.hpp> + +namespace hCore +{ +/// @brief Thread Information Block for Local Storage. +/// Located in GS on AMD64, Virtual Address 0x10000 (64x0, 32x0, ARM64) +struct ThreadInformationBlock final +{ + const Char TIB_NAME[255]; // Module Name + const UIntPtr TIB_START; // Start Address + const UIntPtr TIB_ALLOC; // Allocation Heap + const UIntPtr TIB_STACK; // Stack Pointer. + const Int32 TIB_ARCH; // Architecture and/or platform. +}; + +enum +{ + kPC_IA64, + kPC_AMD64 = kPC_IA64, + kPC_ARM, + kMACS_64x0, + kMACS_32x0, +}; +} // namespace hCore + +#endif // __THREAD_API__ |
