diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-20 10:20:22 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-20 10:20:22 +0200 |
| commit | 7013c094668be2204b1245496236f0cf6afa07c2 (patch) | |
| tree | 2a15832577a580e51b55b758cb792d3225870157 /Private/HALKit | |
| parent | e5a591054ea0992acc3cb786d3af9f358febca6d (diff) | |
MHR-5/MHR-3: Rename PowerPC to POWER, implement NewFSParser::Format
method, documenting code.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/HALKit')
| -rw-r--r-- | Private/HALKit/64x0/HalVirtualMemory.cxx | 6 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalKernelMain.cxx | 4 | ||||
| -rw-r--r-- | Private/HALKit/POWER/.gitkeep (renamed from Private/HALKit/PowerPC/.gitkeep) | 0 | ||||
| -rw-r--r-- | Private/HALKit/POWER/APM/.gitkeep (renamed from Private/HALKit/PowerPC/APM/.gitkeep) | 0 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalContextSwitchPowerPC.s | 28 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalHardware.cxx (renamed from Private/HALKit/PowerPC/HalHardware.cxx) | 2 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalHart.cxx (renamed from Private/HALKit/PowerPC/HalHart.cxx) | 4 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalSerialPort.cxx (renamed from Private/HALKit/PowerPC/HalSerialPort.cxx) | 6 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalStartSequence.s (renamed from Private/HALKit/PowerPC/HalStartSequence.s) | 0 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalThread.cxx (renamed from Private/HALKit/PowerPC/HalThread.cxx) | 2 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalVirtualMemory.cxx (renamed from Private/HALKit/PowerPC/HalVirtualMemory.cxx) | 6 | ||||
| -rw-r--r-- | Private/HALKit/POWER/Hart.hxx (renamed from Private/HALKit/PowerPC/Hart.hxx) | 2 | ||||
| -rw-r--r-- | Private/HALKit/POWER/MBCI/.gitkeep (renamed from Private/HALKit/PowerPC/MBCI/.gitkeep) | 0 | ||||
| -rw-r--r-- | Private/HALKit/POWER/MBCI/HalMBCIHost.cxx (renamed from Private/HALKit/PowerPC/MBCI/HalMBCIHost.cxx) | 2 | ||||
| -rw-r--r-- | Private/HALKit/POWER/Processor.hpp (renamed from Private/HALKit/PowerPC/Processor.hpp) | 2 | ||||
| -rw-r--r-- | Private/HALKit/POWER/ppc-cpu.h (renamed from Private/HALKit/PowerPC/ppc-cpu.h) | 8 | ||||
| -rw-r--r-- | Private/HALKit/POWER/ppc-mmu.h (renamed from Private/HALKit/PowerPC/ppc-mmu.h) | 11 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/HalCoreContextSwitchPowerPC.s | 30 |
18 files changed, 54 insertions, 59 deletions
diff --git a/Private/HALKit/64x0/HalVirtualMemory.cxx b/Private/HALKit/64x0/HalVirtualMemory.cxx index 8fc08df0..2ae0f7ac 100644 --- a/Private/HALKit/64x0/HalVirtualMemory.cxx +++ b/Private/HALKit/64x0/HalVirtualMemory.cxx @@ -4,11 +4,11 @@ ------------------------------------------- */ -#include <HALKit/PowerPC/Processor.hpp> +#include <HALKit/POWER/Processor.hpp> #include <KernelKit/DebugOutput.hpp> using namespace NewOS; -/// @brief Flush system TLB, looks like the PowerPC version, as it acts the same, no specific instruction for that. +/// @brief Flush system TLB, looks like the POWER version, as it acts the same, no specific instruction for that. /// @note The 88K MMU should be present in the die. -EXTERN_C void hal_flush_tlb() { asm volatile("isync;invltlb;msync;isync"); } +EXTERN_C void hal_flush_tlb() { asm volatile("invltlb"); } diff --git a/Private/HALKit/AMD64/HalKernelMain.cxx b/Private/HALKit/AMD64/HalKernelMain.cxx index f6b8e957..7d8c516d 100644 --- a/Private/HALKit/AMD64/HalKernelMain.cxx +++ b/Private/HALKit/AMD64/HalKernelMain.cxx @@ -17,7 +17,7 @@ #include <NewKit/Json.hpp> EXTERN_C NewOS::VoidPtr kInterruptVectorTable[]; -EXTERN_C void RuntimeMain(); +EXTERN_C void AppMain(); namespace NewOS::HAL { /// @brief Gets the system cores using the MADT. @@ -83,7 +83,7 @@ EXTERN_C void hal_init_platform( ToolboxClearRsrc(); - RuntimeMain(); + AppMain(); NewOS::ke_stop(RUNTIME_CHECK_BOOTSTRAP); } diff --git a/Private/HALKit/PowerPC/.gitkeep b/Private/HALKit/POWER/.gitkeep index e69de29b..e69de29b 100644 --- a/Private/HALKit/PowerPC/.gitkeep +++ b/Private/HALKit/POWER/.gitkeep diff --git a/Private/HALKit/PowerPC/APM/.gitkeep b/Private/HALKit/POWER/APM/.gitkeep index e69de29b..e69de29b 100644 --- a/Private/HALKit/PowerPC/APM/.gitkeep +++ b/Private/HALKit/POWER/APM/.gitkeep diff --git a/Private/HALKit/POWER/HalContextSwitchPowerPC.s b/Private/HALKit/POWER/HalContextSwitchPowerPC.s new file mode 100644 index 00000000..75c9f37a --- /dev/null +++ b/Private/HALKit/POWER/HalContextSwitchPowerPC.s @@ -0,0 +1,28 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +.align 4 +.type name, @function +.text +.globl rt_do_context_switch + +/* r3 (3) = assigner stack, r4 (4) = assignee stack */ +rt_do_context_switch: + lwz 0(%4), 0(%3) + lwz 4(%4), 4(%3) + lwz 8(%4), 8(%3) + lwz 12(%4), 12(%3) + lwz 14(%4), 14(%3) + lwz 18(%4), 18(%3) + lwz 22(%4), 22(%3) + lwz 24(%4), 24(%3) + lwz 28(%4), 28(%3) + lwz 32(%4), 32(%3) + lwz 34(%4), 34(%3) + lwz 38(%4), 38(%3) + + /* we are done here, the assignee should start executing code now. */ + blr diff --git a/Private/HALKit/PowerPC/HalHardware.cxx b/Private/HALKit/POWER/HalHardware.cxx index 5d09805d..693bf70e 100644 --- a/Private/HALKit/PowerPC/HalHardware.cxx +++ b/Private/HALKit/POWER/HalHardware.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include <HALKit/PowerPC/Processor.hpp> +#include <HALKit/POWER/Processor.hpp> #include <KernelKit/DebugOutput.hpp> namespace NewOS { diff --git a/Private/HALKit/PowerPC/HalHart.cxx b/Private/HALKit/POWER/HalHart.cxx index 102bab7d..75eeb3f7 100644 --- a/Private/HALKit/PowerPC/HalHart.cxx +++ b/Private/HALKit/POWER/HalHart.cxx @@ -4,9 +4,9 @@ ------------------------------------------- */ -#include <HALKit/PowerPC/Processor.hpp> +#include <HALKit/POWER/Processor.hpp> #include <KernelKit/DebugOutput.hpp> -#include <HALKit/PowerPC/Hart.hxx> +#include <HALKit/POWER/Hart.hxx> using namespace NewOS; diff --git a/Private/HALKit/PowerPC/HalSerialPort.cxx b/Private/HALKit/POWER/HalSerialPort.cxx index 36878b61..cf943371 100644 --- a/Private/HALKit/PowerPC/HalSerialPort.cxx +++ b/Private/HALKit/POWER/HalSerialPort.cxx @@ -4,13 +4,13 @@ ------------------------------------------- */ -#include <HALKit/PowerPC/Processor.hpp> +#include <HALKit/POWER/Processor.hpp> #include <KernelKit/DebugOutput.hpp> using namespace NewOS; /// @brief Writes to COM1. -/// @param bytes +/// @param bytes void ke_io_write(const Char* bytes) { if (!bytes) return; @@ -21,4 +21,4 @@ void ke_io_write(const Char* bytes) { // TODO ++index; } -}
\ No newline at end of file +} diff --git a/Private/HALKit/PowerPC/HalStartSequence.s b/Private/HALKit/POWER/HalStartSequence.s index f50a4d4f..f50a4d4f 100644 --- a/Private/HALKit/PowerPC/HalStartSequence.s +++ b/Private/HALKit/POWER/HalStartSequence.s diff --git a/Private/HALKit/PowerPC/HalThread.cxx b/Private/HALKit/POWER/HalThread.cxx index a91e7f28..c79b4fb7 100644 --- a/Private/HALKit/PowerPC/HalThread.cxx +++ b/Private/HALKit/POWER/HalThread.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include <HALKit/PowerPC/Processor.hpp> +#include <HALKit/POWER/Processor.hpp> #include <KernelKit/DebugOutput.hpp> extern "C" NewOS::HAL::StackFramePtr rt_get_current_context() { return nullptr; } diff --git a/Private/HALKit/PowerPC/HalVirtualMemory.cxx b/Private/HALKit/POWER/HalVirtualMemory.cxx index 301bda0c..43c59384 100644 --- a/Private/HALKit/PowerPC/HalVirtualMemory.cxx +++ b/Private/HALKit/POWER/HalVirtualMemory.cxx @@ -4,10 +4,10 @@ ------------------------------------------- */ -#include <HALKit/PowerPC/ppc-cpu.h> -#include <HALKit/PowerPC/ppc-mmu.h> +#include <HALKit/POWER/ppc-cpu.h> +#include <HALKit/POWER/ppc-mmu.h> -#include <HALKit/PowerPC/Processor.hpp> +#include <HALKit/POWER/Processor.hpp> #include <KernelKit/DebugOutput.hpp> /// NOTE: refer to: https://www.nxp.com/docs/en/white-paper/POWRPCARCPRMRM.pdf, diff --git a/Private/HALKit/PowerPC/Hart.hxx b/Private/HALKit/POWER/Hart.hxx index 56d51243..2a908fcf 100644 --- a/Private/HALKit/PowerPC/Hart.hxx +++ b/Private/HALKit/POWER/Hart.hxx @@ -3,7 +3,7 @@ Copyright Mahrouss Logic File: Hart.hxx - Purpose: PowerPC hardware threads. + Purpose: POWER hardware threads. Revision History: diff --git a/Private/HALKit/PowerPC/MBCI/.gitkeep b/Private/HALKit/POWER/MBCI/.gitkeep index e69de29b..e69de29b 100644 --- a/Private/HALKit/PowerPC/MBCI/.gitkeep +++ b/Private/HALKit/POWER/MBCI/.gitkeep diff --git a/Private/HALKit/PowerPC/MBCI/HalMBCIHost.cxx b/Private/HALKit/POWER/MBCI/HalMBCIHost.cxx index 98371c43..8ad039fe 100644 --- a/Private/HALKit/PowerPC/MBCI/HalMBCIHost.cxx +++ b/Private/HALKit/POWER/MBCI/HalMBCIHost.cxx @@ -4,5 +4,5 @@ ------------------------------------------- */ -#include <HALKit/PowerPC/Processor.hpp> +#include <HALKit/POWER/Processor.hpp> #include <KernelKit/DebugOutput.hpp> diff --git a/Private/HALKit/PowerPC/Processor.hpp b/Private/HALKit/POWER/Processor.hpp index 12a5bd26..a597b202 100644 --- a/Private/HALKit/PowerPC/Processor.hpp +++ b/Private/HALKit/POWER/Processor.hpp @@ -2,7 +2,7 @@ Copyright Mahrouss Logic - Purpose: PowerPC processor header. + Purpose: POWER processor header. ------------------------------------------- */ diff --git a/Private/HALKit/PowerPC/ppc-cpu.h b/Private/HALKit/POWER/ppc-cpu.h index 4bc6e9f0..74003329 100644 --- a/Private/HALKit/PowerPC/ppc-cpu.h +++ b/Private/HALKit/POWER/ppc-cpu.h @@ -17,7 +17,7 @@ struct pt_regs { unsigned long nip; }; -#else +#else #include <asm/ptrace.h> #include <asm/types.h> #endif @@ -880,8 +880,8 @@ struct pt_regs { #define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ /* - * AMCC has further subdivided the standard PowerPC 16-bit version and - * revision subfields of the PVR for the PowerPC 403s into the following: + * AMCC has further subdivided the standard ppc 16-bit version and + * revision subfields of the PVR for the ppc 403s into the following: */ #define PVR_FAM(pvr) (((pvr) >> 20) & 0xFFF) /* Family field */ @@ -990,7 +990,7 @@ struct pt_regs { /* * For the 8xx processors, all of them report the same PVR family for - * the PowerPC core. The various versions of these processors must be + * the ppc core. The various versions of these processors must be * differentiated by the version number in the Communication Processor * Module (CPM). */ diff --git a/Private/HALKit/PowerPC/ppc-mmu.h b/Private/HALKit/POWER/ppc-mmu.h index 372935aa..5a149243 100644 --- a/Private/HALKit/PowerPC/ppc-mmu.h +++ b/Private/HALKit/POWER/ppc-mmu.h @@ -1,6 +1,3 @@ -/* - * PowerPC memory management structures - */ #ifndef _PPC_MMU_H_ #define _PPC_MMU_H_ @@ -252,7 +249,7 @@ extern void print_bats(void); #define MI_IDXMASK 0x00001f00 /* TLB index to be loaded */ #define MI_RESETVAL 0x00000000 /* Value of register at reset */ -/* These are the Ks and Kp from the PowerPC books. For proper operation, +/* These are the Ks and Kp from the ppc books. For proper operation, * Ks = 0, Kp = 1. */ #define MI_AP 786 @@ -311,7 +308,7 @@ extern void print_bats(void); #define MC_ASIDMASK 0x0000000f /* Bits used for ASID value */ -/* These are the Ks and Kp from the PowerPC books. For proper operation, +/* These are the Ks and Kp from the ppc books. For proper operation, * Ks = 0, Kp = 1. */ #define MD_AP 794 @@ -368,7 +365,7 @@ extern void print_bats(void); #define M_TW 799 /* - * At present, all PowerPC 400-class processors share a similar TLB + * At present, all ppc 400-class processors share a similar TLB * architecture. The instruction and data sides share a unified, * 64-entry, fully-associative TLB which is maintained totally under * software control. In addition, the instruction side has a @@ -797,4 +794,4 @@ void change_tlb(uint32_t vaddr, uint32_t size, uint32_t tlb_word2_i_value); #endif /* __ASSEMBLY__ */ #endif /* CONFIG_440 */ -#endif /* _PPC_MMU_H_ */
\ No newline at end of file +#endif /* _PPC_MMU_H_ */ diff --git a/Private/HALKit/PowerPC/HalCoreContextSwitchPowerPC.s b/Private/HALKit/PowerPC/HalCoreContextSwitchPowerPC.s deleted file mode 100644 index 0bf6418d..00000000 --- a/Private/HALKit/PowerPC/HalCoreContextSwitchPowerPC.s +++ /dev/null @@ -1,30 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -.align 4 -.type name, @function -.text -.globl rt_do_context_switch - -/* r3 = assigner stack, r4 = assignee stack */ -rt_do_context_switch: - - 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) - - mr %r31, %r4 - - bl |
