summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/KernelKit
diff options
context:
space:
mode:
Diffstat (limited to 'dev/kernel/KernelKit')
-rw-r--r--dev/kernel/KernelKit/FileMgr.h11
-rw-r--r--dev/kernel/KernelKit/HardwareThreadScheduler.h1
-rw-r--r--dev/kernel/KernelKit/HeapMgr.h (renamed from dev/kernel/KernelKit/MemoryMgr.h)26
-rw-r--r--dev/kernel/KernelKit/HeapMgr.inl35
-rw-r--r--dev/kernel/KernelKit/Zxd.h37
5 files changed, 81 insertions, 29 deletions
diff --git a/dev/kernel/KernelKit/FileMgr.h b/dev/kernel/KernelKit/FileMgr.h
index 86354d7f..21b8b96e 100644
--- a/dev/kernel/KernelKit/FileMgr.h
+++ b/dev/kernel/KernelKit/FileMgr.h
@@ -28,8 +28,8 @@
#include <CompilerKit/CompilerKit.h>
#include <KernelKit/DebugOutput.h>
+#include <KernelKit/HeapMgr.h>
#include <KernelKit/KPC.h>
-#include <KernelKit/MemoryMgr.h>
#include <NeKit/ErrorOr.h>
#include <NeKit/Ref.h>
#include <NeKit/Stream.h>
@@ -324,7 +324,7 @@ class FileStream final {
Char* MIME() noexcept { return const_cast<Char*>(fMime); }
enum {
- kFileMgrRestrictRead,
+ kFileMgrRestrictRead = 100,
kFileMgrRestrictReadBinary,
kFileMgrRestrictWrite,
kFileMgrRestrictWriteBinary,
@@ -338,7 +338,8 @@ class FileStream final {
const Char* fMime{kFileMimeGeneric};
};
-using FileStreamUTF8 = FileStream<Char>;
+using FileStreamASCII = FileStream<Char>;
+using FileStreamUTF8 = FileStream<Utf8Char>;
using FileStreamUTF16 = FileStream<WideChar>;
typedef UInt64 CursorType;
@@ -346,7 +347,7 @@ typedef UInt64 CursorType;
inline static const auto kRestrictStrLen = 8U;
/// @brief restrict information about the file descriptor.
-struct FileRestrictKind final {
+struct FILEMGR_RESTRICT final {
Char fRestrict[kRestrictStrLen];
Int32 fMappedTo;
};
@@ -356,7 +357,7 @@ template <typename Encoding, typename Class>
inline FileStream<Encoding, Class>::FileStream(const Encoding* path, const Encoding* restrict_type)
: fFile(Class::GetMounted()->Open(path, restrict_type)) {
SizeT kRestrictCount = kRestrictMax;
- const FileRestrictKind kRestrictList[] = {{
+ const FILEMGR_RESTRICT kRestrictList[] = {{
.fRestrict = kRestrictR,
.fMappedTo = kFileMgrRestrictRead,
},
diff --git a/dev/kernel/KernelKit/HardwareThreadScheduler.h b/dev/kernel/KernelKit/HardwareThreadScheduler.h
index a10d3a9e..76327a93 100644
--- a/dev/kernel/KernelKit/HardwareThreadScheduler.h
+++ b/dev/kernel/KernelKit/HardwareThreadScheduler.h
@@ -71,7 +71,6 @@ class HardwareThread final {
HAL::StackFramePtr fStack{nullptr};
ThreadKind fKind{ThreadKind::kAPStandard};
ThreadID fID{0};
- ThreadID fPID{0};
Bool fWakeup{NO};
Bool fBusy{NO};
UInt64 fPTime{0};
diff --git a/dev/kernel/KernelKit/MemoryMgr.h b/dev/kernel/KernelKit/HeapMgr.h
index 7ca7da90..3271dd03 100644
--- a/dev/kernel/KernelKit/MemoryMgr.h
+++ b/dev/kernel/KernelKit/HeapMgr.h
@@ -8,7 +8,7 @@
#define INC_KERNEL_HEAP_H
/// @date 30/01/24
-/// @file: MemoryMgr.h
+/// @file: HeapMgr.h
/// @brief: Memory allocation support for the NeKernel.
#include <KernelKit/KPC.h>
@@ -51,28 +51,8 @@ Int32 mm_make_ptr_flags(VoidPtr heap_ptr, UInt64 flags);
/// @brief Gets the flags of a heap header.
/// @param heap_ptr the pointer to get.
UInt64 mm_get_ptr_flags(VoidPtr heap_ptr);
-
-/// @brief Allocate C++ class.
-/// @param cls The class to allocate.
-/// @param args The args to pass.
-template <typename T, typename... Args>
-inline BOOL mm_new_class(_Input _Output T** cls, _Input Args&&... args) {
- if (*cls) {
- err_global_get() = Kernel::kErrorInvalidData;
- return NO;
- }
-
- *cls = new T(move(args)...);
- return *cls;
-}
-
-/// @brief Delete and nullify C++ class.
-/// @param cls The class to delete.
-template <typename T>
-inline Void mm_delete_class(_Input _Output T** cls) {
- delete *cls;
- *cls = nullptr;
-}
} // namespace Kernel
+#include <KernelKit/HeapMgr.inl>
+
#endif // !INC_KERNEL_HEAP_H
diff --git a/dev/kernel/KernelKit/HeapMgr.inl b/dev/kernel/KernelKit/HeapMgr.inl
new file mode 100644
index 00000000..6371012e
--- /dev/null
+++ b/dev/kernel/KernelKit/HeapMgr.inl
@@ -0,0 +1,35 @@
+/* -------------------------------------------
+
+ Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#pragma once
+
+#ifndef INC_KERNEL_HEAP_H
+#include <KernelKit/HeapMgr.h>
+#endif // !INC_KERNEL_HEAP_H
+
+namespace Kernel {
+/// @brief Allocate C++ class.
+/// @param cls The class to allocate.
+/// @param args The args to pass.
+template <typename T, typename... Args>
+inline BOOL mm_new_class(_Input _Output T** cls, _Input Args&&... args) {
+ if (*cls) {
+ err_global_get() = Kernel::kErrorInvalidData;
+ return NO;
+ }
+
+ *cls = new T(move(args)...);
+ return *cls;
+}
+
+/// @brief Delete and nullify C++ class.
+/// @param cls The class to delete.
+template <typename T>
+inline Void mm_delete_class(_Input _Output T** cls) {
+ delete *cls;
+ *cls = nullptr;
+}
+} // namespace Kernel \ No newline at end of file
diff --git a/dev/kernel/KernelKit/Zxd.h b/dev/kernel/KernelKit/Zxd.h
new file mode 100644
index 00000000..d2456f51
--- /dev/null
+++ b/dev/kernel/KernelKit/Zxd.h
@@ -0,0 +1,37 @@
+/* -------------------------------------------
+
+ Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <NeKit/Defines.h>
+
+namespace ZXD {
+using namespace Kernel;
+
+struct ZXD_EXEC_HEADER;
+struct ZXD_STUB_HEADER;
+
+/// @brief ZXD executable header
+/// @details This header is used to identify ZXD executable files.
+struct ZXD_EXEC_HEADER {
+ UInt32 fMagic;
+ UInt32 fVersion;
+ UInt32 fFlags;
+ UInt32 fHdrSize;
+ UInt32 fCRC32;
+ UInt32 fAssigneeSignature;
+ UInt32 fIssuerSingature;
+};
+
+/// @brief ZXD stub header
+/// @details This header is used to identify ZXD stub files. It contains the size of the stub, the
+/// offset of the stub, and the CRC32 checksum of the stub.
+struct ZXD_STUB_HEADER : public ZXD_EXEC_HEADER {
+ UInt32 fStubSize;
+ UInt32 fStubOffset;
+ UInt32 fStubCRC32;
+};
+} // namespace ZXD \ No newline at end of file