summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-30 18:06:17 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-30 18:06:17 +0200
commit01fb3ca21dd5846ecd7e4e94571ede5a5264d9a6 (patch)
tree60201d088bb2c1cc12777611b15c2708bf71787b
parent579d076015eece5961b1034979ade2be09c6bfcd (diff)
[SMP] WiP impelementation of SMP inside the HAL.
- Doing R&D on SMP on AMD64, - Working on a first application. Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
-rw-r--r--Boot/BootKit/STB.hxx6
-rw-r--r--Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx37
-rw-r--r--Kernel/HALKit/AMD64/HalInterruptAPI.asm10
-rw-r--r--Kernel/HALKit/AMD64/HalKernelMain.cxx2
-rw-r--r--Kernel/HALKit/AMD64/HalRoutines.s1
-rw-r--r--Kernel/HALKit/AMD64/HalUtils.asm32
-rw-r--r--Kernel/KernelKit/Defines.hpp4
-rw-r--r--Kernel/KernelKit/Heap.hxx10
-rw-r--r--Kernel/KernelKit/LoaderInterface.hpp2
-rw-r--r--Kernel/KernelKit/MPManager.hpp10
-rw-r--r--Kernel/KernelKit/PEFCodeManager.hxx2
-rw-r--r--Kernel/Sources/Heap.cxx58
-rw-r--r--Kernel/Sources/Main.cxx3
-rw-r--r--Kernel/Sources/New+Delete.cxx10
-rw-r--r--Kernel/Sources/PEFCodeManager.cxx22
-rw-r--r--Kernel/Sources/ProcessScheduler.cxx6
-rw-r--r--Meta/OS-Design.drawio42
-rw-r--r--Meta/OS-Timer-Architecture.drawio92
-rw-r--r--SCIKit/SharedInterface1.hxx4
-rw-r--r--SCIKit/Types.hxx21
20 files changed, 164 insertions, 210 deletions
diff --git a/Boot/BootKit/STB.hxx b/Boot/BootKit/STB.hxx
index e99edc36..8c8f9b92 100644
--- a/Boot/BootKit/STB.hxx
+++ b/Boot/BootKit/STB.hxx
@@ -17,9 +17,9 @@
#define STBI_ONLY_GIF 1
#define STBI_ASSERT(x) MUST_PASS(x)
-#define STBI_MALLOC(x) Kernel::ke_new_ke_heap(x, true, true)
-#define STBI_REALLOC(p, x) Kernel::ke_realloc_ke_heap(p, x);
-#define STBI_FREE(x) Kernel::ke_delete_ke_heap(x)
+#define STBI_MALLOC(x) Kernel::mm_new_ke_heap(x, true, true)
+#define STBI_REALLOC(p, x) Kernel::mm_realloc_ke_heap(p, x);
+#define STBI_FREE(x) Kernel::mm_delete_ke_heap(x)
#define STB_IMAGE_IMPLEMENTATION 1
#include <KernelKit/Heap.hxx>
diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
index 48d737fe..0557afac 100644
--- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
+++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
@@ -67,13 +67,13 @@ namespace Kernel::HAL
/// @brief Multiple APIC Descriptor Table.
struct MadtType final : public SDT
{
+ UInt32 Address;
+ UInt32 Flags; // 1 = Dual Legacy PICs installed
+
struct MadtAddress final
{
Char RecordType;
Char RecordLen; // record length
-
- UInt32 Address;
- UInt32 Flags; // 1 = Dual Legacy PICs installed
} MadtRecords[];
};
@@ -120,13 +120,8 @@ namespace Kernel::HAL
STATIC MadtType* kApicInfoBlock = nullptr;
- STATIC struct
- {
- UIntPtr fAddress{0};
- UInt32 fKind{0};
- } kApicMadtAddresses[255] = {};
-
- STATIC SizeT kApicMadtAddressesCount = 0UL;
+ EXTERN_C SizeT kApicMadtAddressesCount = 0UL;
+ EXTERN_C SizeT cBspDone = 0UL;
enum
{
@@ -170,9 +165,12 @@ namespace Kernel::HAL
}
/// @internal
- EXTERN_C Void hal_apic_acknowledge(Void)
+ EXTERN_C Void hal_ap_startup(Void)
{
- kcout << "newoskrnl: acknowledge APIC.\r";
+ while (Yes)
+ {
+
+ }
}
/// @internal
@@ -216,6 +214,8 @@ namespace Kernel::HAL
return (eax & 0xfffff000) | ((UIntPtr)(edx & 0x0f) << 32);
}
+ EXTERN_C Void hal_ap_trampoline(Void);
+
/// @brief Fetch and enable cores inside main CPU.
/// @param rsdPtr RSD PTR structure.
Void hal_system_get_cores(voidPtr rsdPtr)
@@ -225,16 +225,15 @@ namespace Kernel::HAL
if (kApicMadt != nullptr)
{
- MadtType* madt = reinterpret_cast<MadtType*>(kApicMadt);
-
- cpu_set_apic_base(cpu_get_apic_base());
+ UInt8 bsp_id, bsp_done = No;
- // set SVR register to bit 8 to start recieve interrupts.
+ UInt32 num_cores = 4;
+ UInt32* local_apic_ptr = nullptr;
+ UInt32* local_apic_ids[255] = {0};
- auto flagsSet = Kernel::ke_dma_read(cAPICAddress, 0xF0); // SVR register.
- flagsSet |= 0x100;
+ MadtType* type = (MadtType*)kApicMadt;
- Kernel::ke_dma_write(cAPICAddress, 0xF0, flagsSet | 0x100);
+ local_apic_ptr = (UInt32*)type->Address;
}
else
{
diff --git a/Kernel/HALKit/AMD64/HalInterruptAPI.asm b/Kernel/HALKit/AMD64/HalInterruptAPI.asm
index c09d5a06..b7cddea8 100644
--- a/Kernel/HALKit/AMD64/HalInterruptAPI.asm
+++ b/Kernel/HALKit/AMD64/HalInterruptAPI.asm
@@ -119,16 +119,8 @@ IntExp 30
IntNormal 31
-[extern hal_apic_acknowledge]
-
-__NEW_INT_34:
- push rax
- call hal_apic_acknowledge
- pop rax
-
- iretq
-
IntNormal 32
+IntNormal 34
IntNormal 33
IntNormal 35
diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx
index a4067c84..4a6fa302 100644
--- a/Kernel/HALKit/AMD64/HalKernelMain.cxx
+++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx
@@ -216,7 +216,7 @@ EXTERN_C void hal_init_platform(
kSyscalls[cRebootInterrupt].Leak().Leak()->fHooked = true;
kSyscalls[cLPCSanitizeMsg].Leak().Leak()->fHooked = true;
- // newoskrnl version 1.00
+ // newoskrnl version 1.00.
Kernel::StringView strVer(cMaxPropLen);
strVer += "\\Properties\\KernelVersion";
diff --git a/Kernel/HALKit/AMD64/HalRoutines.s b/Kernel/HALKit/AMD64/HalRoutines.s
index e4944111..321ad3d3 100644
--- a/Kernel/HALKit/AMD64/HalRoutines.s
+++ b/Kernel/HALKit/AMD64/HalRoutines.s
@@ -2,6 +2,7 @@
.globl hal_load_gdt
.globl rt_wait_400ns
.globl rt_get_current_context
+.globl hal_ap_trampoline
.section .text
rt_wait_400ns:
diff --git a/Kernel/HALKit/AMD64/HalUtils.asm b/Kernel/HALKit/AMD64/HalUtils.asm
index 6681a692..86d9983e 100644
--- a/Kernel/HALKit/AMD64/HalUtils.asm
+++ b/Kernel/HALKit/AMD64/HalUtils.asm
@@ -23,27 +23,11 @@ rt_install_tib:
;; //////////////////////////////////////////////////// ;;
-[global rt_jump_user_mode]
-
-;; @used rcx, address to jump on.
-;; @note adjusted for long mode.
-rt_jump_user_mode:
- cmp rcx, 0
- je rt_jump_user_mode_failed
-
- mov ax, (6 * 8) | 3 ; user data segment with RPL 3
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax ; SS is handled by iret
-
- mov rax, rsp
- push (6 * 8) | 3
- push rax
- pushf
- push (5 * 8) | 3 ; user code segment with RPL 3
- push rcx
- iretq
- ;; we just failed to validate the rcx, fallback and return to previous pc.
-rt_jump_user_mode_failed:
- ret \ No newline at end of file
+[extern cBspDone]
+[extern kApicMadtAddressesCount]
+[extern hal_ap_startup]
+[global hal_ap_trampoline]
+
+hal_ap_trampoline:
+hal_ap_trampoline_1:
+ jmp hal_ap_startup
diff --git a/Kernel/KernelKit/Defines.hpp b/Kernel/KernelKit/Defines.hpp
index 32f67f10..191d1098 100644
--- a/Kernel/KernelKit/Defines.hpp
+++ b/Kernel/KernelKit/Defines.hpp
@@ -8,5 +8,5 @@
#include <NewKit/Defines.hpp>
-#define KERNELKIT_VERSION "1.01"
-#define KERNELKIT_RELEASE "Cairo"
+#define KERNELKIT_VERSION "1.02"
+#define KERNELKIT_RELEASE "Alexandria"
diff --git a/Kernel/KernelKit/Heap.hxx b/Kernel/KernelKit/Heap.hxx
index 0f673ffb..1ed029cd 100644
--- a/Kernel/KernelKit/Heap.hxx
+++ b/Kernel/KernelKit/Heap.hxx
@@ -18,12 +18,12 @@ namespace Kernel
/// @brief Declare pointer as free.
/// @param allocatedPtr the pointer.
/// @return
- Int32 ke_delete_ke_heap(voidPtr allocatedPtr);
+ Int32 mm_delete_ke_heap(voidPtr allocatedPtr);
/// @brief Declare a new size for allocatedPtr.
/// @param allocatedPtr the pointer.
/// @return
- voidPtr ke_realloc_ke_heap(voidPtr allocatedPtr, SizeT newSz);
+ voidPtr mm_realloc_ke_heap(voidPtr allocatedPtr, SizeT newSz);
/// @brief Check if pointer is a valid kernel pointer.
/// @param allocatedPtr the pointer
@@ -35,17 +35,17 @@ namespace Kernel
/// @param rw read write (true to enable it)
/// @param user is it accesible by user processes?
/// @return the pointer
- voidPtr ke_new_ke_heap(const SizeT sz, const Bool rw, const Bool user);
+ voidPtr mm_new_ke_heap(const SizeT sz, const Bool rw, const Bool user);
/// @brief Protect the heap with a CRC value.
/// @param allocatedPtr pointer.
/// @return if it valid: point has crc now., otherwise fail.
- Boolean ke_protect_ke_heap(VoidPtr allocatedPtr);
+ Boolean mm_protect_ke_heap(VoidPtr allocatedPtr);
/// @brief Makes a kernel heap page.
/// @param allocatedPtr the page pointer.
/// @return
- Int32 ke_make_ke_page(VoidPtr allocatedPtr);
+ Int32 mm_make_ke_page(VoidPtr allocatedPtr);
} // namespace Kernel
#endif // !_INC_KERNEL_HEAP_HXX_
diff --git a/Kernel/KernelKit/LoaderInterface.hpp b/Kernel/KernelKit/LoaderInterface.hpp
index a6b54d8b..e49e0085 100644
--- a/Kernel/KernelKit/LoaderInterface.hpp
+++ b/Kernel/KernelKit/LoaderInterface.hpp
@@ -24,7 +24,7 @@ namespace Kernel
NEWOS_COPY_DEFAULT(LoaderInterface);
public:
- virtual _Output const char* FormatAsString() = 0;
+ virtual _Output const char* AsString() = 0;
virtual _Output const char* MIME() = 0;
virtual _Output const char* Path() = 0;
virtual _Output ErrorOr<VoidPtr> FindStart() = 0;
diff --git a/Kernel/KernelKit/MPManager.hpp b/Kernel/KernelKit/MPManager.hpp
index 6f23dd66..ccd1af37 100644
--- a/Kernel/KernelKit/MPManager.hpp
+++ b/Kernel/KernelKit/MPManager.hpp
@@ -66,11 +66,11 @@ namespace Kernel
private:
HAL::StackFrame* fStack{nullptr};
- ThreadKind fKind;
- ThreadID fID;
- ProcessID fSourcePID;
- bool fWakeup;
- bool fBusy;
+ ThreadKind fKind{ThreadKind::kInvalidHart};
+ ThreadID fID{0};
+ ProcessID fSourcePID{-1};
+ bool fWakeup{false};
+ bool fBusy{false};
private:
friend class MPManager;
diff --git a/Kernel/KernelKit/PEFCodeManager.hxx b/Kernel/KernelKit/PEFCodeManager.hxx
index 5e48331a..7f06e5ad 100644
--- a/Kernel/KernelKit/PEFCodeManager.hxx
+++ b/Kernel/KernelKit/PEFCodeManager.hxx
@@ -35,7 +35,7 @@ namespace Kernel
public:
const char* Path() override;
- const char* FormatAsString() override;
+ const char* AsString() override;
const char* MIME() override;
public:
diff --git a/Kernel/Sources/Heap.cxx b/Kernel/Sources/Heap.cxx
index b2acaffe..25a77d6b 100644
--- a/Kernel/Sources/Heap.cxx
+++ b/Kernel/Sources/Heap.cxx
@@ -21,12 +21,12 @@ namespace Kernel
STATIC SizeT kHeapCount = 0UL;
STATIC PageManager kHeapPageManager;
- namespace Detail
+ namespace Details
{
/// @brief Kernel heap information block.
/// Located before the address bytes.
/// | HIB | ADDRESS |
- struct PACKED HeapInformationBlock final
+ struct PACKED HEAP_INFORMATION_BLOCK final
{
///! @brief 32-bit value which contains the magic number of the executable.
UInt32 fMagic;
@@ -44,26 +44,26 @@ namespace Kernel
UInt8 fPadding[kKernelHeapHeaderPaddingSz];
};
- typedef HeapInformationBlock* HeapInformationBlockPtr;
+ typedef HEAP_INFORMATION_BLOCK* HEAP_INFORMATION_BLOCK_PTR;
} // namespace Detail
/// @brief Declare a new size for allocatedPtr.
/// @param allocatedPtr the pointer.
/// @return
- voidPtr ke_realloc_ke_heap(voidPtr allocatedPtr, SizeT newSz)
+ voidPtr mm_realloc_ke_heap(voidPtr allocatedPtr, SizeT newSz)
{
if (!allocatedPtr || newSz < 1)
return nullptr;
- Detail::HeapInformationBlockPtr heapInfoBlk =
- reinterpret_cast<Detail::HeapInformationBlockPtr>(
- (UIntPtr)allocatedPtr - sizeof(Detail::HeapInformationBlock));
+ Details::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk =
+ reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>(
+ (UIntPtr)allocatedPtr - sizeof(Details::HEAP_INFORMATION_BLOCK));
heapInfoBlk->fTargetPtrSize = newSz;
if (heapInfoBlk->fCRC32 > 0)
{
- MUST_PASS(ke_protect_ke_heap(allocatedPtr));
+ MUST_PASS(mm_protect_ke_heap(allocatedPtr));
}
return allocatedPtr;
@@ -74,7 +74,7 @@ namespace Kernel
/// @param rw read write (true to enable it)
/// @param user is it accesible by user processes?
/// @return the pointer
- VoidPtr ke_new_ke_heap(const SizeT sz, const bool rw, const bool user)
+ VoidPtr mm_new_ke_heap(const SizeT sz, const bool rw, const bool user)
{
auto szFix = sz;
@@ -83,8 +83,8 @@ namespace Kernel
auto wrapper = kHeapPageManager.Request(rw, user, false, szFix);
- Detail::HeapInformationBlockPtr heapInfo =
- reinterpret_cast<Detail::HeapInformationBlockPtr>(
+ Details::HEAP_INFORMATION_BLOCK_PTR heapInfo =
+ reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>(
wrapper.VirtualAddress());
heapInfo->fTargetPtrSize = szFix;
@@ -96,24 +96,24 @@ namespace Kernel
++kHeapCount;
return reinterpret_cast<VoidPtr>(wrapper.VirtualAddress() +
- sizeof(Detail::HeapInformationBlock));
+ sizeof(Details::HEAP_INFORMATION_BLOCK));
}
/// @brief Makes a page heap.
/// @param heapPtr
/// @return
- Int32 ke_make_ke_page(VoidPtr heapPtr)
+ Int32 mm_make_ke_page(VoidPtr heapPtr)
{
if (kHeapCount < 1)
return -kErrorInternal;
- if (((IntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)) <= 0)
+ if (((IntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK)) <= 0)
return -kErrorInternal;
if (((IntPtr)heapPtr - kBadPtr) < 0)
return -kErrorInternal;
- Detail::HeapInformationBlockPtr heapInfoBlk =
- reinterpret_cast<Detail::HeapInformationBlockPtr>(
- (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock));
+ Details::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk =
+ reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>(
+ (UIntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK));
heapInfoBlk->fPagePtr = 1;
@@ -123,18 +123,18 @@ namespace Kernel
/// @brief Declare pointer as free.
/// @param heapPtr the pointer.
/// @return
- Int32 ke_delete_ke_heap(VoidPtr heapPtr)
+ Int32 mm_delete_ke_heap(VoidPtr heapPtr)
{
if (kHeapCount < 1)
return -kErrorInternal;
- if (((IntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)) <= 0)
+ if (((IntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK)) <= 0)
return -kErrorInternal;
if (((IntPtr)heapPtr - kBadPtr) < 0)
return -kErrorInternal;
- Detail::HeapInformationBlockPtr heapInfoBlk =
- reinterpret_cast<Detail::HeapInformationBlockPtr>(
- (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock));
+ Details::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk =
+ reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>(
+ (UIntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK));
if (heapInfoBlk && heapInfoBlk->fMagic == kKernelHeapMagic)
{
@@ -181,9 +181,9 @@ namespace Kernel
if (heapPtr)
{
- Detail::HeapInformationBlockPtr virtualAddress =
- reinterpret_cast<Detail::HeapInformationBlockPtr>(
- (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock));
+ Details::HEAP_INFORMATION_BLOCK_PTR virtualAddress =
+ reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>(
+ (UIntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK));
if (virtualAddress->fPresent && virtualAddress->fMagic == kKernelHeapMagic)
{
@@ -197,13 +197,13 @@ namespace Kernel
/// @brief Protect the heap with a CRC value.
/// @param heapPtr HIB pointer.
/// @return if it valid: point has crc now., otherwise fail.
- Boolean ke_protect_ke_heap(VoidPtr heapPtr)
+ Boolean mm_protect_ke_heap(VoidPtr heapPtr)
{
if (heapPtr)
{
- Detail::HeapInformationBlockPtr heapInfoBlk =
- reinterpret_cast<Detail::HeapInformationBlockPtr>(
- (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock));
+ Details::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk =
+ reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>(
+ (UIntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK));
if (heapInfoBlk->fPresent && kKernelHeapMagic == heapInfoBlk->fMagic)
{
diff --git a/Kernel/Sources/Main.cxx b/Kernel/Sources/Main.cxx
index 318cbe3f..79febc15 100644
--- a/Kernel/Sources/Main.cxx
+++ b/Kernel/Sources/Main.cxx
@@ -190,8 +190,7 @@ namespace Kernel::Detail
{
Kernel::UserView::The()->fRootUser = new User(RingKind::kRingSuperUser, kSuperUser);
-
- Kernel::UserView::The()->LogIn(Kernel::UserView::The()->fRootUser, nullptr);
+ Kernel::UserView::The()->LogIn(Kernel::UserView::The()->fRootUser, "");
Kernel::kcout << "newoskrnl: " << cKernelVersion.GetKey().CData() << ": " << Kernel::number(cKernelVersion.GetValue()) << Kernel::endl;
}
diff --git a/Kernel/Sources/New+Delete.cxx b/Kernel/Sources/New+Delete.cxx
index 2921e079..b43fafbc 100644
--- a/Kernel/Sources/New+Delete.cxx
+++ b/Kernel/Sources/New+Delete.cxx
@@ -12,7 +12,7 @@ void* operator new[](size_t sz)
if (sz == 0)
++sz;
- return Kernel::ke_new_ke_heap(sz, true, false);
+ return Kernel::mm_new_ke_heap(sz, true, false);
}
void* operator new(size_t sz)
@@ -20,7 +20,7 @@ void* operator new(size_t sz)
if (sz == 0)
++sz;
- return Kernel::ke_new_ke_heap(sz, true, false);
+ return Kernel::mm_new_ke_heap(sz, true, false);
}
void operator delete[](void* ptr)
@@ -28,7 +28,7 @@ void operator delete[](void* ptr)
if (ptr == nullptr)
return;
- Kernel::ke_delete_ke_heap(ptr);
+ Kernel::mm_delete_ke_heap(ptr);
}
void operator delete(void* ptr)
@@ -36,7 +36,7 @@ void operator delete(void* ptr)
if (ptr == nullptr)
return;
- Kernel::ke_delete_ke_heap(ptr);
+ Kernel::mm_delete_ke_heap(ptr);
}
void operator delete(void* ptr, size_t sz)
@@ -46,5 +46,5 @@ void operator delete(void* ptr, size_t sz)
NEWOS_UNUSED(sz);
- Kernel::ke_delete_ke_heap(ptr);
+ Kernel::mm_delete_ke_heap(ptr);
}
diff --git a/Kernel/Sources/PEFCodeManager.cxx b/Kernel/Sources/PEFCodeManager.cxx
index 8b1918ef..223505b8 100644
--- a/Kernel/Sources/PEFCodeManager.cxx
+++ b/Kernel/Sources/PEFCodeManager.cxx
@@ -85,7 +85,7 @@ namespace Kernel
kcout << "CodeManager: Warning: Executable format error!\n";
fBad = true;
- ke_delete_ke_heap(fCachedBlob);
+ mm_delete_ke_heap(fCachedBlob);
fCachedBlob = nullptr;
}
@@ -95,7 +95,7 @@ namespace Kernel
PEFLoader::~PEFLoader()
{
if (fCachedBlob)
- ke_delete_ke_heap(fCachedBlob);
+ mm_delete_ke_heap(fCachedBlob);
fFile.Delete();
}
@@ -160,7 +160,7 @@ namespace Kernel
{
if (!this->fFatBinary)
{
- ke_delete_ke_heap(blob);
+ mm_delete_ke_heap(blob);
return nullptr;
}
}
@@ -169,13 +169,13 @@ namespace Kernel
rt_copy_memory((VoidPtr)((Char*)blob + sizeof(PEFCommandHeader)), blobRet, container_header->Size);
- ke_delete_ke_heap(blob);
+ mm_delete_ke_heap(blob);
return blobRet;
}
}
}
- ke_delete_ke_heap(blob);
+ mm_delete_ke_heap(blob);
return nullptr;
}
@@ -219,18 +219,18 @@ namespace Kernel
return fPath.Leak().CData();
}
- const char* PEFLoader::FormatAsString()
+ const char* PEFLoader::AsString()
{
#ifdef __32x0__
- return "32x0 PEF.";
+ return "32x0 PEF format.";
#elif defined(__64x0__)
- return "64x0 PEF.";
+ return "64x0 PEF format.";
#elif defined(__x86_64__)
- return "x86_64 PEF.";
+ return "x86_64 PEF format.";
#elif defined(__powerpc64__)
- return "POWER PEF.";
+ return "POWER PEF format.";
#else
- return "Unknown PEF.";
+ return "Unknown PEF format.";
#endif // __32x0__ || __64x0__ || __x86_64__ || __powerpc64__
}
diff --git a/Kernel/Sources/ProcessScheduler.cxx b/Kernel/Sources/ProcessScheduler.cxx
index cccd8979..7002bd1f 100644
--- a/Kernel/Sources/ProcessScheduler.cxx
+++ b/Kernel/Sources/ProcessScheduler.cxx
@@ -185,10 +185,10 @@ namespace Kernel
//! Delete image if not done already.
if (this->Image)
- ke_delete_ke_heap(this->Image);
+ mm_delete_ke_heap(this->Image);
if (this->StackFrame)
- ke_delete_ke_heap((VoidPtr)this->StackFrame);
+ mm_delete_ke_heap((VoidPtr)this->StackFrame);
this->Image = nullptr;
this->StackFrame = nullptr;
@@ -231,7 +231,7 @@ namespace Kernel
}
process.Leak().StackFrame = reinterpret_cast<HAL::StackFrame*>(
- ke_new_ke_heap(sizeof(HAL::StackFrame), true, false));
+ mm_new_ke_heap(sizeof(HAL::StackFrame), true, false));
MUST_PASS(process.Leak().StackFrame);
diff --git a/Meta/OS-Design.drawio b/Meta/OS-Design.drawio
index 539e0bf9..46863670 100644
--- a/Meta/OS-Design.drawio
+++ b/Meta/OS-Design.drawio
@@ -1,47 +1,29 @@
<mxfile host="65bd71144e">
<diagram name="Page-1" id="lDkK2i6CeL2VbSOVDvrP">
- <mxGraphModel dx="746" dy="307" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
+ <mxGraphModel dx="1356" dy="558" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-1" value="DDK Hooks (KCI and SCI routes.)" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxCell id="ifhO3zQZNW-sXvZMTmu8-1" value="DDKit Hooks" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="234" y="450" width="360" height="60" as="geometry"/>
</mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-2" value="SCI" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
- <mxGeometry x="234" y="410" width="360" height="30" as="geometry"/>
+ <mxCell id="ifhO3zQZNW-sXvZMTmu8-2" value="SCIKit and SCM" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="235.5" y="340" width="360" height="30" as="geometry"/>
</mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-3" value="libCoreGraphics/libCoreFoundation" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
- <mxGeometry x="234" y="370" width="360" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-4" value="libCoreApplication" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
- <mxGeometry x="241" y="330" width="136" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-5" value="libCoreMT" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
- <mxGeometry x="387" y="330" width="200" height="30" as="geometry"/>
+ <mxCell id="ifhO3zQZNW-sXvZMTmu8-3" value="FoundationKit, AnimationKit, GraphicsKit" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="235.5" y="295" width="360" height="30" as="geometry"/>
</mxCell>
<mxCell id="ifhO3zQZNW-sXvZMTmu8-8" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;System layer.&lt;/h1&gt;&lt;p&gt;This layer describes the kernel and it's API, which makes the Zeta OS.&lt;/p&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
- <mxGeometry x="620" y="325" width="180" height="120" as="geometry"/>
- </mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-9" value="libCoreHTML" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
- <mxGeometry x="241" y="200" width="136" height="100" as="geometry"/>
- </mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-10" value="libCoreAsync" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
- <mxGeometry x="387" y="200" width="203" height="100" as="geometry"/>
- </mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-11" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;High level layer.&lt;/h1&gt;&lt;p&gt;This contains the launcher, some&lt;/p&gt;&lt;p&gt;APIs (here CoreHTML and CoreAsync.) and apps.&lt;/p&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
- <mxGeometry x="620" y="140" width="180" height="140" as="geometry"/>
- </mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-12" value="UI" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
- <mxGeometry x="241" y="130" width="349" height="60" as="geometry"/>
+ <mxGeometry x="610" y="440" width="180" height="120" as="geometry"/>
</mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-13" value="Kernel" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxCell id="ifhO3zQZNW-sXvZMTmu8-13" value="NewOS MP Kernel" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="235.5" y="520" width="360" height="60" as="geometry"/>
</mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-14" value="New OS" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
- <mxGeometry x="241" y="70" width="60" height="30" as="geometry"/>
+ <mxCell id="2" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;User layer&lt;/h1&gt;&lt;div&gt;This layer is located on user space, it is containing all of the users frameworks, SCI and SCM objects.&lt;/div&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" vertex="1" parent="1">
+ <mxGeometry x="610" y="290" width="180" height="120" as="geometry"/>
</mxCell>
- <mxCell id="ifhO3zQZNW-sXvZMTmu8-15" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Application&lt;/span&gt;&lt;/h1&gt;&lt;div&gt;Each app is organized so:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;/*.exe&lt;/div&gt;&lt;div&gt;/NewOS/&lt;/div&gt;&lt;div&gt;/NewOS/Libraries/lib*&lt;/div&gt;&lt;div&gt;/NewOS/Manifests/*.alist&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;*.exe must match the MLExecutable field, and be a PEF executable.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;App.alist is mandatory on apps.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;An New OS is simply a directory&lt;/div&gt;&lt;div&gt;with the .app extension.&lt;/div&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
- <mxGeometry x="10" y="130" width="180" height="240" as="geometry"/>
+ <mxCell id="3" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;NewOS&lt;/h1&gt;&lt;div&gt;NewOS is an interesting piece&lt;/div&gt;&lt;div&gt;of engineering, designed to be mutli-user and multi tasked, it perfectly suits that need. And gives a neat API to work on.&lt;/div&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" vertex="1" parent="1">
+ <mxGeometry x="90" y="80" width="180" height="130" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
diff --git a/Meta/OS-Timer-Architecture.drawio b/Meta/OS-Timer-Architecture.drawio
index 9b5a9a88..2fdeded6 100644
--- a/Meta/OS-Timer-Architecture.drawio
+++ b/Meta/OS-Timer-Architecture.drawio
@@ -1,46 +1,46 @@
-<mxfile host="app.diagrams.net" modified="2024-07-07T08:32:41.621Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" etag="UqJl_3VXuitRxImxFo5W" version="24.6.2" type="device">
- <diagram name="Page-1" id="SMmOiZGLec9H7ruN5qyQ">
- <mxGraphModel dx="1400" dy="743" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
- <root>
- <mxCell id="0" />
- <mxCell id="1" parent="0" />
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-1" target="c-_7pHU60HQ0aR4bwu-4-2">
- <mxGeometry relative="1" as="geometry" />
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-1" target="c-_7pHU60HQ0aR4bwu-4-4">
- <mxGeometry relative="1" as="geometry" />
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-1" target="c-_7pHU60HQ0aR4bwu-4-6">
- <mxGeometry relative="1" as="geometry" />
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-1" value="TimeInfoStruct" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="340" y="230" width="120" height="60" as="geometry" />
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-2" value="APIC/PIC/IOAPIC" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="340" y="400" width="120" height="60" as="geometry" />
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-4" value="GT" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="530" y="400" width="120" height="60" as="geometry" />
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-6" value="CLINT" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="150" y="400" width="120" height="60" as="geometry" />
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-8" target="c-_7pHU60HQ0aR4bwu-4-1">
- <mxGeometry relative="1" as="geometry" />
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-8" value="Scheduler context switch (on non MT mode),&lt;br&gt;Also HardwareTimer gets implemented." style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="160" y="60" width="120" height="90" as="geometry" />
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="c-_7pHU60HQ0aR4bwu-4-10">
- <mxGeometry relative="1" as="geometry">
- <mxPoint x="530" y="120" as="sourcePoint" />
- <mxPoint x="430" y="230" as="targetPoint" />
- </mxGeometry>
- </mxCell>
- <mxCell id="c-_7pHU60HQ0aR4bwu-4-10" value="Hook 2 system calls for timing purposes.&lt;br&gt;(Wait, WaitUntil)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="560" y="90" width="120" height="60" as="geometry" />
- </mxCell>
- </root>
- </mxGraphModel>
- </diagram>
-</mxfile>
+<mxfile host="65bd71144e">
+ <diagram name="Page-1" id="SMmOiZGLec9H7ruN5qyQ">
+ <mxGraphModel dx="746" dy="307" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
+ <root>
+ <mxCell id="0"/>
+ <mxCell id="1" parent="0"/>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="c-_7pHU60HQ0aR4bwu-4-1" target="c-_7pHU60HQ0aR4bwu-4-2" edge="1">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="c-_7pHU60HQ0aR4bwu-4-1" target="c-_7pHU60HQ0aR4bwu-4-4" edge="1">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="c-_7pHU60HQ0aR4bwu-4-1" target="c-_7pHU60HQ0aR4bwu-4-6" edge="1">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-1" value="TIME_INFO" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="340" y="230" width="120" height="60" as="geometry"/>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-2" value="APIC/PIC/IOAPIC" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="340" y="400" width="120" height="60" as="geometry"/>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-4" value="GT" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="530" y="400" width="120" height="60" as="geometry"/>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-6" value="CLINT" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="150" y="400" width="120" height="60" as="geometry"/>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="c-_7pHU60HQ0aR4bwu-4-8" target="c-_7pHU60HQ0aR4bwu-4-1" edge="1">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-8" value="Scheduler context switch (on non MT mode),&lt;br&gt;Also HardwareTimer gets implemented." style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="160" y="60" width="120" height="90" as="geometry"/>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="c-_7pHU60HQ0aR4bwu-4-10" edge="1">
+ <mxGeometry relative="1" as="geometry">
+ <mxPoint x="530" y="120" as="sourcePoint"/>
+ <mxPoint x="430" y="230" as="targetPoint"/>
+ </mxGeometry>
+ </mxCell>
+ <mxCell id="c-_7pHU60HQ0aR4bwu-4-10" value="Hook 2 system calls for timing purposes.&lt;br&gt;(Wait, WaitUntil)" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="560" y="90" width="120" height="60" as="geometry"/>
+ </mxCell>
+ </root>
+ </mxGraphModel>
+ </diagram>
+</mxfile> \ No newline at end of file
diff --git a/SCIKit/SharedInterface1.hxx b/SCIKit/SharedInterface1.hxx
index b1f7ce9d..5edb5e51 100644
--- a/SCIKit/SharedInterface1.hxx
+++ b/SCIKit/SharedInterface1.hxx
@@ -12,10 +12,12 @@ Purpose: System Call Interface Version 1.
#include <SCIKit/Types.hxx>
+typedef UInt32 PowerID;
+
/**
@brief System call class.
*/
-class __attribute__((uuid_of(SharedInterface1))) SharedInterface1 : public UnknownInterface
+class __attribute__((uuid("21f40aef-cce0-4c0b-9672-40f9053394bc"))) SharedInterface1 : public UnknownInterface
{
public:
explicit SharedInterface1() = default;
diff --git a/SCIKit/Types.hxx b/SCIKit/Types.hxx
index c6c93fdc..c42b7718 100644
--- a/SCIKit/Types.hxx
+++ b/SCIKit/Types.hxx
@@ -36,18 +36,13 @@ typedef __INT8_TYPE__ SInt8;
typedef char UTFChar;
-typedef UInt32 PowerID;
-
// Interfaces are divided between classes.
// So that they aren't too big.
-class SharedInterface1;
-class SharedInterface2;
-class SharedInterface3;
-class UnknownInterface;
-class EncodingInterface;
+class UnknownInterface; // Refrenced from an IDB entry.
+class UnknownUCLSID; // From IDB, the constructor of the object.
-class __attribute__((uuid_of(UnknownInterface))) UnknownInterface
+class __attribute__((uuid("d7c144b6-0792-44b8-b06b-02b227b547df"))) UnknownInterface
{
public:
explicit UnknownInterface() = default;
@@ -56,14 +51,14 @@ public:
UnknownInterface& operator=(const UnknownInterface&) = default;
UnknownInterface(const UnknownInterface&) = default;
- SInt32 Release() { return -1; }
+ SInt32 Release() { delete this; }
template <typename TCLS>
- SInt32 Release(TCLS* cls) { return -1; }
+ SInt32 Release(TCLS* cls) { delete cls; return 0; }
- template <typename TCLS, typename UCLSID>
- TCLS* QueryInterface(UCLSID uclsidOfCls) { return nullptr; }
+ template <typename TCLS, typename UCLSID, typename... Args>
+ TCLS* QueryInterface(UCLSID uclsidOfCls, Args... args) { return uclsidOfCls->QueryObject<TCLS>(args...); }
};
template <typename TCLS, typename UCLSID>
-TCLS* SciGetClassFromCLSID(UCLSID uclsidOfCls); \ No newline at end of file
+TCLS* RtlGetClassFromCLSID(UCLSID uclsidOfCls); \ No newline at end of file