summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/ZBA/amd64-efi.make4
-rw-r--r--dev/ZKA/ArchKit/ArchKit.hxx2
-rw-r--r--dev/ZKA/FSKit/IndexableProperty.hxx2
-rw-r--r--dev/ZKA/FSKit/NewFS.hxx2
-rw-r--r--dev/ZKA/HALKit/AMD64/HalBitMapMgr.cxx8
-rw-r--r--dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx16
-rw-r--r--dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm18
-rw-r--r--dev/ZKA/HALKit/AMD64/HalKernelMain.cxx18
-rw-r--r--dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm48
-rw-r--r--dev/ZKA/HALKit/AMD64/Processor.hxx20
-rw-r--r--dev/ZKA/HALKit/ARM64/HalKernelMain.cxx10
-rw-r--r--dev/ZKA/KernelKit/CodeMgr.hxx (renamed from dev/ZKA/KernelKit/CodeManager.hxx)8
-rw-r--r--dev/ZKA/KernelKit/DLLInterface.hxx11
-rw-r--r--dev/ZKA/KernelKit/DebugOutput.hxx2
-rw-r--r--dev/ZKA/KernelKit/DeviceMgr.hxx (renamed from dev/ZKA/KernelKit/DeviceManager.hxx)6
-rw-r--r--dev/ZKA/KernelKit/DriveMgr.hxx (renamed from dev/ZKA/KernelKit/DriveManager.hxx)4
-rw-r--r--dev/ZKA/KernelKit/FileMgr.hxx (renamed from dev/ZKA/KernelKit/FileManager.hxx)30
-rw-r--r--dev/ZKA/KernelKit/MP.hxx2
-rw-r--r--dev/ZKA/KernelKit/PCI/Dma.hxx2
-rw-r--r--dev/ZKA/KernelKit/PECodeMgr.hxx (renamed from dev/ZKA/KernelKit/PECodeManager.hxx)4
-rw-r--r--dev/ZKA/KernelKit/PEFCodeMgr.hxx (renamed from dev/ZKA/KernelKit/PEFCodeManager.hxx)4
-rw-r--r--dev/ZKA/KernelKit/PEFDLLInterface.hxx4
-rw-r--r--dev/ZKA/KernelKit/UserProcessScheduler.hxx5
-rw-r--r--dev/ZKA/NetworkKit/NetworkDevice.hxx2
-rw-r--r--dev/ZKA/NewKit/PageAllocator.hxx2
-rw-r--r--dev/ZKA/NewKit/PageMgr.hxx (renamed from dev/ZKA/NewKit/PageManager.hxx)18
-rw-r--r--dev/ZKA/NewKit/Pmm.hxx8
-rw-r--r--dev/ZKA/Sources/CodeMgr.cxx (renamed from dev/ZKA/Sources/CodeManager.cxx)2
-rw-r--r--dev/ZKA/Sources/DLLMain.cxx22
-rw-r--r--dev/ZKA/Sources/DeviceMgr.cxx (renamed from dev/ZKA/Sources/DeviceManager.cxx)2
-rw-r--r--dev/ZKA/Sources/DriveMgr.cxx (renamed from dev/ZKA/Sources/DriveManager.cxx)4
-rw-r--r--dev/ZKA/Sources/FileMgr.cxx (renamed from dev/ZKA/Sources/FileManager.cxx)30
-rw-r--r--dev/ZKA/Sources/Heap.cxx73
-rw-r--r--dev/ZKA/Sources/MP.cxx30
-rw-r--r--dev/ZKA/Sources/NewFS+FileMgr.cxx (renamed from dev/ZKA/Sources/NewFS+FileManager.cxx)18
-rw-r--r--dev/ZKA/Sources/NewFS+IO.cxx4
-rw-r--r--dev/ZKA/Sources/NewFS+Journal.cxx2
-rw-r--r--dev/ZKA/Sources/PEFCodeMgr.cxx (renamed from dev/ZKA/Sources/PEFCodeManager.cxx)4
-rw-r--r--dev/ZKA/Sources/PageMgr.cxx (renamed from dev/ZKA/Sources/PageManager.cxx)10
-rw-r--r--dev/ZKA/Sources/Pmm.cxx14
-rw-r--r--dev/ZKA/Sources/Storage/ATADeviceInterface.cxx4
-rw-r--r--dev/ZKA/Sources/User.cxx2
-rw-r--r--dev/ZKA/Sources/UserProcessScheduler.cxx2
-rw-r--r--dev/ZKA/StorageKit/AHCI.hxx4
-rw-r--r--dev/ZKA/StorageKit/ATA.hxx4
-rw-r--r--dev/ZKA/StorageKit/NVME.hxx4
-rw-r--r--dev/ZKA/amd64-efi.make2
47 files changed, 254 insertions, 243 deletions
diff --git a/dev/ZBA/amd64-efi.make b/dev/ZBA/amd64-efi.make
index 55ce3f1c..497dc8e9 100644
--- a/dev/ZBA/amd64-efi.make
+++ b/dev/ZBA/amd64-efi.make
@@ -29,14 +29,14 @@ IMG=epm-master-1.img
IMG_2=epm-slave.img
IMG_3=epm-master-2.img
-EMU_FLAGS=-net none -m 8G -M q35 -cpu qemu64 \
+EMU_FLAGS=-net none -m 12G -M q35 \
-bios $(BIOS) -device piix3-ide,id=ide \
-drive id=disk,file=$(IMG),format=raw,if=none \
-device ide-hd,drive=disk,bus=ide.0 -drive \
file=fat:rw:Sources/Root/,index=2,format=raw \
-drive id=disk_2,file=$(IMG_2),if=none \
-device ahci,id=ahci \
- -device ide-hd,drive=disk_2,bus=ahci.0 -d int -no-reboot -no-shutdown
+ -device ide-hd,drive=disk_2,bus=ahci.0 -d int
LD_FLAGS=-e Main --subsystem=10
diff --git a/dev/ZKA/ArchKit/ArchKit.hxx b/dev/ZKA/ArchKit/ArchKit.hxx
index 60a2b2ec..fc2d7d33 100644
--- a/dev/ZKA/ArchKit/ArchKit.hxx
+++ b/dev/ZKA/ArchKit/ArchKit.hxx
@@ -109,4 +109,4 @@ inline Kernel::Array<HAL_SYSCALL_RECORD,
EXTERN_C Kernel::HAL::StackFramePtr mp_get_current_context();
EXTERN_C Kernel::Void mp_do_context_switch_pre(Kernel::Void);
/// @note The context gives out the return address in return register.
-EXTERN_C Kernel::UIntPtr mp_do_context_switch(Kernel::VoidPtr image, Kernel::UInt8* stack_ptr, Kernel::HAL::StackFramePtr stackPtr);
+EXTERN_C Kernel::Void mp_do_context_switch(Kernel::VoidPtr image, Kernel::UInt8* stack_ptr, Kernel::HAL::StackFramePtr stackPtr);
diff --git a/dev/ZKA/FSKit/IndexableProperty.hxx b/dev/ZKA/FSKit/IndexableProperty.hxx
index 652e0e74..56e5de1c 100644
--- a/dev/ZKA/FSKit/IndexableProperty.hxx
+++ b/dev/ZKA/FSKit/IndexableProperty.hxx
@@ -8,7 +8,7 @@
#include <CFKit/Property.hxx>
#include <CompilerKit/CompilerKit.hxx>
-#include <KernelKit/DriveManager.hxx>
+#include <KernelKit/DriveMgr.hxx>
#define kIndexerNodeNameLength 255
#define kIndexerClaimed 0xCF
diff --git a/dev/ZKA/FSKit/NewFS.hxx b/dev/ZKA/FSKit/NewFS.hxx
index c5ada14b..4587b70f 100644
--- a/dev/ZKA/FSKit/NewFS.hxx
+++ b/dev/ZKA/FSKit/NewFS.hxx
@@ -18,7 +18,7 @@ default.
#include <CompilerKit/CompilerKit.hxx>
#include <HintKit/CompilerHint.hxx>
-#include <KernelKit/DriveManager.hxx>
+#include <KernelKit/DriveMgr.hxx>
#include <NewKit/Defines.hxx>
/**
diff --git a/dev/ZKA/HALKit/AMD64/HalBitMapMgr.cxx b/dev/ZKA/HALKit/AMD64/HalBitMapMgr.cxx
index 677b1219..7bafd075 100644
--- a/dev/ZKA/HALKit/AMD64/HalBitMapMgr.cxx
+++ b/dev/ZKA/HALKit/AMD64/HalBitMapMgr.cxx
@@ -49,10 +49,10 @@ namespace Kernel
if (user)
mm_update_pte(base_ptr, eFlagsUser);
- return (VoidPtr)(ptr_bit_set + 2);
+ return (VoidPtr)(&ptr_bit_set[2]);
}
- base_ptr = reinterpret_cast<VoidPtr>(reinterpret_cast<UIntPtr>(base_ptr) + size);
+ base_ptr = reinterpret_cast<VoidPtr>(reinterpret_cast<UIntPtr>(base_ptr) + 1 + ptr_bit_set[1]);
}
return nullptr;
@@ -71,7 +71,7 @@ namespace Kernel
ptr_new = traits.FindBitMap(kKernelVirtualStart, size, rw, user);
- return ptr_new;
+ return &((UIntPtr*)ptr_new)[1];
}
auto mm_free_bitmap(VoidPtr page_ptr) -> Bool
@@ -79,7 +79,7 @@ namespace Kernel
if (!page_ptr)
return false;
- UIntPtr* ptr_bit_set = reinterpret_cast<UIntPtr*>(page_ptr) - 2;
+ UIntPtr* ptr_bit_set = reinterpret_cast<UIntPtr*>(page_ptr) - 3;
if (!ptr_bit_set[0] ||
ptr_bit_set[0] != cVMHMagic)
diff --git a/dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx b/dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx
index 19d62965..54b62b80 100644
--- a/dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx
+++ b/dev/ZKA/HALKit/AMD64/HalDescriptorLoader.cxx
@@ -15,12 +15,15 @@ namespace Kernel::HAL
STATIC Void hal_remap_intel_pic_ctrl(Void) noexcept
{
- // Remap PIC.
+ auto a1 = HAL::In8(0xa1); // save masks
+ auto a2 = HAL::In8(0xa2);
+
HAL::Out8(0x20, 0x11);
+
HAL::Out8(0xA0, 0x11);
- HAL::Out8(0x21, 40);
- HAL::Out8(0xA1, 32);
+ HAL::Out8(0x21, 32);
+ HAL::Out8(0xA1, 40);
HAL::Out8(0x21, 4);
HAL::Out8(0xA1, 2);
@@ -28,8 +31,8 @@ namespace Kernel::HAL
HAL::Out8(0x21, 0x01);
HAL::Out8(0xA1, 0x01);
- HAL::Out8(0x21, 0xFD);
- HAL::Out8(0xA1, 0xFF);
+ HAL::Out8(0x21, a2);
+ HAL::Out8(0xA1, a1);
}
} // namespace Detail
@@ -73,7 +76,8 @@ namespace Kernel::HAL
hal_load_idt(idt);
- Detail::hal_remap_intel_pic_ctrl();
+ HAL::Out8(0xA1, 0xFF);
+ HAL::Out8(0x21, 0xFF);
}
void GDTLoader::Load(Ref<RegisterGDT>& gdt)
diff --git a/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm b/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
index d59cc197..6abd28c9 100644
--- a/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
+++ b/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
@@ -141,12 +141,7 @@ IntNormal 38
IntNormal 39
IntNormal 40
-extern mp_system_call_handler
-
-__ZKA_INT_41:
- cmp rcx, 0
- jne mp_system_call_handler
- iretq
+IntNormal 41
IntNormal 42
IntNormal 43
@@ -222,17 +217,18 @@ section .text
hal_load_gdt:
lgdt [rcx]
- push 0x08
- lea rax, [rel rt_reload_segments]
- push rax
+ cli
+ push 8
+ push hal_reload_segments
o64 retf
-rt_reload_segments:
- mov ax, 0x10
+hal_reload_segments:
+ mov ax, 16
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
+ sti
ret
global hal_load_idt
diff --git a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx
index 33c3f689..10916b06 100644
--- a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx
+++ b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx
@@ -7,14 +7,14 @@
#include <ArchKit/ArchKit.hxx>
#include <Modules/CoreCG/FbRenderer.hxx>
#include <FirmwareKit/Handover.hxx>
-#include <KernelKit/FileManager.hxx>
+#include <KernelKit/FileMgr.hxx>
#include <KernelKit/Framebuffer.hxx>
#include <KernelKit/Heap.hxx>
-#include <KernelKit/PEFCodeManager.hxx>
+#include <KernelKit/PEFCodeMgr.hxx>
#include <KernelKit/UserProcessScheduler.hxx>
#include <NewKit/Json.hxx>
#include <Modules/CoreCG/Accessibility.hxx>
-#include <KernelKit/CodeManager.hxx>
+#include <KernelKit/CodeMgr.hxx>
#include <Modules/ACPI/ACPIFactoryInterface.hxx>
#include <NetworkKit/IPC.hxx>
#include <CFKit/Property.hxx>
@@ -64,14 +64,14 @@ EXTERN_C void hal_user_code_start(void);
EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void);
/* GDT, mostly descriptors for user and kernel segments. */
-STATIC Kernel::HAL::Detail::ZKA_GDT_ENTRY cGdt[6] = {
+STATIC Kernel::HAL::Detail::ZKA_GDT_ENTRY ALIGN(0x1000) cGdt[6] = {
{.fLimitLow = 0, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x00, .fFlags = 0x00, .fBaseHigh = 0}, // Null entry
{.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x9A, .fFlags = 0xA0, .fBaseHigh = 0}, // Kernel code
{.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x92, .fFlags = 0xA0, .fBaseHigh = 0}, // Kernel data
- {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xFA, .fFlags = 0xA0, .fBaseHigh = 0}, // User code
- {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xF2, .fFlags = 0xA0, .fBaseHigh = 0}, // User data
- // reserve them for later.
{.fLimitLow = 0, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x00, .fFlags = 0x00, .fBaseHigh = 0},
+ {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x9A, .fFlags = 0xA0, .fBaseHigh = 0}, // User code
+ {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x92, .fFlags = 0xA0, .fBaseHigh = 0}, // User data
+ // reserve them for later.
};
EXTERN_C void hal_init_platform(
@@ -127,11 +127,11 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept
Kernel::kcout << "newoskrnl.exe: Creating filesystem and such.\r";
- auto fs = new Kernel::NewFilesystemManager();
+ auto fs = new Kernel::NewFilesystemMgr();
MUST_PASS(fs);
- Kernel::NewFilesystemManager::Mount(fs);
+ Kernel::NewFilesystemMgr::Mount(fs);
const auto cPassword = "ZKA_KERNEL_AUTHORITY";
diff --git a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm
index 39a80922..1f31c880 100644
--- a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm
+++ b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm
@@ -21,23 +21,42 @@ section .text
;; rcx: code ptr.
;; rdx: stack ptr.
mp_do_context_switch:
- mov rsp, rdx
- mov rbp, rsp
+ swapgs
+
+ mov fs, rcx
+ mov gs, rdx
mov r9, [r8 + (8 * 2)]
mov r10, [r8 + (8 * 3)]
- mov fs, [r8 + (8 * 4)]
+
mov r12, [r8 + (8 * 5)]
mov r13, [r8 + (8 * 6)]
mov r14, [r8 + (8 * 7)]
mov r15, [r8 + (8 * 8)]
- mov gs, [r8 + (8 * 9)]
- mov r8, [r8]
+ mov r11, gs
+ mov r12, fs
- mov rax, rcx
+ ; Enable SCE that enables sysret and syscall
+ mov rcx, 0xc0000082
+ wrmsr
+ mov rcx, 0xc0000080
+ rdmsr
+ or eax, 1
+ wrmsr
+ mov rcx, 0xc0000081
+ rdmsr
+ mov edx, 0x00180008
+ wrmsr
mov r11, 0x202
+ mov fs, [r8 + (8 * 4)]
+ mov gs, [r8 + (8 * 9)]
+ mov r8, [r8]
+
+ swapgs
+ sti
+
o64 sysret
;; @brief Gets the current stack frame.
@@ -67,15 +86,14 @@ mp_system_call_handler:
o64 sysret
mp_do_context_switch_pre:
- mov rcx, 0xc0000082
- wrmsr
- mov rcx, 0xc0000080
- rdmsr
- or eax, 1
- wrmsr
- mov rcx, 0xc0000081
- rdmsr
- mov edx, 0x00180008
+ xor rdx, rdx
+ mov rax, 0x202
+ mov rcx, 0xc0000084
wrmsr
+ mov rdx, mp_system_call_handler
+ shr rdx, 32
+ mov rcx, 0xc0000082
+ wrmsr
+
ret
diff --git a/dev/ZKA/HALKit/AMD64/Processor.hxx b/dev/ZKA/HALKit/AMD64/Processor.hxx
index b7fa080c..0636c291 100644
--- a/dev/ZKA/HALKit/AMD64/Processor.hxx
+++ b/dev/ZKA/HALKit/AMD64/Processor.hxx
@@ -99,17 +99,17 @@ namespace Kernel::HAL
using InterruptId = UInt16; /* For each element in the IVT */
/// @brief Stack frame (as retrieved from assembly.)
- struct StackFrame final
+ struct PACKED StackFrame final
{
- UIntPtr R8{0};
- UIntPtr R9{0};
- UIntPtr R10{0};
- UIntPtr FS{0};
- UIntPtr R12{0};
- UIntPtr R13{0};
- UIntPtr R14{0};
- UIntPtr R15{0};
- UIntPtr GS{0};
+ RawRegister R8{0};
+ RawRegister R9{0};
+ RawRegister R10{0};
+ RawRegister FS{0};
+ RawRegister R12{0};
+ RawRegister R13{0};
+ RawRegister R14{0};
+ RawRegister R15{0};
+ RawRegister GS{0};
};
typedef StackFrame* StackFramePtr;
diff --git a/dev/ZKA/HALKit/ARM64/HalKernelMain.cxx b/dev/ZKA/HALKit/ARM64/HalKernelMain.cxx
index d51f0421..ee06c305 100644
--- a/dev/ZKA/HALKit/ARM64/HalKernelMain.cxx
+++ b/dev/ZKA/HALKit/ARM64/HalKernelMain.cxx
@@ -7,14 +7,14 @@
#include <ArchKit/ArchKit.hxx>
#include <Modules/CoreCG/FbRenderer.hxx>
#include <FirmwareKit/Handover.hxx>
-#include <KernelKit/FileManager.hxx>
+#include <KernelKit/FileMgr.hxx>
#include <KernelKit/Framebuffer.hxx>
#include <KernelKit/Heap.hxx>
-#include <KernelKit/PEFCodeManager.hxx>
+#include <KernelKit/PEFCodeMgr.hxx>
#include <KernelKit/UserProcessScheduler.hxx>
#include <NewKit/Json.hxx>
#include <Modules/CoreCG/Accessibility.hxx>
-#include <KernelKit/CodeManager.hxx>
+#include <KernelKit/CodeMgr.hxx>
#include <Modules/ACPI/ACPIFactoryInterface.hxx>
#include <NetworkKit/IPC.hxx>
#include <CFKit/Property.hxx>
@@ -94,12 +94,12 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept
Kernel::kcout << "newoskrnl.exe: Creating filesystem and such.\r";
- auto fs = new Kernel::NewFilesystemManager();
+ auto fs = new Kernel::NewFilesystemMgr();
MUST_PASS(fs);
MUST_PASS(fs->GetParser());
- Kernel::NewFilesystemManager::Mount(fs);
+ Kernel::NewFilesystemMgr::Mount(fs);
const auto cPassword = "ZKA_KERNEL_AUTHORITY";
diff --git a/dev/ZKA/KernelKit/CodeManager.hxx b/dev/ZKA/KernelKit/CodeMgr.hxx
index ef9d18f4..8c4f090f 100644
--- a/dev/ZKA/KernelKit/CodeManager.hxx
+++ b/dev/ZKA/KernelKit/CodeMgr.hxx
@@ -2,8 +2,8 @@
Copyright ZKA Technologies.
- File: CodeManager.hpp
- Purpose: Code Manager and Shared Objects.
+ File: CodeMgr.hpp
+ Purpose: Code Mgr and Shared Objects.
Revision History:
@@ -14,8 +14,8 @@
#pragma once
-#include <KernelKit/PECodeManager.hxx>
-#include <KernelKit/PEFCodeManager.hxx>
+#include <KernelKit/PECodeMgr.hxx>
+#include <KernelKit/PEFCodeMgr.hxx>
#include <KernelKit/PEFDLLInterface.hxx>
namespace Kernel
diff --git a/dev/ZKA/KernelKit/DLLInterface.hxx b/dev/ZKA/KernelKit/DLLInterface.hxx
index 370363b7..13f36b82 100644
--- a/dev/ZKA/KernelKit/DLLInterface.hxx
+++ b/dev/ZKA/KernelKit/DLLInterface.hxx
@@ -35,8 +35,15 @@ namespace Kernel
virtual DLL_TRAITS** GetAddressOf() = 0;
virtual DLL_TRAITS* Get() = 0;
- virtual void Mount(DLL_TRAITS* to_mount) = 0;
- virtual void Unmount() = 0;
+ virtual Void Mount(DLL_TRAITS* to_mount) = 0;
+ virtual Void Unmount() = 0;
+
+
+ template <typename SymbolType>
+ SymbolType Load(const Char* symbol_name, SizeT len, Int32 kind)
+ {
+ return nullptr;
+ }
};
/// @brief Pure implementation, missing method/function handler.
diff --git a/dev/ZKA/KernelKit/DebugOutput.hxx b/dev/ZKA/KernelKit/DebugOutput.hxx
index fcf18bff..66105aa1 100644
--- a/dev/ZKA/KernelKit/DebugOutput.hxx
+++ b/dev/ZKA/KernelKit/DebugOutput.hxx
@@ -6,7 +6,7 @@
#pragma once
-#include <KernelKit/DeviceManager.hxx>
+#include <KernelKit/DeviceMgr.hxx>
#include <CompilerKit/CompilerKit.hxx>
#include <NewKit/OwnPtr.hxx>
#include <NewKit/Stream.hxx>
diff --git a/dev/ZKA/KernelKit/DeviceManager.hxx b/dev/ZKA/KernelKit/DeviceMgr.hxx
index 5164ae28..473af601 100644
--- a/dev/ZKA/KernelKit/DeviceManager.hxx
+++ b/dev/ZKA/KernelKit/DeviceMgr.hxx
@@ -14,13 +14,15 @@
#pragma once
-/* Kernel device interface manager. */
-/* @file KernelKit/DeviceManager.hpp */
+/* Device manager. */
+/* @file KernelKit/DeviceMgr.hpp */
/* @brief Device abstraction and I/O buffer. */
#include <NewKit/ErrorOr.hxx>
#include <NewKit/Ref.hxx>
+#define cDevicePath "\\Mount\\"
+
// Last Rev
// Wed, Apr 3, 2024 9:09:41 AM
diff --git a/dev/ZKA/KernelKit/DriveManager.hxx b/dev/ZKA/KernelKit/DriveMgr.hxx
index 96fbd95d..4b2cdc73 100644
--- a/dev/ZKA/KernelKit/DriveManager.hxx
+++ b/dev/ZKA/KernelKit/DriveMgr.hxx
@@ -10,12 +10,12 @@
#include <KernelKit/UserProcessScheduler.hxx>
#include <CompilerKit/CompilerKit.hxx>
#include <KernelKit/DebugOutput.hxx>
-#include <KernelKit/DeviceManager.hxx>
+#include <KernelKit/DeviceMgr.hxx>
#include <KernelKit/LPC.hxx>
#include <NewKit/Defines.hxx>
#include <NewKit/String.hxx>
-#define kDriveManagerCount (4U)
+#define kDriveMgrCount (4U)
#define kDriveInvalidID (-1)
#define kDriveNameLen (32)
diff --git a/dev/ZKA/KernelKit/FileManager.hxx b/dev/ZKA/KernelKit/FileMgr.hxx
index 05f74a63..7a97f821 100644
--- a/dev/ZKA/KernelKit/FileManager.hxx
+++ b/dev/ZKA/KernelKit/FileMgr.hxx
@@ -2,7 +2,7 @@
Copyright ZKA Technologies.
- File: FileManager.hxx
+ File: FileMgr.hxx
Purpose: Kernel file manager.
------------------------------------------- */
@@ -71,31 +71,31 @@ namespace Kernel
typedef VoidPtr NodePtr;
/**
- @brief Filesystem Manager Interface class
+ @brief Filesystem Mgr Interface class
@brief Used to provide common I/O for a specific filesystem.
*/
- class FilesystemManagerInterface
+ class FilesystemMgrInterface
{
public:
- explicit FilesystemManagerInterface() = default;
- virtual ~FilesystemManagerInterface() = default;
+ explicit FilesystemMgrInterface() = default;
+ virtual ~FilesystemMgrInterface() = default;
public:
- ZKA_COPY_DEFAULT(FilesystemManagerInterface);
+ ZKA_COPY_DEFAULT(FilesystemMgrInterface);
public:
/// @brief Mounts a new filesystem into an active state.
/// @param interface the filesystem interface
/// @return
- static bool Mount(FilesystemManagerInterface* interface);
+ static bool Mount(FilesystemMgrInterface* interface);
/// @brief Unmounts the active filesystem
/// @return
- static FilesystemManagerInterface* Unmount();
+ static FilesystemMgrInterface* Unmount();
/// @brief Getter, gets the active filesystem.
/// @return
- static FilesystemManagerInterface* GetMounted();
+ static FilesystemMgrInterface* GetMounted();
public:
virtual NodePtr Create(_Input const Char* path) = 0;
@@ -137,17 +137,17 @@ namespace Kernel
#ifdef __FSKIT_USE_NEWFS__
/**
- * @brief Based of FilesystemManagerInterface, takes care of managing NewFS
+ * @brief Based of FilesystemMgrInterface, takes care of managing NewFS
* disks.
*/
- class NewFilesystemManager final : public FilesystemManagerInterface
+ class NewFilesystemMgr final : public FilesystemMgrInterface
{
public:
- explicit NewFilesystemManager();
- ~NewFilesystemManager() override;
+ explicit NewFilesystemMgr();
+ ~NewFilesystemMgr() override;
public:
- ZKA_COPY_DEFAULT(NewFilesystemManager);
+ ZKA_COPY_DEFAULT(NewFilesystemMgr);
public:
NodePtr Create(const Char* path) override;
@@ -192,7 +192,7 @@ namespace Kernel
* @tparam FSClass Filesystem contract who takes care of it.
*/
template <typename Encoding = Char,
- typename FSClass = FilesystemManagerInterface>
+ typename FSClass = FilesystemMgrInterface>
class FileStream final
{
public:
diff --git a/dev/ZKA/KernelKit/MP.hxx b/dev/ZKA/KernelKit/MP.hxx
index 51f3472a..cf5d6754 100644
--- a/dev/ZKA/KernelKit/MP.hxx
+++ b/dev/ZKA/KernelKit/MP.hxx
@@ -103,7 +103,7 @@ namespace Kernel
operator bool() noexcept;
public:
- /// @brief Shared instance of the MP Manager.
+ /// @brief Shared instance of the MP Mgr.
/// @return the reference to the mp manager class.
STATIC HardwareThreadScheduler& The();
diff --git a/dev/ZKA/KernelKit/PCI/Dma.hxx b/dev/ZKA/KernelKit/PCI/Dma.hxx
index 43df13f0..8e51bc45 100644
--- a/dev/ZKA/KernelKit/PCI/Dma.hxx
+++ b/dev/ZKA/KernelKit/PCI/Dma.hxx
@@ -6,7 +6,7 @@
#pragma once
-#include <KernelKit/DeviceManager.hxx>
+#include <KernelKit/DeviceMgr.hxx>
#include <KernelKit/PCI/Device.hxx>
#include <NewKit/Array.hxx>
#include <NewKit/OwnPtr.hxx>
diff --git a/dev/ZKA/KernelKit/PECodeManager.hxx b/dev/ZKA/KernelKit/PECodeMgr.hxx
index f42c7c21..7b84fbc1 100644
--- a/dev/ZKA/KernelKit/PECodeManager.hxx
+++ b/dev/ZKA/KernelKit/PECodeMgr.hxx
@@ -2,8 +2,8 @@
Copyright ZKA Technologies.
- File: PECodeManager.hxx
- Purpose: PE32+ Code Manager and Shared Objects.
+ File: PECodeMgr.hxx
+ Purpose: PE32+ Code Mgr and Shared Objects.
Revision History:
diff --git a/dev/ZKA/KernelKit/PEFCodeManager.hxx b/dev/ZKA/KernelKit/PEFCodeMgr.hxx
index dd6daca5..74cc8eb0 100644
--- a/dev/ZKA/KernelKit/PEFCodeManager.hxx
+++ b/dev/ZKA/KernelKit/PEFCodeMgr.hxx
@@ -10,7 +10,7 @@
#include <KernelKit/PEF.hxx>
#include <NewKit/ErrorOr.hxx>
#include <NewKit/String.hxx>
-#include <KernelKit/FileManager.hxx>
+#include <KernelKit/FileMgr.hxx>
#define kPefApplicationMime "application/x-newos-exec"
@@ -47,7 +47,7 @@ namespace Kernel
private:
#ifdef __FSKIT_USE_NEWFS__
- OwnPtr<FileStream<Char, NewFilesystemManager>> fFile;
+ OwnPtr<FileStream<Char, NewFilesystemMgr>> fFile;
#else
OwnPtr<FileStream<Char>> fFile;
#endif // __FSKIT_USE_NEWFS__
diff --git a/dev/ZKA/KernelKit/PEFDLLInterface.hxx b/dev/ZKA/KernelKit/PEFDLLInterface.hxx
index ef1a844f..d664bfd8 100644
--- a/dev/ZKA/KernelKit/PEFDLLInterface.hxx
+++ b/dev/ZKA/KernelKit/PEFDLLInterface.hxx
@@ -11,7 +11,7 @@
#define __KERNELKIT_SHARED_OBJECT_HXX__
#include <KernelKit/PEF.hxx>
-#include <KernelKit/PEFCodeManager.hxx>
+#include <KernelKit/PEFCodeMgr.hxx>
#include <NewKit/Defines.hxx>
#include <KernelKit/DLLInterface.hxx>
@@ -96,7 +96,7 @@ namespace Kernel
PEFLoader* fLoader{nullptr};
};
- typedef PEFDLLInterface* DLLInterfacePtr;
+ typedef DLLInterface* DLLInterfacePtr;
EXTERN_C DLLInterfacePtr rtl_init_shared_object(UserProcess* header);
EXTERN_C Void rtl_fini_shared_object(UserProcess* header, DLLInterfacePtr lib, Bool* successful);
diff --git a/dev/ZKA/KernelKit/UserProcessScheduler.hxx b/dev/ZKA/KernelKit/UserProcessScheduler.hxx
index 809dbb7f..78d75af6 100644
--- a/dev/ZKA/KernelKit/UserProcessScheduler.hxx
+++ b/dev/ZKA/KernelKit/UserProcessScheduler.hxx
@@ -10,6 +10,7 @@
#include <ArchKit/ArchKit.hxx>
#include <KernelKit/LockDelegate.hxx>
#include <KernelKit/User.hxx>
+#include <KernelKit/DLLInterface.hxx>
#include <NewKit/MutableArray.hxx>
#define kSchedMinMicroTime (AffinityKind::kStandard)
@@ -158,13 +159,13 @@ namespace Kernel
SizeT StackSize{mib_cast(8)};
// shared library handle, reserved for kDLLKind types of executables only.
- PEFDLLInterface* DLLPtr{nullptr};
+ DLLInterface* DLLPtr{nullptr};
UserProcess* Parent{nullptr};
// Memory usage.
SizeT UsedMemory{0};
SizeT FreeMemory{0};
- SizeT SizeMemory{gib_cast(4)};
+ SizeT SizeMemory{mib_cast(64)};
enum
{
diff --git a/dev/ZKA/NetworkKit/NetworkDevice.hxx b/dev/ZKA/NetworkKit/NetworkDevice.hxx
index c307a433..ed575e3e 100644
--- a/dev/ZKA/NetworkKit/NetworkDevice.hxx
+++ b/dev/ZKA/NetworkKit/NetworkDevice.hxx
@@ -7,7 +7,7 @@
#ifndef __INC_NETWORK_DEVICE_HPP__
#define __INC_NETWORK_DEVICE_HPP__
-#include <KernelKit/DeviceManager.hxx>
+#include <KernelKit/DeviceMgr.hxx>
#include <NetworkKit/IP.hxx>
/// @note Can either work with: Ethernet, GPRS, WiFi
diff --git a/dev/ZKA/NewKit/PageAllocator.hxx b/dev/ZKA/NewKit/PageAllocator.hxx
index a6d84aa0..5b19c0c2 100644
--- a/dev/ZKA/NewKit/PageAllocator.hxx
+++ b/dev/ZKA/NewKit/PageAllocator.hxx
@@ -7,7 +7,7 @@
#pragma once
#include <NewKit/Defines.hxx>
-#include <NewKit/PageManager.hxx>
+#include <NewKit/PageMgr.hxx>
namespace Kernel
{
diff --git a/dev/ZKA/NewKit/PageManager.hxx b/dev/ZKA/NewKit/PageMgr.hxx
index 0de37803..1f6b5021 100644
--- a/dev/ZKA/NewKit/PageManager.hxx
+++ b/dev/ZKA/NewKit/PageMgr.hxx
@@ -15,7 +15,7 @@
namespace Kernel
{
- class PageManager;
+ class PageMgr;
class PTEWrapper final
{
@@ -31,7 +31,7 @@ namespace Kernel
const UIntPtr VirtualAddress();
void NoExecute(const bool enable = false);
- const bool& NoExecute();
+ const Bool& NoExecute();
operator bool() { return fVirtAddr; }
@@ -52,22 +52,22 @@ namespace Kernel
Boolean fAccessed;
private:
- friend class PageManager;
+ friend class PageMgr;
friend class Pmm;
};
- struct PageManager final
+ struct PageMgr final
{
public:
- PageManager() = default;
- ~PageManager() = default;
+ PageMgr() = default;
+ ~PageMgr() = default;
- PageManager& operator=(const PageManager&) = default;
- PageManager(const PageManager&) = default;
+ PageMgr& operator=(const PageMgr&) = default;
+ PageMgr(const PageMgr&) = default;
public:
PTEWrapper Request(Boolean Rw, Boolean User, Boolean ExecDisable, SizeT Sz);
- bool Free(Ref<PTEWrapper*>& wrapper);
+ bool Free(Ref<PTEWrapper>& wrapper);
private:
void FlushTLB();
diff --git a/dev/ZKA/NewKit/Pmm.hxx b/dev/ZKA/NewKit/Pmm.hxx
index 111b3044..cdf498d9 100644
--- a/dev/ZKA/NewKit/Pmm.hxx
+++ b/dev/ZKA/NewKit/Pmm.hxx
@@ -7,7 +7,7 @@
#pragma once
-#include <NewKit/PageManager.hxx>
+#include <NewKit/PageMgr.hxx>
#include <NewKit/Ref.hxx>
namespace Kernel
@@ -33,12 +33,12 @@ namespace Kernel
Boolean ToggleShare(Ref<PTEWrapper> refPage, Boolean enable = true);
/// @brief Get the page manager of this.
- Ref<PageManager>& Leak()
+ Ref<PageMgr>& Leak()
{
- return fPageManager;
+ return fPageMgr;
}
private:
- Ref<PageManager> fPageManager;
+ Ref<PageMgr> fPageMgr;
};
} // namespace Kernel
diff --git a/dev/ZKA/Sources/CodeManager.cxx b/dev/ZKA/Sources/CodeMgr.cxx
index 7e180ac0..df5b0917 100644
--- a/dev/ZKA/Sources/CodeManager.cxx
+++ b/dev/ZKA/Sources/CodeMgr.cxx
@@ -5,7 +5,7 @@
------------------------------------------- */
#include <NewKit/Utils.hxx>
-#include <KernelKit/CodeManager.hxx>
+#include <KernelKit/CodeMgr.hxx>
#include <KernelKit/UserProcessScheduler.hxx>
namespace Kernel
diff --git a/dev/ZKA/Sources/DLLMain.cxx b/dev/ZKA/Sources/DLLMain.cxx
index 84c58b3a..88887ec3 100644
--- a/dev/ZKA/Sources/DLLMain.cxx
+++ b/dev/ZKA/Sources/DLLMain.cxx
@@ -11,18 +11,18 @@
#include <ArchKit/ArchKit.hxx>
#include <CompilerKit/Detail.hxx>
#include <FirmwareKit/Handover.hxx>
-#include <KernelKit/FileManager.hxx>
+#include <KernelKit/FileMgr.hxx>
#include <KernelKit/Framebuffer.hxx>
#include <KernelKit/Heap.hxx>
#include <KernelKit/PEF.hxx>
-#include <KernelKit/PEFCodeManager.hxx>
+#include <KernelKit/PEFCodeMgr.hxx>
#include <KernelKit/UserProcessScheduler.hxx>
#include <NewKit/Json.hxx>
#include <NewKit/KernelCheck.hxx>
#include <NewKit/String.hxx>
#include <NewKit/Utils.hxx>
-#include <KernelKit/PEFCodeManager.hxx>
-#include <KernelKit/CodeManager.hxx>
+#include <KernelKit/PEFCodeMgr.hxx>
+#include <KernelKit/CodeMgr.hxx>
#include <CFKit/Property.hxx>
#include <Modules/CoreCG/WindowRenderer.hxx>
#include <KernelKit/Timer.hxx>
@@ -44,23 +44,23 @@ namespace Kernel::Detail
/// @brief Filesystem auto formatter, additional checks are also done by the class.
class FilesystemInstaller final
{
- Kernel::NewFilesystemManager* fNewFS{nullptr};
+ Kernel::NewFilesystemMgr* fNewFS{nullptr};
public:
/// @brief wizard constructor.
explicit FilesystemInstaller()
{
- if (Kernel::FilesystemManagerInterface::GetMounted())
+ if (Kernel::FilesystemMgrInterface::GetMounted())
{
CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: NewFS IFS already mounted by HAL (A:)", 10, 10, RGB(0, 0, 0));
- fNewFS = reinterpret_cast<Kernel::NewFilesystemManager*>(Kernel::FilesystemManagerInterface::GetMounted());
+ fNewFS = reinterpret_cast<Kernel::NewFilesystemMgr*>(Kernel::FilesystemMgrInterface::GetMounted());
}
else
{
// Mounts a NewFS from main drive.
- fNewFS = new Kernel::NewFilesystemManager();
+ fNewFS = new Kernel::NewFilesystemMgr();
- Kernel::FilesystemManagerInterface::Mount(fNewFS);
+ Kernel::FilesystemMgrInterface::Mount(fNewFS);
CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: Mounted NewFS IFS (A:)", 10, 10, RGB(0, 0, 0));
}
@@ -142,8 +142,8 @@ namespace Kernel::Detail
ZKA_COPY_DEFAULT(FilesystemInstaller);
/// @brief Grab the disk's NewFS reference.
- /// @return NewFilesystemManager the filesystem interface
- Kernel::NewFilesystemManager* Leak()
+ /// @return NewFilesystemMgr the filesystem interface
+ Kernel::NewFilesystemMgr* Leak()
{
return fNewFS;
}
diff --git a/dev/ZKA/Sources/DeviceManager.cxx b/dev/ZKA/Sources/DeviceMgr.cxx
index 229e0fb7..70d01984 100644
--- a/dev/ZKA/Sources/DeviceManager.cxx
+++ b/dev/ZKA/Sources/DeviceMgr.cxx
@@ -4,4 +4,4 @@
------------------------------------------- */
-#include <KernelKit/DeviceManager.hxx>
+#include <KernelKit/DeviceMgr.hxx>
diff --git a/dev/ZKA/Sources/DriveManager.cxx b/dev/ZKA/Sources/DriveMgr.cxx
index 84c9870f..376eb158 100644
--- a/dev/ZKA/Sources/DriveManager.cxx
+++ b/dev/ZKA/Sources/DriveMgr.cxx
@@ -5,12 +5,12 @@
------------------------------------------- */
#include <KernelKit/DebugOutput.hxx>
-#include <KernelKit/DriveManager.hxx>
+#include <KernelKit/DriveMgr.hxx>
#include <Modules/ATA/ATA.hxx>
#include <Modules/AHCI/AHCI.hxx>
#include <NewKit/Utils.hxx>
-/// @file DriveManager.cxx
+/// @file DriveMgr.cxx
/// @brief Kernel drive manager.
namespace Kernel
diff --git a/dev/ZKA/Sources/FileManager.cxx b/dev/ZKA/Sources/FileMgr.cxx
index 8c8fb83a..270c13f2 100644
--- a/dev/ZKA/Sources/FileManager.cxx
+++ b/dev/ZKA/Sources/FileMgr.cxx
@@ -4,7 +4,7 @@
------------------------------------------- */
-#include <KernelKit/FileManager.hxx>
+#include <KernelKit/FileMgr.hxx>
#include <NewKit/Utils.hxx>
/// BUGS: 0
@@ -12,18 +12,18 @@
namespace Kernel
{
- STATIC FilesystemManagerInterface* kMounted = nullptr;
+ STATIC FilesystemMgrInterface* kMounted = nullptr;
- /// @brief FilesystemManager getter.
+ /// @brief FilesystemMgr getter.
/// @return The mounted filesystem.
- _Output FilesystemManagerInterface* FilesystemManagerInterface::GetMounted()
+ _Output FilesystemMgrInterface* FilesystemMgrInterface::GetMounted()
{
return kMounted;
}
/// @brief Unmount filesystem.
/// @return The unmounted filesystem.
- _Output FilesystemManagerInterface* FilesystemManagerInterface::Unmount()
+ _Output FilesystemMgrInterface* FilesystemMgrInterface::Unmount()
{
if (kMounted)
{
@@ -39,7 +39,7 @@ namespace Kernel
/// @brief Mount filesystem.
/// @param mount_ptr The filesystem to mount.
/// @return if it succeeded true, otherwise false.
- bool FilesystemManagerInterface::Mount(_Input FilesystemManagerInterface* mount_ptr)
+ bool FilesystemMgrInterface::Mount(_Input FilesystemMgrInterface* mount_ptr)
{
if (mount_ptr != nullptr)
{
@@ -55,7 +55,7 @@ namespace Kernel
/// @param path
/// @param r
/// @return
- _Output NodePtr NewFilesystemManager::Open(_Input const Char* path, _Input const Char* r)
+ _Output NodePtr NewFilesystemMgr::Open(_Input const Char* path, _Input const Char* r)
{
if (!path || *path == 0)
return nullptr;
@@ -73,7 +73,7 @@ namespace Kernel
/// @param data the data.
/// @param flags the size.
/// @return
- Void NewFilesystemManager::Write(_Input NodePtr node, _Input VoidPtr data, _Input Int32 flags, _Input SizeT size)
+ Void NewFilesystemMgr::Write(_Input NodePtr node, _Input VoidPtr data, _Input Int32 flags, _Input SizeT size)
{
if (!node)
return;
@@ -89,7 +89,7 @@ namespace Kernel
/// @param flags the flags with it.
/// @param sz the size to read.
/// @return
- _Output VoidPtr NewFilesystemManager::Read(_Input NodePtr node, _Input Int32 flags, _Input SizeT size)
+ _Output VoidPtr NewFilesystemMgr::Read(_Input NodePtr node, _Input Int32 flags, _Input SizeT size)
{
if (!node)
return nullptr;
@@ -100,7 +100,7 @@ namespace Kernel
return this->Read(cDataForkName, node, flags, size);
}
- Void NewFilesystemManager::Write(_Input const Char* name,
+ Void NewFilesystemMgr::Write(_Input const Char* name,
_Input NodePtr node,
_Input VoidPtr data,
_Input Int32 flags,
@@ -120,7 +120,7 @@ namespace Kernel
name);
}
- _Output VoidPtr NewFilesystemManager::Read(_Input const Char* name,
+ _Output VoidPtr NewFilesystemMgr::Read(_Input const Char* name,
_Input NodePtr node,
_Input Int32 flags,
_Input SizeT sz)
@@ -146,7 +146,7 @@ namespace Kernel
/// @retval true always returns false, this is unimplemented.
/// @retval false always returns this, it is unimplemented.
- _Output Bool NewFilesystemManager::Seek(NodePtr node, SizeT off)
+ _Output Bool NewFilesystemMgr::Seek(NodePtr node, SizeT off)
{
if (!node || off == 0)
return false;
@@ -159,7 +159,7 @@ namespace Kernel
/// @retval true always returns false, this is unimplemented.
/// @retval false always returns this, it is unimplemented.
- _Output SizeT NewFilesystemManager::Tell(NodePtr node)
+ _Output SizeT NewFilesystemMgr::Tell(NodePtr node)
{
if (!node)
return kNPos;
@@ -172,7 +172,7 @@ namespace Kernel
/// @retval true always returns false, this is unimplemented.
/// @retval false always returns this, it is unimplemented.
- _Output Bool NewFilesystemManager::Rewind(NodePtr node)
+ _Output Bool NewFilesystemMgr::Rewind(NodePtr node)
{
if (!node)
return false;
@@ -182,7 +182,7 @@ namespace Kernel
/// @brief Returns the filesystem parser.
/// @return the Filesystem parser class.
- _Output NewFSParser* NewFilesystemManager::GetParser() noexcept
+ _Output NewFSParser* NewFilesystemMgr::GetParser() noexcept
{
return fImpl;
}
diff --git a/dev/ZKA/Sources/Heap.cxx b/dev/ZKA/Sources/Heap.cxx
index e036badb..615f5664 100644
--- a/dev/ZKA/Sources/Heap.cxx
+++ b/dev/ZKA/Sources/Heap.cxx
@@ -8,7 +8,7 @@
#include <KernelKit/LPC.hxx>
#include <KernelKit/Heap.hxx>
#include <NewKit/Crc32.hxx>
-#include <NewKit/PageManager.hxx>
+#include <NewKit/PageMgr.hxx>
//! @file KernelHeap.cxx
//! @brief Kernel heap allocator.
@@ -19,7 +19,7 @@
namespace Kernel
{
SizeT kHeapCount = 0UL;
- PageManager kHeapPageManager;
+ PageMgr kHeapPageMgr;
Bool kOperationInProgress = No;
/// @brief Contains data structures and algorithms for the heap.
@@ -71,13 +71,13 @@ namespace Kernel
if (!allocatedPtr || newSz < 1)
return nullptr;
- Detail::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk =
+ Detail::HEAP_INFORMATION_BLOCK_PTR heap_blk =
reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>(
(UIntPtr)allocatedPtr - sizeof(Detail::HEAP_INFORMATION_BLOCK));
- heapInfoBlk->fHeapSize = newSz;
+ heap_blk->fHeapSize = newSz;
- if (heapInfoBlk->fCRC32 > 0)
+ if (heap_blk->fCRC32 > 0)
{
MUST_PASS(mm_protect_ke_heap(allocatedPtr));
}
@@ -97,9 +97,9 @@ namespace Kernel
auto szFix = sz;
if (szFix == 0)
- ++szFix;
+ return nullptr;
- auto wrapper = kHeapPageManager.Request(rw, user, No, szFix);
+ auto wrapper = kHeapPageMgr.Request(rw, user, No, szFix);
Detail::HEAP_INFORMATION_BLOCK_PTR heap_info_ptr =
reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>(
@@ -107,11 +107,11 @@ namespace Kernel
heap_info_ptr->fHeapSize = szFix;
heap_info_ptr->fMagic = kKernelHeapMagic;
- heap_info_ptr->fCRC32 = 0U; // dont fill it for now.
- heap_info_ptr->fHeapPtr = wrapper.VirtualAddress() + sizeof(Detail::HEAP_INFORMATION_BLOCK);
- heap_info_ptr->fPage = 0UL;
+ heap_info_ptr->fCRC32 = No; // dont fill it for now.
+ heap_info_ptr->fHeapPtr = reinterpret_cast<UIntPtr>(heap_info_ptr) + sizeof(Detail::HEAP_INFORMATION_BLOCK);
+ heap_info_ptr->fPage = No;
heap_info_ptr->fUser = user;
- heap_info_ptr->fPresent = true;
+ heap_info_ptr->fPresent = No;
++kHeapCount;
@@ -138,11 +138,11 @@ namespace Kernel
Detail::mm_alloc_init_timeout();
- Detail::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk =
+ Detail::HEAP_INFORMATION_BLOCK_PTR heap_blk =
reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>(
(UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK));
- heapInfoBlk->fPage = true;
+ heap_blk->fPage = true;
Detail::mm_alloc_fini_timeout();
@@ -156,48 +156,47 @@ namespace Kernel
{
if (kHeapCount < 1)
return -kErrorInternal;
- if (((IntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)) <= 0)
- return -kErrorInternal;
- if (((IntPtr)heap_ptr - kInvalidAddress) < 0)
- return -kErrorInternal;
+
+ if (!heap_ptr)
+ return -kErrorInvalidData;
Detail::mm_alloc_init_timeout();
- Detail::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk =
+ Detail::HEAP_INFORMATION_BLOCK_PTR heap_blk =
reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>(
(UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK));
- if (heapInfoBlk && heapInfoBlk->fMagic == kKernelHeapMagic)
+ if (heap_blk && heap_blk->fMagic == kKernelHeapMagic)
{
- if (!heapInfoBlk->fPresent)
+ if (!heap_blk->fPresent)
{
Detail::mm_alloc_fini_timeout();
return -kErrorHeapNotPresent;
}
- if (heapInfoBlk->fCRC32 != 0)
+ if (heap_blk->fCRC32 != 0)
{
- if (heapInfoBlk->fCRC32 !=
- ke_calculate_crc32((Char*)heapInfoBlk->fHeapPtr,
- heapInfoBlk->fHeapSize))
+ if (heap_blk->fCRC32 !=
+ ke_calculate_crc32((Char*)heap_blk->fHeapPtr,
+ heap_blk->fHeapSize))
{
- if (!heapInfoBlk->fUser)
+ if (!heap_blk->fUser)
{
ke_stop(RUNTIME_CHECK_POINTER);
}
}
}
- heapInfoBlk->fHeapSize = 0UL;
- heapInfoBlk->fPresent = false;
- heapInfoBlk->fHeapPtr = 0;
- heapInfoBlk->fCRC32 = 0;
- heapInfoBlk->fMagic = 0;
+ heap_blk->fHeapSize = 0UL;
+ heap_blk->fPresent = No;
+ heap_blk->fHeapPtr = 0;
+ heap_blk->fCRC32 = 0;
+ heap_blk->fMagic = 0;
- PTEWrapper pageWrapper(false, false, false, reinterpret_cast<UIntPtr>(heapInfoBlk) - sizeof(Detail::HEAP_INFORMATION_BLOCK));
- Ref<PTEWrapper*> pteAddress{&pageWrapper};
+ PTEWrapper pageWrapper(false, false, false, reinterpret_cast<UIntPtr>(heap_blk) - sizeof(Detail::HEAP_INFORMATION_BLOCK));
+ Ref<PTEWrapper> pteAddress{pageWrapper};
- kHeapPageManager.Free(pteAddress);
+ kHeapPageMgr.Free(pteAddress);
--kHeapCount;
@@ -239,14 +238,14 @@ namespace Kernel
{
if (heap_ptr)
{
- Detail::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk =
+ Detail::HEAP_INFORMATION_BLOCK_PTR heap_blk =
reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>(
(UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK));
- if (heapInfoBlk->fPresent && kKernelHeapMagic == heapInfoBlk->fMagic)
+ if (heap_blk->fPresent && kKernelHeapMagic == heap_blk->fMagic)
{
- heapInfoBlk->fCRC32 =
- ke_calculate_crc32((Char*)heapInfoBlk->fHeapPtr, heapInfoBlk->fHeapSize);
+ heap_blk->fCRC32 =
+ ke_calculate_crc32((Char*)heap_blk->fHeapPtr, heap_blk->fHeapSize);
return true;
}
diff --git a/dev/ZKA/Sources/MP.cxx b/dev/ZKA/Sources/MP.cxx
index 7429751f..c5cab5dc 100644
--- a/dev/ZKA/Sources/MP.cxx
+++ b/dev/ZKA/Sources/MP.cxx
@@ -17,12 +17,6 @@
namespace Kernel
{
- /***********************************************************************************/
- /// @brief MP object container property.
- /***********************************************************************************/
-
- Property cSMPCoreName;
-
///! A HardwareThread class takes care of it's owned hardware thread.
///! It has a stack for it's core.
@@ -102,13 +96,13 @@ namespace Kernel
{
return mp_register_process(fStack);
}
-
- //! SMP is disabled here.
-
- mp_do_context_switch_pre();
- mp_do_context_switch(image, stack_ptr, fStack);
-
- return true;
+ else
+ {
+ mp_do_context_switch_pre();
+ mp_do_context_switch(image, stack_ptr, fStack);
+
+ return false;
+ }
}
///! @brief Tells if processor is waked up.
@@ -123,15 +117,7 @@ namespace Kernel
///! @brief Constructor and destructors.
///! @brief Default constructor.
- HardwareThreadScheduler::HardwareThreadScheduler()
- {
- kcout << "newoskrnl.exe: Initializing HardwareThreadScheduler." << endl;
-
- cSMPCoreName.GetKey() += "Property\\MPClass";
- cSMPCoreName.GetValue() = (PropertyId)this;
-
- kcout << "newoskrnl.exe: Initialized HardwareThreadScheduler." << endl;
- }
+ HardwareThreadScheduler::HardwareThreadScheduler() = default;
///! @brief Default destructor.
HardwareThreadScheduler::~HardwareThreadScheduler() = default;
diff --git a/dev/ZKA/Sources/NewFS+FileManager.cxx b/dev/ZKA/Sources/NewFS+FileMgr.cxx
index 20fb623d..dd0d4a21 100644
--- a/dev/ZKA/Sources/NewFS+FileManager.cxx
+++ b/dev/ZKA/Sources/NewFS+FileMgr.cxx
@@ -4,7 +4,7 @@
------------------------------------------- */
-#include <KernelKit/FileManager.hxx>
+#include <KernelKit/FileMgr.hxx>
#include <KernelKit/Heap.hxx>
#ifdef __FSKIT_USE_NEWFS__
@@ -15,16 +15,16 @@
namespace Kernel
{
/// @brief C++ constructor
- NewFilesystemManager::NewFilesystemManager()
+ NewFilesystemMgr::NewFilesystemMgr()
{
MUST_PASS(Detail::fs_init_newfs());
fImpl = new NewFSParser();
MUST_PASS(fImpl);
- kcout << "newoskrnl.exe: We are done here... (NewFilesystemManager).\r";
+ kcout << "newoskrnl.exe: We are done here... (NewFilesystemMgr).\r";
}
- NewFilesystemManager::~NewFilesystemManager()
+ NewFilesystemMgr::~NewFilesystemMgr()
{
kcout << "newoskrnl.exe: Destroying it...\r";
@@ -37,7 +37,7 @@ namespace Kernel
/// @brief Removes a node from the filesystem.
/// @param fileName The filename
/// @return If it was deleted or not.
- bool NewFilesystemManager::Remove(const Char* fileName)
+ bool NewFilesystemMgr::Remove(const Char* fileName)
{
if (fileName == nullptr || *fileName == 0)
return false;
@@ -48,7 +48,7 @@ namespace Kernel
/// @brief Creates a node with the specified.
/// @param path The filename path.
/// @return The Node pointer.
- NodePtr NewFilesystemManager::Create(const Char* path)
+ NodePtr NewFilesystemMgr::Create(const Char* path)
{
return node_cast(fImpl->CreateCatalog(path));
}
@@ -56,7 +56,7 @@ namespace Kernel
/// @brief Creates a node with is a directory.
/// @param path The filename path.
/// @return The Node pointer.
- NodePtr NewFilesystemManager::CreateDirectory(const Char* path)
+ NodePtr NewFilesystemMgr::CreateDirectory(const Char* path)
{
return node_cast(fImpl->CreateCatalog(path, 0, kNewFSCatalogKindDir));
}
@@ -64,7 +64,7 @@ namespace Kernel
/// @brief Creates a node with is a alias.
/// @param path The filename path.
/// @return The Node pointer.
- NodePtr NewFilesystemManager::CreateAlias(const Char* path)
+ NodePtr NewFilesystemMgr::CreateAlias(const Char* path)
{
return node_cast(fImpl->CreateCatalog(path, 0, kNewFSCatalogKindAlias));
}
@@ -72,7 +72,7 @@ namespace Kernel
/// @brief Creates a node with is a page file.
/// @param path The filename path.
/// @return The Node pointer.
- NodePtr NewFilesystemManager::CreateSwapFile(const Char* path)
+ NodePtr NewFilesystemMgr::CreateSwapFile(const Char* path)
{
return node_cast(fImpl->CreateCatalog(path, 0, kNewFSCatalogKindPage));
}
diff --git a/dev/ZKA/Sources/NewFS+IO.cxx b/dev/ZKA/Sources/NewFS+IO.cxx
index ddcecde4..e1a6ac95 100644
--- a/dev/ZKA/Sources/NewFS+IO.cxx
+++ b/dev/ZKA/Sources/NewFS+IO.cxx
@@ -4,8 +4,8 @@
------------------------------------------- */
-#include <KernelKit/DriveManager.hxx>
-#include <KernelKit/FileManager.hxx>
+#include <KernelKit/DriveMgr.hxx>
+#include <KernelKit/FileMgr.hxx>
/*************************************************************
*
diff --git a/dev/ZKA/Sources/NewFS+Journal.cxx b/dev/ZKA/Sources/NewFS+Journal.cxx
index 6504b2bc..2f63cc9a 100644
--- a/dev/ZKA/Sources/NewFS+Journal.cxx
+++ b/dev/ZKA/Sources/NewFS+Journal.cxx
@@ -5,7 +5,7 @@
------------------------------------------- */
#include <KernelKit/DebugOutput.hxx>
-#include <KernelKit/FileManager.hxx>
+#include <KernelKit/FileMgr.hxx>
#ifdef __FSKIT_USE_NEWFS__
diff --git a/dev/ZKA/Sources/PEFCodeManager.cxx b/dev/ZKA/Sources/PEFCodeMgr.cxx
index 526312e0..feafc35c 100644
--- a/dev/ZKA/Sources/PEFCodeManager.cxx
+++ b/dev/ZKA/Sources/PEFCodeMgr.cxx
@@ -6,7 +6,7 @@
#include <KernelKit/DebugOutput.hxx>
#include <KernelKit/Heap.hxx>
-#include <KernelKit/PEFCodeManager.hxx>
+#include <KernelKit/PEFCodeMgr.hxx>
#include <KernelKit/UserProcessScheduler.hxx>
#include <NewKit/Defines.hxx>
#include <NewKit/KernelCheck.hxx>
@@ -87,7 +87,7 @@ namespace Kernel
if (fCachedBlob)
mm_delete_ke_heap(fCachedBlob);
- kcout << "CodeManagerPEF: Warning: Executable format error!\r";
+ kcout << "CodeMgrPEF: Warning: Executable format error!\r";
fCachedBlob = nullptr;
}
diff --git a/dev/ZKA/Sources/PageManager.cxx b/dev/ZKA/Sources/PageMgr.cxx
index dd18709f..78b279f3 100644
--- a/dev/ZKA/Sources/PageManager.cxx
+++ b/dev/ZKA/Sources/PageMgr.cxx
@@ -5,7 +5,7 @@
------------------------------------------- */
#include <KernelKit/DebugOutput.hxx>
-#include <NewKit/PageManager.hxx>
+#include <NewKit/PageMgr.hxx>
#ifdef __ZKA_AMD64__
#include <HALKit/AMD64/HalPageAlloc.hxx>
@@ -35,7 +35,7 @@ namespace Kernel
/// @brief Flush virtual address.
/// @param VirtAddr
- Void PageManager::FlushTLB()
+ Void PageMgr::FlushTLB()
{
hal_flush_tlb();
}
@@ -58,7 +58,7 @@ namespace Kernel
/// @param User user mode?
/// @param ExecDisable disable execution on page?
/// @return
- PTEWrapper PageManager::Request(Boolean Rw, Boolean User, Boolean ExecDisable, SizeT Sz)
+ PTEWrapper PageMgr::Request(Boolean Rw, Boolean User, Boolean ExecDisable, SizeT Sz)
{
// Store PTE wrapper right after PTE.
VoidPtr ptr = Kernel::HAL::mm_alloc_bitmap(Rw, User, Sz);
@@ -69,9 +69,9 @@ namespace Kernel
/// @brief Disable BitMap.
/// @param wrapper the wrapper.
/// @return If the page bitmap was cleared or not.
- Bool PageManager::Free(Ref<PTEWrapper*>& wrapper)
+ Bool PageMgr::Free(Ref<PTEWrapper>& wrapper)
{
- if (!Kernel::HAL::mm_free_bitmap((VoidPtr)wrapper->VirtualAddress()))
+ if (!Kernel::HAL::mm_free_bitmap((VoidPtr)wrapper.Leak().VirtualAddress()))
return false;
return true;
diff --git a/dev/ZKA/Sources/Pmm.cxx b/dev/ZKA/Sources/Pmm.cxx
index b0855281..58335a2b 100644
--- a/dev/ZKA/Sources/Pmm.cxx
+++ b/dev/ZKA/Sources/Pmm.cxx
@@ -19,9 +19,9 @@ namespace Kernel
{
/// @brief Pmm constructor.
Pmm::Pmm()
- : fPageManager()
+ : fPageMgr()
{
- kcout << "[PMM] Allocate PageMemoryManager";
+ kcout << "[PMM] Allocate PageMemoryMgr";
}
Pmm::~Pmm() = default;
@@ -31,17 +31,15 @@ namespace Kernel
/// @param readWrite is it r/w?
Ref<PTEWrapper> Pmm::RequestPage(Boolean user, Boolean readWrite)
{
- PTEWrapper pt = fPageManager.Leak().Request(user, readWrite, false, kPTESize);
+ PTEWrapper pt = fPageMgr.Leak().Request(user, readWrite, false, kPTESize);
if (pt.fPresent)
{
- kcout << "[PMM]: Allocation was successful.\r";
- return Ref<PTEWrapper>(pt);
+ kcout << "[PMM]: Allocation failed.\r";
+ return {};
}
- kcout << "[PMM]: Allocation failed.\r";
-
- return {};
+ return Ref<PTEWrapper>(pt);
}
Boolean Pmm::FreePage(Ref<PTEWrapper> PageRef)
diff --git a/dev/ZKA/Sources/Storage/ATADeviceInterface.cxx b/dev/ZKA/Sources/Storage/ATADeviceInterface.cxx
index 183481e1..97d2e2e4 100644
--- a/dev/ZKA/Sources/Storage/ATADeviceInterface.cxx
+++ b/dev/ZKA/Sources/Storage/ATADeviceInterface.cxx
@@ -43,7 +43,7 @@ ATADeviceInterface& ATADeviceInterface::operator<<(MountpointInterface* Data)
if (!Data)
return *this;
- for (SizeT driveCount = 0; driveCount < kDriveManagerCount; ++driveCount)
+ for (SizeT driveCount = 0; driveCount < kDriveMgrCount; ++driveCount)
{
auto interface = Data->GetAddressOf(driveCount);
if ((interface) && rt_string_cmp((interface)->fDriveKind(), "ATA-", 5) == 0)
@@ -69,7 +69,7 @@ ATADeviceInterface& ATADeviceInterface::operator>>(MountpointInterface* Data)
if (!Data)
return *this;
- for (SizeT driveCount = 0; driveCount < kDriveManagerCount; ++driveCount)
+ for (SizeT driveCount = 0; driveCount < kDriveMgrCount; ++driveCount)
{
auto interface = Data->GetAddressOf(driveCount);
if ((interface) && rt_string_cmp((interface)->fDriveKind(), "ATA-", 5) == 0)
diff --git a/dev/ZKA/Sources/User.cxx b/dev/ZKA/Sources/User.cxx
index 871d011f..5aa688be 100644
--- a/dev/ZKA/Sources/User.cxx
+++ b/dev/ZKA/Sources/User.cxx
@@ -13,7 +13,7 @@
#include <KernelKit/LPC.hxx>
#include <KernelKit/User.hxx>
#include <NewKit/KernelCheck.hxx>
-#include <KernelKit/FileManager.hxx>
+#include <KernelKit/FileMgr.hxx>
#include <KernelKit/UserProcessScheduler.hxx>
#include <KernelKit/Heap.hxx>
diff --git a/dev/ZKA/Sources/UserProcessScheduler.cxx b/dev/ZKA/Sources/UserProcessScheduler.cxx
index 26d8be79..48988e57 100644
--- a/dev/ZKA/Sources/UserProcessScheduler.cxx
+++ b/dev/ZKA/Sources/UserProcessScheduler.cxx
@@ -34,7 +34,7 @@ namespace Kernel
/// @brief UserProcess scheduler instance.
/***********************************************************************************/
- STATIC UserProcessScheduler* cProcessScheduler;
+ STATIC UserProcessScheduler* cProcessScheduler = nullptr;
/// @brief Gets the last exit code.
/// @note Not thread-safe.
diff --git a/dev/ZKA/StorageKit/AHCI.hxx b/dev/ZKA/StorageKit/AHCI.hxx
index 3e9567a5..f3d771c9 100644
--- a/dev/ZKA/StorageKit/AHCI.hxx
+++ b/dev/ZKA/StorageKit/AHCI.hxx
@@ -6,8 +6,8 @@
#pragma once
-#include <KernelKit/DeviceManager.hxx>
-#include <KernelKit/DriveManager.hxx>
+#include <KernelKit/DeviceMgr.hxx>
+#include <KernelKit/DriveMgr.hxx>
#include <NewKit/OwnPtr.hxx>
namespace Kernel
diff --git a/dev/ZKA/StorageKit/ATA.hxx b/dev/ZKA/StorageKit/ATA.hxx
index be3e4a21..e954b0e7 100644
--- a/dev/ZKA/StorageKit/ATA.hxx
+++ b/dev/ZKA/StorageKit/ATA.hxx
@@ -6,8 +6,8 @@
#pragma once
-#include <KernelKit/DeviceManager.hxx>
-#include <KernelKit/DriveManager.hxx>
+#include <KernelKit/DeviceMgr.hxx>
+#include <KernelKit/DriveMgr.hxx>
#include <NewKit/OwnPtr.hxx>
#include <NewKit/Utils.hxx>
diff --git a/dev/ZKA/StorageKit/NVME.hxx b/dev/ZKA/StorageKit/NVME.hxx
index c0231f57..45d00c0c 100644
--- a/dev/ZKA/StorageKit/NVME.hxx
+++ b/dev/ZKA/StorageKit/NVME.hxx
@@ -6,8 +6,8 @@
#pragma once
-#include <KernelKit/DeviceManager.hxx>
-#include <KernelKit/DriveManager.hxx>
+#include <KernelKit/DeviceMgr.hxx>
+#include <KernelKit/DriveMgr.hxx>
#include <NewKit/OwnPtr.hxx>
namespace Kernel
diff --git a/dev/ZKA/amd64-efi.make b/dev/ZKA/amd64-efi.make
index 0e8cbad4..4d1f9403 100644
--- a/dev/ZKA/amd64-efi.make
+++ b/dev/ZKA/amd64-efi.make
@@ -35,7 +35,7 @@ COPY = cp
ASMFLAGS = -f win64
# Kernel subsystem is 17 and entrypoint is __ImageStart
-LDFLAGS = -e hal_init_platform --subsystem=17 --image-base 0x1000000
+LDFLAGS = -e hal_init_platform --subsystem=17 --image-base 0x10000000
LDOBJ = Objects/*.obj
# This file is the Kernel, responsible of task, memory, driver, sci, disk and device management.