summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
authorAmlal <amlal@el-mahrouss-logic.com>2024-09-08 22:19:00 +0200
committerAmlal <amlal@el-mahrouss-logic.com>2024-09-08 22:19:00 +0200
commitef71b80d3df1969a2be85eadf2d83cd85745469d (patch)
tree218415d633ba1010f57f218a139c791e7a737e4f /dev
parent11219de11b35cb4f1e1a27408244243b11b41e05 (diff)
A lot:
- Changed task banks are being switched in the kernel. - Changed user mode switch mode, improved it to push rflags. - User proc will start the scheduler when it's being jumped on. Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev')
-rw-r--r--dev/DLL/MakeFS/.keepme0
-rw-r--r--dev/DLL/RunDLL64/Sources/LauncherMain.cxx4
-rw-r--r--dev/DLL/WRenderer/.keep0
-rw-r--r--dev/DLL/WRenderer/CoreDefs.hxx26
-rw-r--r--dev/DLL/WRenderer/ReadMe.md5
-rw-r--r--dev/DLL/WRenderer/Sources/UIRenderView.cxx34
-rw-r--r--dev/DLL/WRenderer/build.json20
-rw-r--r--dev/DLL/ZKAVer/.keepme0
-rw-r--r--dev/HPFS/EPM/EBS.i17
-rw-r--r--dev/HPFS/EPM/EPM.asm14
-rw-r--r--dev/HPFS/EPM/blob.json6
-rw-r--r--dev/HPFS/Sources/IFSMain.cxx4
-rw-r--r--dev/ZBA/Sources/HEL/AMD64/BootMain.cxx2
-rw-r--r--dev/ZKA/ArchKit/ArchKit.hxx4
-rw-r--r--dev/ZKA/HALKit/AMD64/HalCoreMPScheduler.cxx2
-rw-r--r--dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm35
-rw-r--r--dev/ZKA/HALKit/ARM64/HalSchedulerCore.cxx2
-rw-r--r--dev/ZKA/HALKit/POWER/HalContextSwitchPowerPC.s6
-rw-r--r--dev/ZKA/Sources/ExeMain.cxx7
-rw-r--r--dev/ZKA/Sources/HardwareThreadScheduler.cxx25
20 files changed, 68 insertions, 145 deletions
diff --git a/dev/DLL/MakeFS/.keepme b/dev/DLL/MakeFS/.keepme
deleted file mode 100644
index e69de29b..00000000
--- a/dev/DLL/MakeFS/.keepme
+++ /dev/null
diff --git a/dev/DLL/RunDLL64/Sources/LauncherMain.cxx b/dev/DLL/RunDLL64/Sources/LauncherMain.cxx
index 0d64b654..2553feda 100644
--- a/dev/DLL/RunDLL64/Sources/LauncherMain.cxx
+++ b/dev/DLL/RunDLL64/Sources/LauncherMain.cxx
@@ -1,6 +1,6 @@
#include <SCI/sci_base.hxx>
-typedef int (*main_t)(int, char**);
+typedef int (*MainKind)(int, char**);
int WinMain(int argc, char* argv[])
{
@@ -9,7 +9,7 @@ int WinMain(int argc, char* argv[])
auto mainDll = LdrOpenDLL(argv[1], argv[2]);
- int (*entrypointOff)(int, char**) = (main_t)LdrGetDLLProc(argv[3], mainDll);
+ int (*entrypointOff)(int, char**) = (MainKind)LdrGetDLLProc(argv[3], mainDll);
if (!entrypointOff)
return -1;
diff --git a/dev/DLL/WRenderer/.keep b/dev/DLL/WRenderer/.keep
deleted file mode 100644
index e69de29b..00000000
--- a/dev/DLL/WRenderer/.keep
+++ /dev/null
diff --git a/dev/DLL/WRenderer/CoreDefs.hxx b/dev/DLL/WRenderer/CoreDefs.hxx
deleted file mode 100644
index 28eff7ef..00000000
--- a/dev/DLL/WRenderer/CoreDefs.hxx
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies.
-
-------------------------------------------- */
-
-#pragma once
-
-#include <Modules/CoreCG/FbRenderer.hxx>
-#include <Modules/CoreCG/WindowRenderer.hxx>
-
-namespace System
-{
- class UIRenderEffect;
- class UIRenderCanvas;
- class UIRenderView; // phone desktop, computer desktop, remote desktop.
-
- enum
- {
- eDesktopInvalid,
- eDesktopPC,
- eDesktopMobile,
- eDestkopRemote,
- eDesktopCount,
- };
-} // namespace System
diff --git a/dev/DLL/WRenderer/ReadMe.md b/dev/DLL/WRenderer/ReadMe.md
deleted file mode 100644
index 53c2ba24..00000000
--- a/dev/DLL/WRenderer/ReadMe.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# ZKA Window Renderer.
-
-Acts as the main rendering engine of the UI stack.
-
-###### (c) ZKA Technologies, all rights reserved.
diff --git a/dev/DLL/WRenderer/Sources/UIRenderView.cxx b/dev/DLL/WRenderer/Sources/UIRenderView.cxx
deleted file mode 100644
index d4281675..00000000
--- a/dev/DLL/WRenderer/Sources/UIRenderView.cxx
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies.
-
-------------------------------------------- */
-
-#include <UIRenderView.hxx>
-
-/// @file Renderer.cxx
-/// @brief 2D UI renderer, using GX APIs.
-
-namespace System
-{
- UIRenderView::UIRenderView() = default;
- UIRenderView::~UIRenderView() = default;
-
- UIRenderEffect* UIRenderView::GetEffect(const SizeT& at)
- {
- if (!this->fEffects->Contains(at))
- {
- return nullptr;
- }
-
- return this->fEffects[at];
- }
-
- SizeT UIRenderView::AddEffect(const UIRenderEffect* effect)
- {
- if (!effect)
- return (SizeT)-1;
-
- return this->fEffects->Add(effect);
- }
-} // namespace System
diff --git a/dev/DLL/WRenderer/build.json b/dev/DLL/WRenderer/build.json
deleted file mode 100644
index 7a166044..00000000
--- a/dev/DLL/WRenderer/build.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "compiler_path": "x86_64-w64-mingw32-g++",
- "compiler_std": "c++20",
- "headers_path": ["../"],
- "sources_path": ["Sources/*.cxx"],
- "output_name": "wrenderer.dll",
- "compiler_flags": [
- "-ffreestanding",
- "-shared",
- "-fno-rtti",
- "-fno-exceptions",
- "-Wl,--subsystem=17"
- ],
- "cpp_macros": [
- "__WRENDER_IMPL__",
- "cWRVersion=0x0100",
- "cWRVersionHighest=0x0100",
- "cWRVersionLowest=0x0100"
- ]
-}
diff --git a/dev/DLL/ZKAVer/.keepme b/dev/DLL/ZKAVer/.keepme
deleted file mode 100644
index e69de29b..00000000
--- a/dev/DLL/ZKAVer/.keepme
+++ /dev/null
diff --git a/dev/HPFS/EPM/EBS.i b/dev/HPFS/EPM/EBS.i
index 3c55825b..4fc529da 100644
--- a/dev/HPFS/EPM/EBS.i
+++ b/dev/HPFS/EPM/EBS.i
@@ -7,7 +7,8 @@
;; DUMP THIS BLOB TO DISK, WHEN FORMATTING THE SSD.
HPFS_EBS_HEADER:
- db "HPFS ", 0 ;; MAGIC NUMBER OF FILESYSTEM
+ db " HPFS" ;; MAGIC NUMBER OF FILESYSTEM
+ dw 8 ;; MAGIC NUMBER LENGTH.
dq 0 ;; RESERVED 4
dw 1 ;; VERSION
dw 0 ;; PARTITION TYPE
@@ -19,10 +20,10 @@ HPFS_EBS_HEADER:
dq 0 ;; RESERVED 2
dq 512 ;; SECTOR SZ
dq 0 ;; DISK SIZE
- dq 0 ;; RESERVED 1
- dq 0 ;; LOCKER ON?
- dq 0 ;; PARTITION MAP TYPE (GPT, MBR, EPM)
- dq 0 ;; MASTER FILE TABLE
- dq 0 ;; MASTER TRACE TABLE
- dq 0 ;; MASTER DIRECTORY TABLE
- dw 0xFFFF ;; END OF HEADER WORD \ No newline at end of file
+ dq 0 ;; RESERVED 1 SLOT
+ dq 1 ;; LOCKER ON?
+ dq 1 ;; PARTITION MAP TYPE (GPT, MBR, EPM)
+ dq 16 ;; MASTER FILE TABLE
+ dq 80 ;; MASTER TRACE TABLE
+ dq 144 ;; MASTER DIRECTORY TABLE
+ dw 0xFFFF ;; END OF HEADER WORD
diff --git a/dev/HPFS/EPM/EPM.asm b/dev/HPFS/EPM/EPM.asm
index fadb555c..2197d2cd 100644
--- a/dev/HPFS/EPM/EPM.asm
+++ b/dev/HPFS/EPM/EPM.asm
@@ -18,18 +18,20 @@ HPFS_EPM_UUID:
db 0
db 0
db 0
- dd 0xAD ;; REVISON
- dd 0 ;; NUM BLOCKS
- dd 512 ;; SECTOR SZ
+ dd 0xAD ;; EPM revision
+ dd 0 ;; Number of blocks, set to 0 by default.
+ dd 512 ;; Sector size, HPFS was made with drives in mind, so 512.
dd 0
dd 0
- dw 0x1f ;; NewOS
+ dw 0x1f ;; NewOS (ZKA) present on partition.
dd 1
- db "FileSystem (C:)", 0
+ db "FileSystem (A:)", 0
times 401 db 0
HPFS_EPM_HEADER_END:
%include "EBS.i"
-times 512 db 0 \ No newline at end of file
+times 16 db 0
+
+;; Here the partition starts
diff --git a/dev/HPFS/EPM/blob.json b/dev/HPFS/EPM/blob.json
new file mode 100644
index 00000000..4ce4fc1c
--- /dev/null
+++ b/dev/HPFS/EPM/blob.json
@@ -0,0 +1,6 @@
+{
+ "compiler_path": "nasm",
+ "sources_path": ["EPM.asm"],
+ "output_name": "hpfs.bin",
+ "compiler_flags": ["-f bin"]
+}
diff --git a/dev/HPFS/Sources/IFSMain.cxx b/dev/HPFS/Sources/IFSMain.cxx
index 229efb15..d107db2a 100644
--- a/dev/HPFS/Sources/IFSMain.cxx
+++ b/dev/HPFS/Sources/IFSMain.cxx
@@ -9,6 +9,8 @@
#include <HPFS/Defines.hxx>
-HPFS_INT32 IFSStart(HPFS_VOID) {
+/** @brief HPFS IFS main. */
+HPFS_INT32 IFSStart(HPFS_VOID)
+{
return 0;
}
diff --git a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
index 1b09e63f..ca2f4975 100644
--- a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
+++ b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
@@ -310,7 +310,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
EFI::ExitBootServices(MapKey, ImageHandle);
// ---------------------------------------------------- //
- // finally load Kernel.
+ // Finally load Kernel, and the cr3 to it.
// ---------------------------------------------------- //
loader->Start(handoverHdrPtr);
diff --git a/dev/ZKA/ArchKit/ArchKit.hxx b/dev/ZKA/ArchKit/ArchKit.hxx
index 6e93359b..8ccb430c 100644
--- a/dev/ZKA/ArchKit/ArchKit.hxx
+++ b/dev/ZKA/ArchKit/ArchKit.hxx
@@ -107,6 +107,4 @@ inline Kernel::Array<HAL_SYSCALL_RECORD,
kKerncalls;
EXTERN_C Kernel::HAL::StackFramePtr mp_get_current_context();
-
-/// @note The context gives out the return address in return register.
-EXTERN_C Kernel::Void mp_do_context_switch(Kernel::VoidPtr image, Kernel::UInt8* stack_ptr, Kernel::HAL::StackFramePtr frame_ptr);
+EXTERN_C Kernel::Void mp_do_user_switch(Kernel::Void);
diff --git a/dev/ZKA/HALKit/AMD64/HalCoreMPScheduler.cxx b/dev/ZKA/HALKit/AMD64/HalCoreMPScheduler.cxx
index a5bf07ec..1a518c5d 100644
--- a/dev/ZKA/HALKit/AMD64/HalCoreMPScheduler.cxx
+++ b/dev/ZKA/HALKit/AMD64/HalCoreMPScheduler.cxx
@@ -152,7 +152,7 @@ namespace Kernel::HAL
VoidPtr f_Image;
} fBlocks[kSchedProcessLimitPerTeam] = {0};
- EXTERN_C HAL::StackFramePtr _hal_leak_current_context(Void)
+ EXTERN_C HAL::StackFramePtr mp_get_current_context(Void)
{
return fBlocks[UserProcessScheduler::The().CurrentProcess().Leak().ProcessId % kSchedProcessLimitPerTeam].f_Frame;
}
diff --git a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm
index 4403263a..c61db220 100644
--- a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm
+++ b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm
@@ -9,10 +9,7 @@
[bits 64]
-[global mp_get_current_context]
-[global mp_do_context_switch]
-[extern _hal_switch_context]
-[extern _hal_leak_current_context]
+[global mp_do_user_switch]
[global mp_do_context_switch_pre]
section .text
@@ -20,7 +17,7 @@ section .text
;; Does a user mode switch, and then loads the task to be run.
;; rcx: code ptr.
;; rdx: stack ptr.
-mp_do_context_switch:
+mp_do_user_switch:
mov ax, 0x18 | 3
mov ds, ax
mov es, ax
@@ -28,14 +25,28 @@ mp_do_context_switch:
mov fs, ax
push 0x18 | 3
- push rdx
- push 0x200
+
+ mov rax, mp_user_switch_proc_end
+ push rax
+
+ o64 pushf
+
push 0x20 | 3
- push rcx
+
+ mov rdx, mp_user_switch_proc
+ push rdx
+
+ mov rsp, mp_user_switch_proc_end
o64 iret
-;; @brief Gets the current stack frame.
-mp_get_current_context:
- call _hal_leak_current_context
- ret
+section .bss
+
+mp_user_switch_proc_begin:
+ resb 4*4096
+mp_user_switch_proc_end:
+
+section .text
+
+mp_user_switch_proc:
+ jmp $
diff --git a/dev/ZKA/HALKit/ARM64/HalSchedulerCore.cxx b/dev/ZKA/HALKit/ARM64/HalSchedulerCore.cxx
index 781c639a..2c801372 100644
--- a/dev/ZKA/HALKit/ARM64/HalSchedulerCore.cxx
+++ b/dev/ZKA/HALKit/ARM64/HalSchedulerCore.cxx
@@ -33,7 +33,7 @@ namespace Kernel
/// Wakes up thread from the hang state.
Void mp_wakeup_thread(HAL::StackFrame* stack)
{
- mp_do_context_switch(stack);
+ ZKA_UNUSED(stack);
}
/// @brief makes the thread sleep on a loop.
diff --git a/dev/ZKA/HALKit/POWER/HalContextSwitchPowerPC.s b/dev/ZKA/HALKit/POWER/HalContextSwitchPowerPC.s
index 9a9c3aa6..588de23a 100644
--- a/dev/ZKA/HALKit/POWER/HalContextSwitchPowerPC.s
+++ b/dev/ZKA/HALKit/POWER/HalContextSwitchPowerPC.s
@@ -7,10 +7,10 @@
.align 4
.type name, @function
.text
-.globl mp_do_context_switch
+.globl mp_do_user_switch
/* r3 (3) = assigner stack, r4 (4) = assignee stack */
-mp_do_context_switch:
+mp_do_user_switch:
lwz 0(%4), 0(%3)
lwz 4(%4), 4(%3)
lwz 8(%4), 8(%3)
@@ -24,5 +24,7 @@ mp_do_context_switch:
lwz 34(%4), 34(%3)
lwz 38(%4), 38(%3)
+ /* also change exception level */
+
/* we are done here, the assignee should start executing code now. */
blr
diff --git a/dev/ZKA/Sources/ExeMain.cxx b/dev/ZKA/Sources/ExeMain.cxx
index 2ac752ad..93bbb3e5 100644
--- a/dev/ZKA/Sources/ExeMain.cxx
+++ b/dev/ZKA/Sources/ExeMain.cxx
@@ -69,7 +69,7 @@ namespace Kernel::Detail
const Kernel::Char* cDirStr[cDirCount] = {
"\\Boot\\", "\\System\\", "\\Support\\", "\\Applications\\",
- "\\Users\\", "\\Library\\", "\\Mount\\", "\\Games\\", "\\Applications\\Java\\"};
+ "\\Users\\", "\\Library\\", "\\Mount\\", "\\Store\\", "\\Applications\\Store\\"};
if (fNeFS->GetParser())
{
@@ -146,8 +146,5 @@ EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void)
CG::CGDrawStringToWnd(cKernelWnd, "Running: ", 10, 10, RGB(0, 0, 0));
CG::CGDrawStringToWnd(cKernelWnd, kSysProcess, 10, 10 + (FONT_SIZE_X * Kernel::rt_string_len("Running: ")), RGB(0, 0, 0));
- while (Yes)
- {
- Kernel::UserProcessHelper::StartScheduling();
- }
+ mp_do_user_switch();
}
diff --git a/dev/ZKA/Sources/HardwareThreadScheduler.cxx b/dev/ZKA/Sources/HardwareThreadScheduler.cxx
index 09eadefb..e5947357 100644
--- a/dev/ZKA/Sources/HardwareThreadScheduler.cxx
+++ b/dev/ZKA/Sources/HardwareThreadScheduler.cxx
@@ -97,27 +97,16 @@ namespace Kernel
fStack = frame;
- if (kHandoverHeader->f_HardwareTables.f_MultiProcessingEnabled)
- {
- if (this->IsBusy())
- return false;
+ if (this->IsBusy())
+ return false;
- kcout << "Switching to the Process's HW thread...\r";
+ kcout << "Registering process bank...\r";
- this->Busy(true);
- Bool ret = mp_register_process(image, stack_ptr, fStack);
- this->Busy(false);
+ this->Busy(true);
+ Bool ret = mp_register_process(image, stack_ptr, fStack);
+ this->Busy(false);
- return ret;
- }
- else
- {
- kcout << "Switching to the Process's thread...\r";
-
- mp_do_context_switch(image, stack_ptr, fStack);
-
- return Yes;
- }
+ return ret;
}
///! @brief Tells if processor is waked up.