diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-04-05 01:59:36 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-04-05 02:01:15 +0200 |
| commit | 21fe8d0b7d48e92ba0d45c084bf868c94bb67cd7 (patch) | |
| tree | 4193f80c02ce03b2e02d6c2ef1a1a0526ea7b8fc /Private/HALKit | |
| parent | a45872967f07906297782cd04223706cfc326219 (diff) | |
HAL/PPC: Adding support for PowerPC, implemented rt_do_context_switch.
Refactor: Everything which starts with HCORE_ is NEWOS_ now.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/HALKit')
| -rw-r--r-- | Private/HALKit/PowerPC/APM/.gitkeep | 0 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/HalCoreContextSwitchPowerPC.s | 15 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/HalCoreSyscallHandlerPowerPC.cpp | 18 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/HalHardware.cxx | 20 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/HalSMPManager.cxx | 18 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/HalSerialPort.cxx | 24 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/Processor.hpp | 8 |
7 files changed, 56 insertions, 47 deletions
diff --git a/Private/HALKit/PowerPC/APM/.gitkeep b/Private/HALKit/PowerPC/APM/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Private/HALKit/PowerPC/APM/.gitkeep diff --git a/Private/HALKit/PowerPC/HalCoreContextSwitchPowerPC.s b/Private/HALKit/PowerPC/HalCoreContextSwitchPowerPC.s index a6c2a90f..9cbcb4f8 100644 --- a/Private/HALKit/PowerPC/HalCoreContextSwitchPowerPC.s +++ b/Private/HALKit/PowerPC/HalCoreContextSwitchPowerPC.s @@ -12,6 +12,17 @@ /* r3 = assigner stack, r4 = assignee stack */ rt_do_context_switch: - lwz %r4, 0(%r3) + lwz 0(%r4), 0(%r3) + lwz 4(%r4), 4(%r3) + lwz 8(%r4), 8(%r3) + lwz 12(%r4), 12(%r3) + lwz 14(%r4), 14(%r3) + lwz 18(%r4), 18(%r3) + lwz 22(%r4), 22(%r3) + lwz 24(%r4), 24(%r3) + lwz 28(%r4), 28(%r3) + lwz 32(%r4), 32(%r3) + lwz 34(%r4), 34(%r3) + lwz 38(%r4), 38(%r3) - blr + bl diff --git a/Private/HALKit/PowerPC/HalCoreSyscallHandlerPowerPC.cpp b/Private/HALKit/PowerPC/HalCoreSyscallHandlerPowerPC.cpp deleted file mode 100644 index 322cb604..00000000 --- a/Private/HALKit/PowerPC/HalCoreSyscallHandlerPowerPC.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <ArchKit/ArchKit.hpp> -#include <NewKit/Array.hpp> - -NewOS::Array<void (*)(NewOS::Int32 id, NewOS::HAL::StackFrame *), - kKernelMaxSystemCalls> - kSyscalls; - -extern "C" void rt_syscall_handle(NewOS::HAL::StackFrame *stack) { - for (NewOS::SizeT index = 0UL; index < kKernelMaxSystemCalls; ++index) { - (kSyscalls[index].Leak().Leak())(stack->ID, stack); - } -} diff --git a/Private/HALKit/PowerPC/HalHardware.cxx b/Private/HALKit/PowerPC/HalHardware.cxx index 96f0a433..5d09805d 100644 --- a/Private/HALKit/PowerPC/HalHardware.cxx +++ b/Private/HALKit/PowerPC/HalHardware.cxx @@ -11,24 +11,4 @@ namespace NewOS { namespace HAL { UIntPtr hal_alloc_page(bool rw, bool user) { return 0; } } // namespace HAL - -/// @brief wakes up thread. -/// wakes up thread from hang. -void rt_wakeup_thread(HAL::StackFrame* stack) {} - -/// @brief makes thread sleep. -/// hooks and hangs thread to prevent code from executing. -void rt_hang_thread(HAL::StackFrame* stack) {} - -void ke_com_print(const Char* bytes) { - if (!bytes) return; - - SizeT index = 0; - SizeT len = rt_string_len(bytes, 256); - - while (index < len) { - // TODO - ++index; - } -} } // namespace NewOS diff --git a/Private/HALKit/PowerPC/HalSMPManager.cxx b/Private/HALKit/PowerPC/HalSMPManager.cxx new file mode 100644 index 00000000..26ebc399 --- /dev/null +++ b/Private/HALKit/PowerPC/HalSMPManager.cxx @@ -0,0 +1,18 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include <HALKit/PowerPC/Processor.hpp> +#include <KernelKit/DebugOutput.hpp> + +using namespace NewOS; + +/// @brief wakes up thread. +/// wakes up thread from hang. +void rt_wakeup_thread(HAL::StackFramePtr stack) {} + +/// @brief makes thread sleep. +/// hooks and hangs thread to prevent code from executing. +void rt_hang_thread(HAL::StackFramePtr stack) {}
\ No newline at end of file diff --git a/Private/HALKit/PowerPC/HalSerialPort.cxx b/Private/HALKit/PowerPC/HalSerialPort.cxx new file mode 100644 index 00000000..36878b61 --- /dev/null +++ b/Private/HALKit/PowerPC/HalSerialPort.cxx @@ -0,0 +1,24 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include <HALKit/PowerPC/Processor.hpp> +#include <KernelKit/DebugOutput.hpp> + +using namespace NewOS; + +/// @brief Writes to COM1. +/// @param bytes +void ke_io_write(const Char* bytes) { + if (!bytes) return; + + SizeT index = 0; + SizeT len = rt_string_len(bytes, 256); + + while (index < len) { + // TODO + ++index; + } +}
\ No newline at end of file diff --git a/Private/HALKit/PowerPC/Processor.hpp b/Private/HALKit/PowerPC/Processor.hpp index 36731d57..19f8e799 100644 --- a/Private/HALKit/PowerPC/Processor.hpp +++ b/Private/HALKit/PowerPC/Processor.hpp @@ -17,8 +17,6 @@ namespace NewOS::HAL { typedef UIntPtr Reg; struct __PPC_ALIGN StackFrame { - Reg IntNum; - Reg Exception; Reg R0; Reg R1; Reg R2; @@ -28,12 +26,8 @@ struct __PPC_ALIGN StackFrame { Reg R6; Reg R7; Reg R8; - Reg ProgramCounter; - Reg StackPointer; - /// @brief Process Context Reg PC; - /// @brief General Context - Reg GC; + Reg SP; }; typedef StackFrame* StackFramePtr; |
