diff options
25 files changed, 105 insertions, 102 deletions
diff --git a/Boot/Sources/HEL/AMD64/BootPlatform.cxx b/Boot/Sources/HEL/AMD64/BootPlatform.cxx index 3db0bb6b..b5833e13 100644 --- a/Boot/Sources/HEL/AMD64/BootPlatform.cxx +++ b/Boot/Sources/HEL/AMD64/BootPlatform.cxx @@ -93,7 +93,7 @@ EXTERN_C UInt32 In32(UInt16 port) #else -#include <HALKit/AMD64/Processor.hpp> +#include <HALKit/AMD64/Processor.hxx> void rt_hlt() { diff --git a/Drivers/Hello/Hello.c b/Drivers/Hello/Hello.c index ba3d9733..a2a6d54d 100644 --- a/Drivers/Hello/Hello.c +++ b/Drivers/Hello/Hello.c @@ -40,12 +40,12 @@ static HelloMasterConfigHeader* cHeader = nil; /// @brief Link to master device to attribute DHCP lease. static void __hello_link_device(void* a0) { - kernelPrintStr("Hello: turning up...\r"); + kernelPrintStr("Hello: linking...\r"); if (!cDev) { // open raw network device. - cDev = kernelOpenDevice("RAWNET:\\"); + cDev = kernelOpenDevice("BROADCAST:\\"); } cDev->write("+LINK", kernelStringLength("+LINK")); @@ -77,7 +77,7 @@ static void __hello_get_hmch(void* a0) static void __hello_unlink_device(void* a0) { - kernelPrintStr("Hello: shutting down...\r"); + kernelPrintStr("Hello: unlinking...\r"); if (cDev) { diff --git a/Kernel/ArchKit/ArchKit.hpp b/Kernel/ArchKit/ArchKit.hpp index bf9bd8e5..f01d5f21 100644 --- a/Kernel/ArchKit/ArchKit.hpp +++ b/Kernel/ArchKit/ArchKit.hpp @@ -11,11 +11,11 @@ #include <NewKit/Function.hpp> #ifdef __NEWOS_AMD64__ -#include <HALKit/AMD64/HalPageAlloc.hpp> +#include <HALKit/AMD64/HalPageAlloc.hxx> #include <HALKit/AMD64/Hypervisor.hpp> -#include <HALKit/AMD64/Processor.hpp> +#include <HALKit/AMD64/Processor.hxx> #elif defined(__NEWOS_POWER64__) -#include <HALKit/POWER/Processor.hpp> +#include <HALKit/POWER/Processor.hxx> #elif defined(__NEWOS_ARM64__) #include <HALKit/ARM64/Processor.hxx> #else diff --git a/Kernel/HALKit/64x0/HalVirtualMemory.cxx b/Kernel/HALKit/64x0/HalVirtualMemory.cxx index f62f888f..03f9afc7 100644 --- a/Kernel/HALKit/64x0/HalVirtualMemory.cxx +++ b/Kernel/HALKit/64x0/HalVirtualMemory.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include <HALKit/POWER/Processor.hpp> +#include <HALKit/POWER/Processor.hxx> #include <KernelKit/DebugOutput.hpp> using namespace Kernel; diff --git a/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx b/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx index ca6a7417..3fc8ae7a 100644 --- a/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx +++ b/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx @@ -5,7 +5,7 @@ ------------------------------------------- */ #include <Modules/ACPI/ACPIFactoryInterface.hxx> -#include <HALKit/AMD64/Processor.hpp> +#include <HALKit/AMD64/Processor.hxx> #include <NewKit/String.hpp> #include <ArchKit/ArchKit.hpp> #include <KernelKit/KernelHeap.hpp> diff --git a/Kernel/HALKit/AMD64/HalAPIC.cxx b/Kernel/HALKit/AMD64/HalAPIC.cxx index a148acf9..22f6583e 100644 --- a/Kernel/HALKit/AMD64/HalAPIC.cxx +++ b/Kernel/HALKit/AMD64/HalAPIC.cxx @@ -5,7 +5,7 @@ ------------------------------------------- */ #include <Modules/ACPI/ACPIFactoryInterface.hxx> -#include <HALKit/AMD64/Processor.hpp> +#include <HALKit/AMD64/Processor.hxx> namespace Kernel::HAL { diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx index cb7b1eeb..86bf635c 100644 --- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx +++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx @@ -5,7 +5,7 @@ ------------------------------------------- */ #include <Modules/ACPI/ACPIFactoryInterface.hxx> -#include <HALKit/AMD64/Processor.hpp> +#include <HALKit/AMD64/Processor.hxx> #include <NewKit/KernelCheck.hpp> #include <ArchKit/ArchKit.hpp> #include <KernelKit/Semaphore.hpp> diff --git a/Kernel/HALKit/AMD64/HalPageAlloc.hpp b/Kernel/HALKit/AMD64/HalPageAlloc.hxx index 8887b623..8887b623 100644 --- a/Kernel/HALKit/AMD64/HalPageAlloc.hpp +++ b/Kernel/HALKit/AMD64/HalPageAlloc.hxx diff --git a/Kernel/HALKit/AMD64/HalProcessor.cpp b/Kernel/HALKit/AMD64/HalProcessor.cxx index 01f3879a..e71e7108 100644 --- a/Kernel/HALKit/AMD64/HalProcessor.cpp +++ b/Kernel/HALKit/AMD64/HalProcessor.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include <HALKit/AMD64/Processor.hpp> +#include <HALKit/AMD64/Processor.hxx> /** * @file Processor.cpp diff --git a/Kernel/HALKit/AMD64/Processor.hpp b/Kernel/HALKit/AMD64/Processor.hxx index 8ec0b6f6..ecdd8dd0 100644 --- a/Kernel/HALKit/AMD64/Processor.hpp +++ b/Kernel/HALKit/AMD64/Processor.hxx @@ -17,7 +17,7 @@ #include <NewKit/Defines.hpp> #include <NewKit/Utils.hpp> #include <FirmwareKit/Handover.hxx> -#include <HALKit/AMD64/HalPageAlloc.hpp> +#include <HALKit/AMD64/HalPageAlloc.hxx> EXTERN_C { @@ -158,6 +158,7 @@ namespace Kernel::HAL typedef UIntPtr Reg; + /// @brief Stack frame (as retrieved from assembly.) struct PACKED StackFrame final { Reg IntNum, Exception; diff --git a/Kernel/HALKit/ARM64/HalPageAlloc.hpp b/Kernel/HALKit/ARM64/HalPageAlloc.hxx index 8286b5cd..8286b5cd 100644 --- a/Kernel/HALKit/ARM64/HalPageAlloc.hpp +++ b/Kernel/HALKit/ARM64/HalPageAlloc.hxx diff --git a/Kernel/HALKit/ARM64/Processor.hxx b/Kernel/HALKit/ARM64/Processor.hxx index fcffe065..c7ceae7d 100644 --- a/Kernel/HALKit/ARM64/Processor.hxx +++ b/Kernel/HALKit/ARM64/Processor.hxx @@ -53,4 +53,4 @@ inline Kernel::UIntPtr kKernelVirtualSize = 0UL; inline Kernel::VoidPtr kKernelPhysicalStart = nullptr; -#include <HALKit/ARM64/HalPageAlloc.hpp> +#include <HALKit/ARM64/HalPageAlloc.hxx> diff --git a/Kernel/HALKit/AXP/CoreSyscallHandlerDEC.cpp b/Kernel/HALKit/AXP/CoreSyscallHandlerDEC.cpp index 4469eee9..2cfe6e70 100644 --- a/Kernel/HALKit/AXP/CoreSyscallHandlerDEC.cpp +++ b/Kernel/HALKit/AXP/CoreSyscallHandlerDEC.cpp @@ -5,7 +5,7 @@ ------------------------------------------- */ #include <ArchKit/ArchKit.hpp> -#include <HALKit/AXP/Processor.hpp> +#include <HALKit/AXP/Processor.hxx> /// @brief Internal call for syscall, to work with C++. /// @param stack diff --git a/Kernel/HALKit/POWER/HalHardware.cxx b/Kernel/HALKit/POWER/HalHardware.cxx index 15407eb3..f8f40ff1 100644 --- a/Kernel/HALKit/POWER/HalHardware.cxx +++ b/Kernel/HALKit/POWER/HalHardware.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include <HALKit/POWER/Processor.hpp> +#include <HALKit/POWER/Processor.hxx> #include <KernelKit/DebugOutput.hpp> namespace Kernel diff --git a/Kernel/HALKit/POWER/HalHart.cxx b/Kernel/HALKit/POWER/HalHart.cxx index 614828cb..38babb12 100644 --- a/Kernel/HALKit/POWER/HalHart.cxx +++ b/Kernel/HALKit/POWER/HalHart.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include <HALKit/POWER/Processor.hpp> +#include <HALKit/POWER/Processor.hxx> #include <KernelKit/DebugOutput.hpp> #include <HALKit/POWER/Hart.hxx> diff --git a/Kernel/HALKit/POWER/HalSerialPort.cxx b/Kernel/HALKit/POWER/HalSerialPort.cxx index abddd291..6a802a72 100644 --- a/Kernel/HALKit/POWER/HalSerialPort.cxx +++ b/Kernel/HALKit/POWER/HalSerialPort.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include <HALKit/POWER/Processor.hpp> +#include <HALKit/POWER/Processor.hxx> #include <KernelKit/DebugOutput.hpp> using namespace Kernel; diff --git a/Kernel/HALKit/POWER/HalThread.cxx b/Kernel/HALKit/POWER/HalThread.cxx index 18d84d4f..3e0ab088 100644 --- a/Kernel/HALKit/POWER/HalThread.cxx +++ b/Kernel/HALKit/POWER/HalThread.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include <HALKit/POWER/Processor.hpp> +#include <HALKit/POWER/Processor.hxx> #include <KernelKit/DebugOutput.hpp> EXTERN_C Kernel::HAL::StackFramePtr rt_get_current_context() diff --git a/Kernel/HALKit/POWER/HalVirtualMemory.cxx b/Kernel/HALKit/POWER/HalVirtualMemory.cxx index eb04a43d..d068a374 100644 --- a/Kernel/HALKit/POWER/HalVirtualMemory.cxx +++ b/Kernel/HALKit/POWER/HalVirtualMemory.cxx @@ -7,20 +7,14 @@ #include <HALKit/POWER/ppc-cpu.h> #include <HALKit/POWER/ppc-mmu.h> -#include <HALKit/POWER/Processor.hpp> +#include <HALKit/POWER/Processor.hxx> #include <KernelKit/DebugOutput.hpp> -/// @note refer to our SoC documentation. +/// @note refer to the SoC documentation. using namespace Kernel; -/// @brief Write directly to the specific TLB. -/// @param mas0 -/// @param mas1 -/// @param mas2 -/// @param mas3 -/// @param mas7 -static void hal_write_tlb(uint32_t mas0, uint32_t mas1, uint32_t mas2, uint32_t mas3, uint32_t mas7) +Void hal_write_tlb(UInt32 mas0, UInt32 mas1, UInt32 mas2, UInt32 mas3, UInt32 mas7) { mtspr(MAS0, mas0); mtspr(MAS1, mas1); @@ -31,23 +25,26 @@ static void hal_write_tlb(uint32_t mas0, uint32_t mas1, uint32_t mas2, uint32_t hal_flush_tlb(); } -void hal_set_tlb(uint8_t tlb, uint32_t epn, uint64_t rpn, uint8_t perms, uint8_t wimge, uint8_t ts, uint8_t esel, uint8_t tsize, uint8_t iprot) +Bool hal_set_tlb(UInt8 tlb, UInt32 epn, UInt64 rpn, UInt8 perms, UInt8 wimge, UInt8 ts, UInt8 esel, UInt8 tsize, UInt8 iprot) { if ((mfspr(SPRN_MMUCFG) & MMUCFG_MAVN) == MMUCFG_MAVN_V1 && (tsize & 1)) { // this mmu-version does not allow odd tsize values - return; + return false; } - uint32_t mas0 = FSL_BOOKE_MAS0(tlb, esel, 0); - uint32_t mas1 = FSL_BOOKE_MAS1(1, iprot, 0, ts, tsize); - uint32_t mas2 = FSL_BOOKE_MAS2(epn, wimge); - uint32_t mas3 = FSL_BOOKE_MAS3(rpn, 0, perms); - uint32_t mas7 = FSL_BOOKE_MAS7(rpn); + + UInt32 mas0 = FSL_BOOKE_MAS0(tlb, esel, 0); + UInt32 mas1 = FSL_BOOKE_MAS1(1, iprot, 0, ts, tsize); + UInt32 mas2 = FSL_BOOKE_MAS2(epn, wimge); + UInt32 mas3 = FSL_BOOKE_MAS3(rpn, 0, perms); + UInt32 mas7 = FSL_BOOKE_MAS7(rpn); hal_write_tlb(mas0, mas1, mas2, mas3, mas7); + + return true; } -/// @brief Flush system TLB. +/// @brief Flush TLB EXTERN_C void hal_flush_tlb() { asm volatile("isync;tlbwe;msync;isync"); diff --git a/Kernel/HALKit/POWER/MBCI/HalMBCIHost.cxx b/Kernel/HALKit/POWER/MBCI/HalMBCIHost.cxx index 8a24506a..03f5a387 100644 --- a/Kernel/HALKit/POWER/MBCI/HalMBCIHost.cxx +++ b/Kernel/HALKit/POWER/MBCI/HalMBCIHost.cxx @@ -4,5 +4,5 @@ ------------------------------------------- */ -#include <HALKit/POWER/Processor.hpp> +#include <HALKit/POWER/Processor.hxx> #include <KernelKit/DebugOutput.hpp> diff --git a/Kernel/HALKit/POWER/Processor.hpp b/Kernel/HALKit/POWER/Processor.hpp deleted file mode 100644 index 5ff7eef3..00000000 --- a/Kernel/HALKit/POWER/Processor.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* ------------------------------------------- - - Copyright Zeta Electronics Corporation - - Purpose: POWER processor header. - -------------------------------------------- */ - -#pragma once - -#include <NewKit/Defines.hpp> -#include <NewKit/Utils.hpp> - -#define kHalPPCAlignment __attribute__((aligned(4))) - -namespace Kernel::HAL -{ - typedef UIntPtr Reg; - - struct kHalPPCAlignment StackFrame - { - Reg R0; - Reg R1; - Reg R2; - Reg R3; - Reg R4; - Reg R5; - Reg R6; - Reg R7; - Reg R8; - Reg PC; - Reg SP; - }; - - typedef StackFrame* StackFramePtr; - - inline void rt_halt() - { - while (1) - { - asm volatile("mr 0, 0"); // no oop. - } - } - - inline void rt_cli() - { - asm volatile("mr 0, 0"); // no oop - } -} // namespace Kernel::HAL - -EXTERN_C void int_handle_math(Kernel::UIntPtr sp); -EXTERN_C void int_handle_pf(Kernel::UIntPtr sp); - -/// @brief Flush system TLB. -EXTERN_C void hal_flush_tlb(); diff --git a/Kernel/HALKit/POWER/Processor.hxx b/Kernel/HALKit/POWER/Processor.hxx new file mode 100644 index 00000000..26f739d3 --- /dev/null +++ b/Kernel/HALKit/POWER/Processor.hxx @@ -0,0 +1,60 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + + Purpose: POWER processor header. + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> +#include <NewKit/Utils.hpp> + +#define NoOp() asm volatile("mr 0, 0") +#define kHalPPCAlignment __attribute__((aligned(4))) + +namespace Kernel::HAL +{ + typedef UIntPtr Reg; + + /// @brief Stack frame (as retrieved from assembly.) + struct PACKED StackFrame final + { + Reg IntNum, Exception; + Reg A0, A2, BP, SP, A3, A4, A5, A6; + Reg R8, R9, R10, R11, R12, R13, R14, R15; + Reg Gs, Fs; + }; + + typedef StackFrame* StackFramePtr; + + inline void rt_halt() + { + while (true) + { + NoOp(); // no oop. + } + } + + inline void rt_cli() + { + NoOp(); // no oop + } +} // namespace Kernel::HAL + +EXTERN_C Kernel::Void int_handle_math(Kernel::UIntPtr sp); +EXTERN_C Kernel::Void int_handle_pf(Kernel::UIntPtr sp); + +/// @brief Set TLB. +Kernel::Bool hal_set_tlb(Kernel::UInt8 tlb, Kernel::UInt32 epn, + Kernel::UInt64 rpn, Kernel::UInt8 perms, + Kernel::UInt8 wimge, Kernel::UInt8 ts, + Kernel::UInt8 esel, Kernel::UInt8 tsize, Kernel::UInt8 iprot); + +/// @brief Write TLB. +Kernel::Void hal_write_tlb(Kernel::UInt32 mas0, Kernel::UInt32 mas1, + Kernel::UInt32 mas2, Kernel::UInt32 mas3, Kernel::UInt32 mas7); + +/// @brief Flush TLB. +EXTERN_C Kernel::Void hal_flush_tlb(); diff --git a/Kernel/Sources/HalPageAlloc.cxx b/Kernel/Sources/HalPageAlloc.cxx index 0339745b..c3831ee1 100644 --- a/Kernel/Sources/HalPageAlloc.cxx +++ b/Kernel/Sources/HalPageAlloc.cxx @@ -7,9 +7,9 @@ #include <ArchKit/ArchKit.hpp> #ifdef __NEWOS_AMD64__ -#include <HALKit/AMD64/HalPageAlloc.hpp> +#include <HALKit/AMD64/HalPageAlloc.hxx> #elif defined(__NEWOS_ARM64__) -#include <HALKit/ARM64/HalPageAlloc.hpp> +#include <HALKit/ARM64/HalPageAlloc.hxx> #endif #include <NewKit/Defines.hpp> diff --git a/Kernel/Sources/PageManager.cxx b/Kernel/Sources/PageManager.cxx index 35693310..451e2041 100644 --- a/Kernel/Sources/PageManager.cxx +++ b/Kernel/Sources/PageManager.cxx @@ -8,9 +8,9 @@ #include <NewKit/PageManager.hpp> #ifdef __NEWOS_AMD64__ -#include <HALKit/AMD64/HalPageAlloc.hpp> +#include <HALKit/AMD64/HalPageAlloc.hxx> #elif defined(__NEWOS_ARM64__) -#include <HALKit/ARM64/HalPageAlloc.hpp> +#include <HALKit/ARM64/HalPageAlloc.hxx> #endif // ifdef __NEWOS_AMD64__ || defined(__NEWOS_ARM64__) //! null deref will throw (Page Zero detected, aborting app!) diff --git a/Kernel/Sources/Pmm.cxx b/Kernel/Sources/Pmm.cxx index 22813206..19e32327 100644 --- a/Kernel/Sources/Pmm.cxx +++ b/Kernel/Sources/Pmm.cxx @@ -12,7 +12,7 @@ #endif #if defined(__NEWOS_AMD64__) -#include <HALKit/AMD64/Processor.hpp> +#include <HALKit/AMD64/Processor.hxx> #endif namespace Kernel diff --git a/newoskrnl.files b/newoskrnl.files index d9754e73..8ad46350 100644 --- a/newoskrnl.files +++ b/newoskrnl.files @@ -101,7 +101,7 @@ Kernel/HALKit/AMD64/HalInterruptAPI.asm Kernel/HALKit/AMD64/HalKernelMain.cxx
Kernel/HALKit/AMD64/HalKernelMouse.cxx
Kernel/HALKit/AMD64/HalBoot.asm
-Kernel/HALKit/AMD64/HalPageAlloc.hpp
+Kernel/HALKit/AMD64/HalPageAlloc.hxx
Kernel/HALKit/AMD64/HalProcessor.cpp
Kernel/HALKit/AMD64/HalRoutines.s
Kernel/HALKit/AMD64/HalSMPCore.cxx
@@ -115,12 +115,12 @@ Kernel/HALKit/AMD64/PCI/Express.cxx Kernel/HALKit/AMD64/PCI/IO.cxx
Kernel/HALKit/AMD64/PCI/Iterator.cxx
Kernel/HALKit/AMD64/PCI/PCI.cxx
-Kernel/HALKit/AMD64/Processor.hpp
+Kernel/HALKit/AMD64/Processor.hxx
Kernel/HALKit/AMD64/ReadMe.md
Kernel/HALKit/AMD64/Storage/AHCI.cxx
Kernel/HALKit/AMD64/Storage/ATA-DMA.cxx
Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx
-Kernel/HALKit/ARM64/HalPageAlloc.hpp
+Kernel/HALKit/ARM64/HalPageAlloc.hxx
Kernel/HALKit/ARM64/HalPageInternal.S
Kernel/HALKit/ARM64/HalTimer.cxx
Kernel/HALKit/ARM64/Processor.hxx
@@ -130,7 +130,7 @@ Kernel/HALKit/AXP/CR.s Kernel/HALKit/AXP/CoreInterruptHandlerDEC.cpp
Kernel/HALKit/AXP/CoreSyscallHandlerDEC.cpp
Kernel/HALKit/AXP/HAL.s
-Kernel/HALKit/AXP/Processor.hpp
+Kernel/HALKit/AXP/Processor.hxx
Kernel/HALKit/AXP/SYSCALL.s
Kernel/HALKit/AXP/VM.s
Kernel/HALKit/POWER/HalContextSwitchPowerPC.s
@@ -142,7 +142,7 @@ Kernel/HALKit/POWER/HalThread.cxx Kernel/HALKit/POWER/HalVirtualMemory.cxx
Kernel/HALKit/POWER/Hart.hxx
Kernel/HALKit/POWER/MBCI/HalMBCIHost.cxx
-Kernel/HALKit/POWER/Processor.hpp
+Kernel/HALKit/POWER/Processor.hxx
Kernel/HALKit/POWER/ReadMe.md
Kernel/HALKit/POWER/ppc-cpu.h
Kernel/HALKit/POWER/ppc-mmu.h
|
