diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-27 17:38:23 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-27 17:38:23 +0100 |
| commit | 1ce16b83dba0326b13dfa3399c1497ac6b1af14d (patch) | |
| tree | 8a5e4063b5d4cf6ce4f42dd500073994e9ef8954 /Private/HALKit | |
| parent | 6a18e607ffc4e83f2bd953c9de5c14f18e077df8 (diff) | |
Kernel && Developer:
Developer:
- Rework System API to use C instead of C++
- Add new calls in Thread.h
- Documented code.
Kernel:
- Rework handover stage, separated the Processor specific code from
the cross platform code.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/HALKit')
| -rw-r--r-- | Private/HALKit/AMD64/HalKernelMain.cxx | 12 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalNewBoot.asm | 7 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalSMPCore.cxx | 2 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalSMPCoreManager.asm | 7 |
4 files changed, 15 insertions, 13 deletions
diff --git a/Private/HALKit/AMD64/HalKernelMain.cxx b/Private/HALKit/AMD64/HalKernelMain.cxx index 266ef18a..29cbdff2 100644 --- a/Private/HALKit/AMD64/HalKernelMain.cxx +++ b/Private/HALKit/AMD64/HalKernelMain.cxx @@ -17,8 +17,9 @@ #include <NewKit/Json.hpp> EXTERN_C HCore::VoidPtr kInterruptVectorTable[]; +EXTERN_C void RuntimeMain(); -EXTERN_C void RuntimeMain( +EXTERN_C void hal_init_platform( HCore::HEL::HandoverInformationHeader* HandoverHeader) { kHandoverHeader = HandoverHeader; @@ -65,12 +66,6 @@ EXTERN_C void RuntimeMain( /// END POST - /// Mounts a NewFS block. - HCore::NewFilesystemManager* newFS = new HCore::NewFilesystemManager(); - HCore::ke_protect_ke_heap(newFS); - - HCore::FilesystemManagerInterface::Mount(newFS); - ToolboxInitRsrc(); ToolboxDrawRsrc( @@ -80,6 +75,7 @@ EXTERN_C void RuntimeMain( ToolboxClearRsrc(); - HCore::ke_delete_ke_heap(newFS); + RuntimeMain(); + HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP); } diff --git a/Private/HALKit/AMD64/HalNewBoot.asm b/Private/HALKit/AMD64/HalNewBoot.asm index 3a16cd24..54d05f2f 100644 --- a/Private/HALKit/AMD64/HalNewBoot.asm +++ b/Private/HALKit/AMD64/HalNewBoot.asm @@ -15,10 +15,11 @@ %define kTypeKernel 100 %define kArchAmd64 122 +%define kHandoverMagic 0xBADCC section .NewBoot -HandoverMagic: dq 0xBAD55 +HandoverMagic: dq kHandoverMagic HandoverType: dw kTypeKernel HandoverArch: dw kArchAmd64 ;; This NewBootStart points to Main. @@ -27,13 +28,13 @@ HandoverStart: dq Main section .text global Main -extern RuntimeMain +extern hal_init_platform ;; Just a simple setup, we'd also need to tell some before Main: push rax push rcx - call RuntimeMain + call hal_init_platform pop rcx pop rax ;; Go to sleep. diff --git a/Private/HALKit/AMD64/HalSMPCore.cxx b/Private/HALKit/AMD64/HalSMPCore.cxx index d213b2fc..3be9c0c7 100644 --- a/Private/HALKit/AMD64/HalSMPCore.cxx +++ b/Private/HALKit/AMD64/HalSMPCore.cxx @@ -7,7 +7,7 @@ #include <KernelKit/ProcessScheduler.hpp> using namespace HCore; -Void ProcessHeader::SetStart(UIntPtr &imageStart) noexcept { +Void ProcessHeader::SetEntrypoint(UIntPtr &imageStart) noexcept { if (imageStart == 0) this->Crash(); this->StackFrame->Rbp = imageStart; diff --git a/Private/HALKit/AMD64/HalSMPCoreManager.asm b/Private/HALKit/AMD64/HalSMPCoreManager.asm index 66cfec3a..d896a66c 100644 --- a/Private/HALKit/AMD64/HalSMPCoreManager.asm +++ b/Private/HALKit/AMD64/HalSMPCoreManager.asm @@ -14,8 +14,13 @@ section .text +;; writes to rdx the stackframe inside rcx. +;; rcx: Stack Pointer +;; rdx: SMP core address. rt_do_context_switch: - retfq + + retfq +;; gets the current stack frame. rt_get_current_context: retfq |
