summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-03-05 08:48:23 +0000
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-03-05 08:48:23 +0000
commit1dc32533305adc40af5683792b74f6074a41fd32 (patch)
treecba9842f4c8acd25ddd4c66eed734b5e39267658
parent64c8674bc09985fcf7119cfb2b88cad3081b1603 (diff)
Kernel: Add ProcessManager.cxx, wrap packed UPP into compiler independent code.
-rw-r--r--Private/KernelKit/MSDOS.hpp3
-rw-r--r--Private/KernelKit/PE.hpp4
-rw-r--r--Private/KernelKit/PEFCodeManager.hxx4
-rw-r--r--Private/Root/Boot/.gitkeep0
-rw-r--r--Private/Root/Programs/.gitkeep0
-rw-r--r--Private/Source/PEFCodeManager.cxx2
-rw-r--r--Private/Source/ProcessManager.cxx10
-rw-r--r--Private/Source/ProcessTeam.cxx15
-rw-r--r--Public/Kits/HCoreKit/kernel.h27
-rw-r--r--Public/Kits/ObjC/base_api.h11
-rw-r--r--Public/Kits/ObjC/base_object.h20
11 files changed, 86 insertions, 10 deletions
diff --git a/Private/KernelKit/MSDOS.hpp b/Private/KernelKit/MSDOS.hpp
index 565d77af..aa7f9b8c 100644
--- a/Private/KernelKit/MSDOS.hpp
+++ b/Private/KernelKit/MSDOS.hpp
@@ -20,6 +20,9 @@
// Last Rev
// Sat Feb 24 CET 2024
+#define kMagMz0 'M'
+#define kMagMz1 'Z'
+
typedef HCore::UInt32 DosWord;
typedef HCore::Long DosLong;
diff --git a/Private/KernelKit/PE.hpp b/Private/KernelKit/PE.hpp
index 43de19e0..c9e4e19c 100644
--- a/Private/KernelKit/PE.hpp
+++ b/Private/KernelKit/PE.hpp
@@ -15,6 +15,7 @@
#define __PE__
#include <NewKit/Defines.hpp>
+#include <KernelKit/PE.hpp>
typedef HCore::UIntPtr U64;
typedef HCore::UInt32 U32;
@@ -22,9 +23,6 @@ typedef HCore::UInt16 U16;
typedef HCore::UInt8 U8;
typedef U8 BYTE;
-#define kMagMz0 'M'
-#define kMagMz1 'Z'
-
#define kPeMagic 0x00004550
typedef struct ExecHeader final {
diff --git a/Private/KernelKit/PEFCodeManager.hxx b/Private/KernelKit/PEFCodeManager.hxx
index 8577acb3..a4bc08eb 100644
--- a/Private/KernelKit/PEFCodeManager.hxx
+++ b/Private/KernelKit/PEFCodeManager.hxx
@@ -11,6 +11,8 @@
#include <NewKit/ErrorOr.hpp>
#include <NewKit/String.hpp>
+#define kPefApplicationMime "application/x-hcore-exec"
+
namespace HCore {
///
/// \name PEFLoader
@@ -58,7 +60,7 @@ typedef struct UniversalProcedureTable final {
const Char NAME[kPefNameLen];
const VoidPtr TRAP;
const SizeT ARCH;
-} __attribute__((packed)) UniversalProcedureTableType;
+} PACKED UniversalProcedureTableType;
bool execute_from_image(PEFLoader &exec) noexcept;
} // namespace Utils
diff --git a/Private/Root/Boot/.gitkeep b/Private/Root/Boot/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Private/Root/Boot/.gitkeep
diff --git a/Private/Root/Programs/.gitkeep b/Private/Root/Programs/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Private/Root/Programs/.gitkeep
diff --git a/Private/Source/PEFCodeManager.cxx b/Private/Source/PEFCodeManager.cxx
index e6296a2b..572b90b3 100644
--- a/Private/Source/PEFCodeManager.cxx
+++ b/Private/Source/PEFCodeManager.cxx
@@ -152,5 +152,5 @@ const char *PEFLoader::Path() { return fPath.Leak().CData(); }
const char *PEFLoader::Format() { return "PEF"; }
-const char *PEFLoader::MIME() { return "application/x-hcore-exec"; }
+const char *PEFLoader::MIME() { return kPefApplicationMime; }
} // namespace HCore
diff --git a/Private/Source/ProcessManager.cxx b/Private/Source/ProcessManager.cxx
index 20f60c4f..37293aa5 100644
--- a/Private/Source/ProcessManager.cxx
+++ b/Private/Source/ProcessManager.cxx
@@ -251,7 +251,7 @@ bool ProcessHelper::CanBeScheduled(Ref<Process> &process) {
}
/**
- * @brief Spin scheduler
+ * @brief Spin scheduler class.
*/
bool ProcessHelper::StartScheduling() {
if (ProcessHelper::CanBeScheduled(
@@ -260,15 +260,15 @@ bool ProcessHelper::StartScheduling() {
return false;
}
- auto process_ref = ProcessManager::Shared().Leak();
+ auto processRef = ProcessManager::Shared().Leak();
- if (!process_ref)
+ if (!processRef)
return false; // we have nothing to schedule. simply return.
- SizeT ret = process_ref.Run();
+ SizeT ret = processRef.Run();
kcout << StringBuilder::FromInt(
- "ProcessHelper::StartScheduling() Iterated over: % processes.\r\n", ret);
+ "ProcessHelper::StartScheduling() Iterated over: {%} processes.\r\n", ret);
return true;
}
diff --git a/Private/Source/ProcessTeam.cxx b/Private/Source/ProcessTeam.cxx
new file mode 100644
index 00000000..678f5fce
--- /dev/null
+++ b/Private/Source/ProcessTeam.cxx
@@ -0,0 +1,15 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+/***********************************************************************************/
+/// @file ProcessTeam.cxx
+/// @brief Process Team API.
+/***********************************************************************************/
+
+#include <KernelKit/ProcessManager.hpp>
+#include <KernelKit/SMPManager.hpp>
+
+// last rev 05-03-24 \ No newline at end of file
diff --git a/Public/Kits/HCoreKit/kernel.h b/Public/Kits/HCoreKit/kernel.h
new file mode 100644
index 00000000..15b3fad6
--- /dev/null
+++ b/Public/Kits/HCoreKit/kernel.h
@@ -0,0 +1,27 @@
+/**
+* The HCore Kit
+* Copyright Mahrouss Logic
+* File: HKernel.h
+* Purpose: Base HCore header
+*/
+
+#pragma once
+
+/* process id */
+typedef long rt_kernel_port;
+
+/* @brief scheduling team */
+typedef long rt_kernel_team;
+
+/* virtual memory key */
+typedef long long int rt_virt_mem_t;
+
+/// override previous vm size if any.
+
+#ifdef kVirtualMemorySize
+// do not edit this! if you want to avoid your program crashing.
+#undef kVirtualMemorySize
+#endif /* ifdef kVirtualMemorySize */
+
+/// 4 megs of additional memory.
+#define kVirtualMemorySize 4096U
diff --git a/Public/Kits/ObjC/base_api.h b/Public/Kits/ObjC/base_api.h
new file mode 100644
index 00000000..861998d4
--- /dev/null
+++ b/Public/Kits/ObjC/base_api.h
@@ -0,0 +1,11 @@
+/**
+* The HCore Kit
+* Copyright Mahrouss Logic
+* File: HBase.h
+* Purpose: Base HCore header
+*/
+
+#import <HCoreKit/kernel.h>
+
+typedef char8_t HCUtf8Raw;
+typedef HCUtf8Raw* HCUtf8RawPtr;
diff --git a/Public/Kits/ObjC/base_object.h b/Public/Kits/ObjC/base_object.h
new file mode 100644
index 00000000..783f5eb2
--- /dev/null
+++ b/Public/Kits/ObjC/base_object.h
@@ -0,0 +1,20 @@
+/**
+* The HCore Kit
+* Copyright Mahrouss Logic
+* File: HCObject.h
+* Purpose: Base HCore object
+*/
+
+/// HCUtf8Raw, HCUtf8RawPtr, kVirtualMemorySize, rt_kernel_port, rt_kernel_team
+#import <HCoreKit/base_api.h>
+
+/// @brief Base HCore object
+/// @version 1.0
+
+@interface HCObject {
+ HCUtf8RawPtr fClsName;
+}
+
+-(id) init;
+-(HCUtf8RawPtr) toString;
+@end // interface HCObject \ No newline at end of file