summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKA/Sources
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-09-03 19:55:57 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-09-03 19:55:57 +0200
commitafe7a2048513132f5ab28a8c5cdb6cbbc6e04993 (patch)
treea4b9082672097c170479e92afb400e287b0a2b78 /dev/ZKA/Sources
parenta4114685aa464471bcc6d4df39e184d85dd991c7 (diff)
[ IMP ] Many improvements and kernel changes.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA/Sources')
-rw-r--r--dev/ZKA/Sources/CodeManager.cxx2
-rw-r--r--dev/ZKA/Sources/DLLInterface.cxx11
-rw-r--r--dev/ZKA/Sources/DLLMain.cxx2
-rw-r--r--dev/ZKA/Sources/MP.cxx11
-rw-r--r--dev/ZKA/Sources/PEFCodeManager.cxx8
-rw-r--r--dev/ZKA/Sources/UserProcessScheduler.cxx5
6 files changed, 15 insertions, 24 deletions
diff --git a/dev/ZKA/Sources/CodeManager.cxx b/dev/ZKA/Sources/CodeManager.cxx
index f01bf41c..7e180ac0 100644
--- a/dev/ZKA/Sources/CodeManager.cxx
+++ b/dev/ZKA/Sources/CodeManager.cxx
@@ -23,7 +23,7 @@ namespace Kernel
proc.SetImageStart(reinterpret_cast<VoidPtr>(main));
proc.Kind = UserProcess::kExeKind;
- proc.StackSize = mib_cast(1);
+ proc.StackSize = kib_cast(8);
rt_copy_memory((VoidPtr)processName, proc.Name, rt_string_len(processName));
diff --git a/dev/ZKA/Sources/DLLInterface.cxx b/dev/ZKA/Sources/DLLInterface.cxx
index 0ff6e91b..c18f2f00 100644
--- a/dev/ZKA/Sources/DLLInterface.cxx
+++ b/dev/ZKA/Sources/DLLInterface.cxx
@@ -13,14 +13,3 @@
#include <KernelKit/UserProcessScheduler.hxx>
using namespace Kernel;
-
-/***********************************************************************************/
-/// @brief Unimplemented function (crashes by default)
-/// @param
-/***********************************************************************************/
-
-EXTERN_C void __zka_pure_call(void)
-{
- kcout << "newoskrnl.exe: Unimplemented entrypoint symbol!\r";
- UserProcessScheduler::The().CurrentProcess().Leak().Crash();
-}
diff --git a/dev/ZKA/Sources/DLLMain.cxx b/dev/ZKA/Sources/DLLMain.cxx
index 8faa7a08..934f418c 100644
--- a/dev/ZKA/Sources/DLLMain.cxx
+++ b/dev/ZKA/Sources/DLLMain.cxx
@@ -155,7 +155,7 @@ namespace Kernel
EXTERN UserProcessScheduler* cProcessScheduler;
} // namespace Kernel
-Kernel::Void HangCPU(Kernel::Void)
+EXTERN_C Kernel::Void HangCPU(Kernel::Void)
{
while (1);
}
diff --git a/dev/ZKA/Sources/MP.cxx b/dev/ZKA/Sources/MP.cxx
index 23916a2f..fcf555cb 100644
--- a/dev/ZKA/Sources/MP.cxx
+++ b/dev/ZKA/Sources/MP.cxx
@@ -15,6 +15,10 @@
///! @brief This file handles multi processing in the Kernel.
///! @brief Multi processing is needed for multi-tasking operations.
+#ifdef __ZKA_AMD64__
+EXTERN Kernel::HAL::Detail::ZKA_TSS cTSS;
+#endif // ifdef __ZKA_AMD64__
+
namespace Kernel
{
/***********************************************************************************/
@@ -100,13 +104,18 @@ namespace Kernel
if (kHandoverHeader->f_HardwareTables.f_MultiProcessingEnabled)
{
+#ifdef __ZKA_AMD64__
+ cTSS.fRsp0 = (UIntPtr)stack_ptr;
+#endif // ifdef __ZKA_AMD64__
return mp_register_process(fStack);
}
//! SMP is disabled here.
mp_do_context_switch_pre();
- return mp_do_context_switch(image, stack_ptr, fStack) != 0;
+ mp_do_context_switch(image, stack_ptr, fStack);
+
+ return true;
}
///! @brief Tells if processor is waked up.
diff --git a/dev/ZKA/Sources/PEFCodeManager.cxx b/dev/ZKA/Sources/PEFCodeManager.cxx
index 911281f6..a797fd50 100644
--- a/dev/ZKA/Sources/PEFCodeManager.cxx
+++ b/dev/ZKA/Sources/PEFCodeManager.cxx
@@ -166,14 +166,6 @@ namespace Kernel
rt_copy_memory((VoidPtr)((Char*)blob + sizeof(PEFCommandHeader)), blobRet, container_header->Size);
-#ifdef __ZKA_AMD64__
- HAL::mm_update_pte(hal_read_cr3(), 0, blobRet, HAL::eFlagsPresent);
- HAL::mm_update_pte(hal_read_cr3(), 0, blobRet, HAL::eFlagsUser);
- HAL::mm_update_pte(hal_read_cr3(), 0, blobRet, (container_header->Kind != kPefCode ? HAL::eFlagsRw : 0));
-#else
-#warning ! No page bits set fo blob !
-#endif
-
mm_delete_ke_heap(blob);
return blobRet;
}
diff --git a/dev/ZKA/Sources/UserProcessScheduler.cxx b/dev/ZKA/Sources/UserProcessScheduler.cxx
index 1d49ff5c..dc142b18 100644
--- a/dev/ZKA/Sources/UserProcessScheduler.cxx
+++ b/dev/ZKA/Sources/UserProcessScheduler.cxx
@@ -260,7 +260,7 @@ namespace Kernel
if (!process.StackReserve)
{
process.StackReserve = (UInt8*)mm_new_ke_heap(kSchedMaxStackSz, Yes, Yes);
- kcout << "newoskrnl.exe: Use fallback reserve.\r";
+ kcout << "newoskrnl.exe: Use fallback reserve size.\r";
}
}
else
@@ -341,10 +341,11 @@ namespace Kernel
kcout << process.Name << ": will be runned.\r";
// tell helper to find a core to schedule on.
- if (!UserProcessHelper::Switch(process.Image, &process.StackReserve[process.StackSize - 1], process.StackFrame,
+ if (!UserProcessHelper::Switch(process.Image, &process.StackReserve[process.StackSize], process.StackFrame,
process.ProcessId))
{
process.Crash();
+ continue;
}
process.Exit();