diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-06 09:14:11 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-06 09:14:11 +0100 |
| commit | 5339d016c07bf717ee388f4feb73544087324af0 (patch) | |
| tree | 94be6f67ed626091f24aee24ec3b3be03d01e4e7 /HALKit/PowerPC | |
git: port from mercurial repo.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'HALKit/PowerPC')
| -rw-r--r-- | HALKit/PowerPC/.gitkeep | 0 | ||||
| -rw-r--r-- | HALKit/PowerPC/CoreContextSwitchPowerPC.s | 20 | ||||
| -rw-r--r-- | HALKit/PowerPC/CoreSyscallHandlerPowerPC.cpp | 21 | ||||
| -rw-r--r-- | HALKit/PowerPC/PCI/.gitkeep | 0 | ||||
| -rw-r--r-- | HALKit/PowerPC/PCI/Device.cxx | 0 | ||||
| -rw-r--r-- | HALKit/PowerPC/Processor.hpp | 50 |
6 files changed, 91 insertions, 0 deletions
diff --git a/HALKit/PowerPC/.gitkeep b/HALKit/PowerPC/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/HALKit/PowerPC/.gitkeep diff --git a/HALKit/PowerPC/CoreContextSwitchPowerPC.s b/HALKit/PowerPC/CoreContextSwitchPowerPC.s new file mode 100644 index 00000000..96ef6d80 --- /dev/null +++ b/HALKit/PowerPC/CoreContextSwitchPowerPC.s @@ -0,0 +1,20 @@ +/* + * ======================================================== + * + * hCore + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +.align 4 +.type name, @function +.text +.globl rt_do_context_switch + +/* r3 = assigner stack, r4 = assignee stack */ +rt_do_context_switch: + + lwz %r4, 0(%r3) + + blr diff --git a/HALKit/PowerPC/CoreSyscallHandlerPowerPC.cpp b/HALKit/PowerPC/CoreSyscallHandlerPowerPC.cpp new file mode 100644 index 00000000..213b45ec --- /dev/null +++ b/HALKit/PowerPC/CoreSyscallHandlerPowerPC.cpp @@ -0,0 +1,21 @@ +/* + * ======================================================== + * + * hCore + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#include <ArchKit/Arch.hpp> +#include <NewKit/Array.hpp> + +hCore::Array<void (*)(hCore::Int32 id, hCore::HAL::StackFrame *), kMaxSyscalls> kSyscalls; + +extern "C" void rt_syscall_handle(hCore::HAL::StackFrame *stack) +{ + for (hCore::SizeT index = 0UL; index < kMaxSyscalls; ++index) + { + (kSyscalls[index].Leak().Leak())(stack->ID, stack); + } +} diff --git a/HALKit/PowerPC/PCI/.gitkeep b/HALKit/PowerPC/PCI/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/HALKit/PowerPC/PCI/.gitkeep diff --git a/HALKit/PowerPC/PCI/Device.cxx b/HALKit/PowerPC/PCI/Device.cxx new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/HALKit/PowerPC/PCI/Device.cxx diff --git a/HALKit/PowerPC/Processor.hpp b/HALKit/PowerPC/Processor.hpp new file mode 100644 index 00000000..a1add51c --- /dev/null +++ b/HALKit/PowerPC/Processor.hpp @@ -0,0 +1,50 @@ +/* + * ======================================================== + * + * hCore + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include <NewKit/Defines.hpp> +#include <NewKit/Utils.hpp> + +#define __aligned __attribute__((aligned(4))) + +namespace hCore::HAL +{ + typedef UIntPtr Reg; + + struct __aligned StackFrame + { + Reg R0; + Reg R1; + Reg R2; + Reg R3; + Reg R4; + Reg R5; + Reg R6; + Reg R7; + Reg ID; // R8 + }; + + typedef StackFrame* StackFramePtr; + + inline void rt_halt() + { + while (1) + {} + } + + inline void rt_cli() + { + + } +} + +extern "C" void int_handle_math(hCore::UIntPtr sp); +extern "C" void int_handle_pf(hCore::UIntPtr sp); +extern "C" void* __ppc_alloca(size_t sz);
\ No newline at end of file |
