From 9784f940cf71aef91ccbeb1a11651a83a3eff213 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 24 Jun 2024 14:33:40 +0200 Subject: IMP: UIAccessibilty class, work in progress Core CoreGraphics (GPU/FB SDK). REFACTOR: Moved Builtins to Modules/ Signed-off-by: Amlal El Mahrouss --- Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx | 2 +- .../HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp | 2 +- Kernel/HALKit/AMD64/HalHart.cpp | 1 - Kernel/HALKit/AMD64/HalKernelMain.cxx | 70 +++++++++++----------- Kernel/HALKit/AMD64/HalKernelMouse.cxx | 6 +- Kernel/HALKit/AMD64/HalPageAlloc.hpp | 18 +++--- Kernel/HALKit/AMD64/Processor.hpp | 12 ++-- Kernel/HALKit/AMD64/Storage/AHCI.cxx | 2 +- Kernel/HALKit/AMD64/Storage/ATA-DMA.cxx | 6 +- Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx | 2 +- Kernel/HALKit/ARM64/HalPageAlloc.hpp | 40 ++++++++----- Kernel/HALKit/ARM64/Processor.hxx | 6 +- 12 files changed, 90 insertions(+), 77 deletions(-) (limited to 'Kernel/HALKit') diff --git a/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx b/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx index 213be057..7a54edfa 100644 --- a/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx +++ b/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include +#include #include #include #include diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp index c8eb094c..e4a2d99c 100644 --- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp +++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include +#include #include #include #include diff --git a/Kernel/HALKit/AMD64/HalHart.cpp b/Kernel/HALKit/AMD64/HalHart.cpp index 069f3767..4718d4ab 100644 --- a/Kernel/HALKit/AMD64/HalHart.cpp +++ b/Kernel/HALKit/AMD64/HalHart.cpp @@ -29,6 +29,5 @@ namespace NewOS { /* nohing, code is spinning */ } - } } // namespace NewOS diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx index 88add1d1..0381e4ab 100644 --- a/Kernel/HALKit/AMD64/HalKernelMain.cxx +++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx @@ -5,7 +5,7 @@ ------------------------------------------- */ #include -#include +#include #include #include #include @@ -14,6 +14,7 @@ #include #include #include +#include #include /// @brief This symbol is the kernel main symbol. @@ -24,7 +25,7 @@ EXTERN_C NewOS::VoidPtr kInterruptVectorTable[]; struct PACKED HeapAllocInfo final { NewOS::VoidPtr fThe; - NewOS::Size fTheSz; + NewOS::Size fTheSz; }; struct PACKED ProcessBlockInfo final @@ -38,7 +39,7 @@ struct PACKED ProcessExitInfo final STATIC constexpr auto cReasonLen = 512; NewOS::Int64 fCode; - NewOS::Char fReason[cReasonLen]; + NewOS::Char fReason[cReasonLen]; }; namespace NewOS::HAL @@ -98,30 +99,30 @@ EXTERN_C void hal_init_platform( register basic syscalls. */ - constexpr auto cSerialWriteInterrupt = 0x10; // 16 - constexpr auto cTlsInterrupt = 0x11; // 17 - constexpr auto cTlsInstallInterrupt = 0x12; // 18 - constexpr auto cNewInterrupt = 0x13; // 19 - constexpr auto cDeleteInterrupt = 0x14; // 20 - constexpr auto cExitInterrupt = 0x15; - constexpr auto cLastExitInterrupt = 0x16; - constexpr auto cCatalogOpen = 0x17; - constexpr auto cForkRead = 0x18; - constexpr auto cForkWrite = 0x19; - constexpr auto cCatalogClose = 0x20; - constexpr auto cCatalogRemove = 0x21; - constexpr auto cCatalogCreate = 0x22; - - kSyscalls[cSerialWriteInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx) -> void { + constexpr auto cSerialAlertInterrupt = 0x10; // 16 + constexpr auto cTlsInterrupt = 0x11; // 17 + constexpr auto cTlsInstallInterrupt = 0x12; // 18 + constexpr auto cNewInterrupt = 0x13; // 19 + constexpr auto cDeleteInterrupt = 0x14; // 20 + constexpr auto cExitInterrupt = 0x15; + constexpr auto cLastExitInterrupt = 0x16; + constexpr auto cCatalogOpen = 0x17; + constexpr auto cForkRead = 0x18; + constexpr auto cForkWrite = 0x19; + constexpr auto cCatalogClose = 0x20; + constexpr auto cCatalogRemove = 0x21; + constexpr auto cCatalogCreate = 0x22; + + kSyscalls[cSerialAlertInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx) -> void { const char* msg = (const char*)rdx; NewOS::kcout << "newoskrnl: " << msg << "\r"; }; - kSyscalls[cTlsInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void { + kSyscalls[cTlsInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx) -> void { tls_check_syscall_impl(rdx); }; - kSyscalls[cNewInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void { + kSyscalls[cNewInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx) -> void { /// get HAC struct. HeapAllocInfo* rdxInf = reinterpret_cast(rdx); @@ -129,7 +130,7 @@ EXTERN_C void hal_init_platform( rdxInf->fThe = NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().New(rdxInf->fTheSz); }; - kSyscalls[cDeleteInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void { + kSyscalls[cDeleteInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx) -> void { /// get HAC struct. HeapAllocInfo* rdxInf = reinterpret_cast(rdx); @@ -137,36 +138,37 @@ EXTERN_C void hal_init_platform( NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().Delete(rdxInf->fThe, rdxInf->fTheSz); }; - kSyscalls[cTlsInstallInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void { + kSyscalls[cTlsInstallInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx) -> void { ProcessBlockInfo* rdxPb = reinterpret_cast(rdx); /// install the process's fTIB and fPIB. rt_install_tib(rdxPb->fTIB, rdxPb->fPIB); }; - kSyscalls[cExitInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void { + kSyscalls[cExitInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx) -> void { ProcessExitInfo* rdxEi = reinterpret_cast(rdx); NewOS::kcout << "newoskrnl: " << rdxEi->fReason << "\r"; NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().Exit(rdxEi->fCode); }; - kSyscalls[cLastExitInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void { + kSyscalls[cLastExitInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx) -> void { ProcessExitInfo* rdxEi = reinterpret_cast(rdx); - rdxEi->fCode = NewOS::rt_get_exit_code(); + rdxEi->fCode = NewOS::rt_get_exit_code(); }; - kSyscalls[cSerialWriteInterrupt].Leak().Leak()->fHooked = true; - kSyscalls[cTlsInterrupt].Leak().Leak()->fHooked = true; - kSyscalls[cTlsInstallInterrupt].Leak().Leak()->fHooked = true; - kSyscalls[cDeleteInterrupt].Leak().Leak()->fHooked = true; - kSyscalls[cNewInterrupt].Leak().Leak()->fHooked = true; - kSyscalls[cExitInterrupt].Leak().Leak()->fHooked = true; - kSyscalls[cLastExitInterrupt].Leak().Leak()->fHooked = true; - - KeMain(); + kSyscalls[cSerialAlertInterrupt].Leak().Leak()->fHooked = true; + kSyscalls[cTlsInterrupt].Leak().Leak()->fHooked = true; + kSyscalls[cTlsInstallInterrupt].Leak().Leak()->fHooked = true; + kSyscalls[cDeleteInterrupt].Leak().Leak()->fHooked = true; + kSyscalls[cNewInterrupt].Leak().Leak()->fHooked = true; + kSyscalls[cExitInterrupt].Leak().Leak()->fHooked = true; + kSyscalls[cLastExitInterrupt].Leak().Leak()->fHooked = true; + NewOS::UIAccessibilty::The().Show("RCM", NewOS::UIAccessibilty::The().Width(), NewOS::UIAccessibilty::The().Height()); NewOS::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_RsdPtr); + KeMain(); + NewOS::ke_stop(RUNTIME_CHECK_BOOTSTRAP); } diff --git a/Kernel/HALKit/AMD64/HalKernelMouse.cxx b/Kernel/HALKit/AMD64/HalKernelMouse.cxx index 5d50e4f2..71644d46 100644 --- a/Kernel/HALKit/AMD64/HalKernelMouse.cxx +++ b/Kernel/HALKit/AMD64/HalKernelMouse.cxx @@ -4,9 +4,9 @@ ------------------------------------------- */ -#include -#include -#include +#include +#include +#include #include #include diff --git a/Kernel/HALKit/AMD64/HalPageAlloc.hpp b/Kernel/HALKit/AMD64/HalPageAlloc.hpp index 332c8ed4..bda7d902 100644 --- a/Kernel/HALKit/AMD64/HalPageAlloc.hpp +++ b/Kernel/HALKit/AMD64/HalPageAlloc.hpp @@ -38,16 +38,16 @@ namespace NewOS::HAL { struct PACKED PageTable64 final { - bool Present : 1; - bool Rw : 1; - bool User : 1; - bool Wt : 1; - bool Cache : 1; - bool Accessed : 1; - NewOS::Int32 Reserved : 6; + bool Present : 1; + bool Rw : 1; + bool User : 1; + bool Wt : 1; + bool Cache : 1; + bool Accessed : 1; + NewOS::Int32 Reserved : 6; NewOS::UInt64 PhysicalAddress : 36; - NewOS::Int32 Reserved1 : 15; - bool ExecDisable : 1; + NewOS::Int32 Reserved1 : 15; + bool ExecDisable : 1; }; namespace Detail diff --git a/Kernel/HALKit/AMD64/Processor.hpp b/Kernel/HALKit/AMD64/Processor.hpp index 98a5aee6..d39a7984 100644 --- a/Kernel/HALKit/AMD64/Processor.hpp +++ b/Kernel/HALKit/AMD64/Processor.hpp @@ -28,10 +28,10 @@ #define IsActiveLow(FLG) (FLG & 2) #define IsLevelTriggered(FLG) (FLG & 8) -#define kInterruptGate (0x8E) -#define kTrapGate (0xEF) -#define kTaskGate (0b10001100) -#define kGdtCodeSelector (0x08) +#define kInterruptGate (0x8E) +#define kTrapGate (0xEF) +#define kTaskGate (0b10001100) +#define kGdtCodeSelector (0x08) #define cHeapStartOffset (0x10000000) namespace NewOS @@ -54,7 +54,7 @@ namespace NewOS namespace NewOS::HAL { - /// @brief Virtual memory flags. + /// @brief Virtual memory flags. enum { eFlagsUser, @@ -147,7 +147,7 @@ namespace NewOS::HAL using RawRegister = UInt64; - using InterruptId = UShort; /* For each element in the IVT */ + using InterruptId = UShort; /* For each element in the IVT */ using InterruptTrapKind = UIntPtr(UIntPtr sp); typedef UIntPtr Reg; diff --git a/Kernel/HALKit/AMD64/Storage/AHCI.cxx b/Kernel/HALKit/AMD64/Storage/AHCI.cxx index 587c64cb..8555b3de 100644 --- a/Kernel/HALKit/AMD64/Storage/AHCI.cxx +++ b/Kernel/HALKit/AMD64/Storage/AHCI.cxx @@ -15,7 +15,7 @@ * */ -#include +#include #include #ifdef __AHCI__ diff --git a/Kernel/HALKit/AMD64/Storage/ATA-DMA.cxx b/Kernel/HALKit/AMD64/Storage/ATA-DMA.cxx index 4e41e3ce..b6dacf21 100644 --- a/Kernel/HALKit/AMD64/Storage/ATA-DMA.cxx +++ b/Kernel/HALKit/AMD64/Storage/ATA-DMA.cxx @@ -17,7 +17,7 @@ #include -#include +#include #include using namespace NewOS; @@ -28,11 +28,11 @@ STATIC PRDT kPRDT; #ifdef __ATA_DMA__ #ifdef __ATA_PIO__ -#error !!! You cant have both PIO and DMA enabled! !!! +#error !!! You cant have both PIO and DMA enabled! !!! #endif /* ifdef __ATA_PIO__ */ #ifdef __AHCI__ -#error !!! You cant have both ATA and AHCI enabled! !!! +#error !!! You cant have both ATA and AHCI enabled! !!! #endif /* ifdef __AHCI__ */ #endif /* ifdef __ATA_DMA__ */ diff --git a/Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx b/Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx index e4ab1367..7853d497 100644 --- a/Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx +++ b/Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx @@ -15,7 +15,7 @@ * */ -#include +#include #include #ifdef __ATA_PIO__ diff --git a/Kernel/HALKit/ARM64/HalPageAlloc.hpp b/Kernel/HALKit/ARM64/HalPageAlloc.hpp index 2959f0fc..fbdbfea8 100644 --- a/Kernel/HALKit/ARM64/HalPageAlloc.hpp +++ b/Kernel/HALKit/ARM64/HalPageAlloc.hpp @@ -29,31 +29,43 @@ //! short format address range #define c16KBPage 0b000 -#define c8KBPage 0b001 -#define c4KBPage 0b010 -#define c2KBPage 0b011 -#define c1KBPage 0b100 +#define c8KBPage 0b001 +#define c4KBPage 0b010 +#define c2KBPage 0b011 +#define c1KBPage 0b100 #define c512BPage 0b101 #define c256BPage 0b110 #define c128BPage 0b111 /// Long format address range -#define cPageMAll { 0b000, 0b000 } -#define cPageMToMax(M) { M, 0b000 } -#define cPageMaxToM(M) { 0b000, M } -#define cPageMToN(M, N) { M, N } +#define cPageMAll \ + { \ + 0b000, 0b000 \ + } +#define cPageMToMax(M) \ + { \ + M, 0b000 \ + } +#define cPageMaxToM(M) \ + { \ + 0b000, M \ + } +#define cPageMToN(M, N) \ + { \ + M, N \ + } namespace NewOS::HAL { struct PACKED LongDescLevel3 final { - Boolean Present : 1; - Boolean Rw : 1; - UInt16 Lpat : 9; - UInt32 Address : 27; - UInt32 Sbzp : 12; - UInt32 UPat : 11; + Boolean Present : 1; + Boolean Rw : 1; + UInt16 Lpat : 9; + UInt32 Address : 27; + UInt32 Sbzp : 12; + UInt32 UPat : 11; }; namespace Detail diff --git a/Kernel/HALKit/ARM64/Processor.hxx b/Kernel/HALKit/ARM64/Processor.hxx index ae0fc86d..d9a86270 100644 --- a/Kernel/HALKit/ARM64/Processor.hxx +++ b/Kernel/HALKit/ARM64/Processor.hxx @@ -27,13 +27,13 @@ namespace NewOS::HAL { - struct PACKED Register64 final + struct PACKED Register64 final { UShort Limit; UIntPtr Base; }; - typedef UIntPtr Reg; + typedef UIntPtr Reg; typedef Register64 Register; struct PACKED StackFrame final @@ -45,7 +45,7 @@ namespace NewOS::HAL }; typedef StackFrame* StackFramePtr; -} +} // namespace NewOS::HAL inline NewOS::VoidPtr kKernelVirtualStart = (NewOS::VoidPtr)cHeapStartOffset; inline NewOS::UIntPtr kKernelVirtualSize = 0UL; -- cgit v1.2.3