diff options
31 files changed, 208 insertions, 165 deletions
diff --git a/public/frameworks/KernelTest.fwrk/headers/TestCase.h b/public/frameworks/KernelTest.fwrk/headers/TestCase.h index 2089ffd4..c3780da5 100644 --- a/public/frameworks/KernelTest.fwrk/headers/TestCase.h +++ b/public/frameworks/KernelTest.fwrk/headers/TestCase.h @@ -39,9 +39,7 @@ KT_MUST_PASS(ret, ret, true); \ } \ } \ - inline const Char* KTTestCase##NAME::ToString() { \ - return #FN; \ - } + inline const Char* KTTestCase##NAME::ToString() { return #FN; } KT_DECL_TEST(AlwaysBreak, []() -> bool { KT_MUST_PASS("AlwaysBreak", YES, NO); diff --git a/public/tools/diutil/vendor/Dialogs.h b/public/tools/diutil/vendor/Dialogs.h index d1bbd7a2..28cd8fa9 100644 --- a/public/tools/diutil/vendor/Dialogs.h +++ b/public/tools/diutil/vendor/Dialogs.h @@ -176,7 +176,7 @@ namespace internal { #elif __EMSCRIPTEN__ void start(int exit_code); #else - void start_process(std::vector<std::string> const& command); + void start_process(std::vector<std::string> const& command); #endif ~executor(); @@ -491,10 +491,10 @@ inline settings::settings(bool resync) { #if _WIN32 flags(flag::is_vista) = internal::is_vista(); #elif !__APPLE__ - flags(flag::has_zenity) = check_program("zenity"); + flags(flag::has_zenity) = check_program("zenity"); flags(flag::has_matedialog) = check_program("matedialog"); - flags(flag::has_qarma) = check_program("qarma"); - flags(flag::has_kdialog) = check_program("kdialog"); + flags(flag::has_qarma) = check_program("qarma"); + flags(flag::has_kdialog) = check_program("kdialog"); // If multiple helpers are available, try to default to the best one if (flags(flag::has_zenity) && flags(flag::has_kdialog)) { @@ -541,7 +541,7 @@ inline bool settings::check_program(std::string const& program) { (void) program; return false; #else - int exit_code = -1; + int exit_code = -1; internal::executor async; async.start_process({"/bin/sh", "-c", "which " + program}); async.result(&exit_code); @@ -605,7 +605,7 @@ inline std::string path::home() { if (size_max != -1) len = size_t(size_max); #endif std::vector<char> buf(len); - struct passwd pwd, *result; + struct passwd pwd, *result; if (getpwuid_r(getuid(), &pwd, buf.data(), buf.size(), &result) == 0) return result->pw_dir; #endif return "/"; @@ -718,7 +718,7 @@ inline void internal::executor::start_process(std::vector<std::string> const& co } close(in[1]); - m_fd = out[0]; + m_fd = out[0]; auto flags = fcntl(m_fd, F_GETFL); fcntl(m_fd, F_SETFL, flags | O_NONBLOCK); @@ -754,7 +754,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) // FIXME: do something (void) timeout; #else - char buf[BUFSIZ]; + char buf[BUFSIZ]; ssize_t received = read(m_fd, buf, BUFSIZ); // Flawfinder: ignore if (received > 0) { m_stdout += std::string(buf, received); @@ -765,7 +765,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) // (this happens when the calling application handles or ignores SIG_CHLD) and results in // waitpid() failing with ECHILD. Otherwise we assume the child is running and we sleep for // a little while. - int status; + int status; pid_t child = waitpid(m_pid, &status, WNOHANG); if (child != m_pid && (child >= 0 || errno != ECHILD)) { // FIXME: this happens almost always at first iteration @@ -783,7 +783,8 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) inline void internal::executor::stop() { // Loop until the user closes the dialog - while (!ready()); + while (!ready()) + ; } // dll implementation @@ -879,11 +880,11 @@ inline std::vector<std::string> internal::dialog::desktop_helper() const { #if __APPLE__ return {"osascript"}; #else - return {flags(flag::has_zenity) ? "zenity" + return {flags(flag::has_zenity) ? "zenity" : flags(flag::has_matedialog) ? "matedialog" - : flags(flag::has_qarma) ? "qarma" - : flags(flag::has_kdialog) ? "kdialog" - : "echo"}; + : flags(flag::has_qarma) ? "qarma" + : flags(flag::has_kdialog) ? "kdialog" + : "echo"}; #endif } @@ -1125,9 +1126,9 @@ inline internal::file_dialog::file_dialog(type in_type, std::string const& title // Split the pattern list to check whether "*" is in there; if it // is, we have to disable filters because there is no mechanism in // OS X for the user to override the filter. - std::regex sep("\\s+"); - std::string filter_list; - bool has_filter = true; + std::regex sep("\\s+"); + std::string filter_list; + bool has_filter = true; std::sregex_token_iterator iter(patterns.begin(), patterns.end(), sep, -1); std::sregex_token_iterator end; for (; iter != end; ++iter) { @@ -1236,7 +1237,7 @@ inline std::vector<std::string> internal::file_dialog::vector_result() { return m_vector_result; #else std::vector<std::string> ret; - auto result = m_async->result(); + auto result = m_async->result(); for (;;) { // Split result along newline characters auto i = result.find('\n'); @@ -1569,7 +1570,7 @@ inline message::message(std::string const& title, std::string const& text, if_cancel = button::ok; break; } - m_mappings[1] = if_cancel; + m_mappings[1] = if_cancel; m_mappings[256] = if_cancel; // XXX: I think this was never correct script += " with icon "; switch (_icon) { @@ -1656,7 +1657,7 @@ inline message::message(std::string const& title, std::string const& text, if (_choice == choice::yes_no_cancel) flag += "cancel"; command.push_back(flag); if (_choice == choice::yes_no || _choice == choice::yes_no_cancel) { - m_mappings[0] = button::yes; + m_mappings[0] = button::yes; m_mappings[256] = button::no; } } diff --git a/src/boot/BootKit/BootKit.h b/src/boot/BootKit/BootKit.h index 4275e695..086d36e7 100644 --- a/src/boot/BootKit/BootKit.h +++ b/src/boot/BootKit/BootKit.h @@ -290,16 +290,16 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const Char* part_name) { CopyMem(gpt_part->Signature, reinterpret_cast<VoidPtr>(const_cast<Char*>(kMagicGPT)), StrLen(kMagicGPT)); - gpt_part->Revision = 0x00010000; + gpt_part->Revision = 0x00010000; gpt_part->HeaderSize = sizeof(GPT_PARTITION_TABLE); gpt_part->CRC32 = 0x00000000; - gpt_part->Reserved1 = 0x00000000; - gpt_part->LBAHeader = 0x00000000; - gpt_part->LBAAltHeader = 0x00000000; + gpt_part->Reserved1 = 0x00000000; + gpt_part->LBAHeader = 0x00000000; + gpt_part->LBAAltHeader = 0x00000000; gpt_part->FirstGPTEntry = 0x00000000; - gpt_part->LastGPTEntry = 0x00000000; + gpt_part->LastGPTEntry = 0x00000000; gpt_part->Guid.Data1 = 0x00000000; gpt_part->Guid.Data2 = 0x0000; @@ -309,10 +309,10 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const Char* part_name) { gpt_part->Revision = 0x00010000; - gpt_part->StartingLBA = 0x00000000; + gpt_part->StartingLBA = 0x00000000; gpt_part->NumPartitionEntries = 0x00000000; - gpt_part->SizeOfEntries = 0x00000000; - gpt_part->CRC32PartEntry = 0x00000000; + gpt_part->SizeOfEntries = 0x00000000; + gpt_part->CRC32PartEntry = 0x00000000; SetMem(gpt_part->Reserved2, 0, kSectorAlignGPT_PartTbl); diff --git a/src/boot/modules/SysChk/SysChk.cpp b/src/boot/modules/SysChk/SysChk.cpp index e8c5af06..c7217504 100644 --- a/src/boot/modules/SysChk/SysChk.cpp +++ b/src/boot/modules/SysChk/SysChk.cpp @@ -30,7 +30,7 @@ EXTERN_C Int32 SysChkModuleMain(Kernel::HEL::BootInfoHeader* handover) { Boot::BDiskFormatFactory<Boot::BootDeviceSATA> partition_factory; #endif - if (partition_factory.IsPartitionValid()) return kEfiOk; + if (!partition_factory.IsPartitionValid()) return kEfiFail; return partition_factory.Format(kMachineModel); } diff --git a/src/boot/modules/SysChk/amd64-ahci-epm.json b/src/boot/modules/SysChk/amd64-ahci-epm.json index 444003cf..43b0bff7 100644 --- a/src/boot/modules/SysChk/amd64-ahci-epm.json +++ b/src/boot/modules/SysChk/amd64-ahci-epm.json @@ -34,6 +34,7 @@ "__SYSCHK__", "BOOTZ_EPM_SUPPORT", "__nekernel_max_cores=8", + "__nekernel_dma_best_align=8", "__nekernel_dma_pool_start=0x1000000", "__nekernel_dma_pool_size=0x1000000", "__nekernel_halkit_include_processor=\"<HALKit/AMD64/Processor.h>\"", diff --git a/src/boot/modules/SysChk/amd64-ahci-gpt.json b/src/boot/modules/SysChk/amd64-ahci-gpt.json index 9b0f4546..d36f66bf 100644 --- a/src/boot/modules/SysChk/amd64-ahci-gpt.json +++ b/src/boot/modules/SysChk/amd64-ahci-gpt.json @@ -31,6 +31,7 @@ "__NE_AMD64__", "__AHCI__", "__nekernel_max_cores=8", + "__nekernel_dma_best_align=8", "__nekernel_dma_pool_start=0x1000000", "__nekernel_dma_pool_size=0x1000000", "__nekernel_halkit_include_processor=\"<HALKit/AMD64/Processor.h>\"", diff --git a/src/boot/modules/SysChk/amd64-pio-epm.json b/src/boot/modules/SysChk/amd64-pio-epm.json index 0c4a1c59..7e4b1d4e 100644 --- a/src/boot/modules/SysChk/amd64-pio-epm.json +++ b/src/boot/modules/SysChk/amd64-pio-epm.json @@ -9,14 +9,21 @@ "./" ], "sources_path": [ - "*.cpp", - "*.S", - "../../src/HEL/AMD64/BootATA.cpp", - "../../src/HEL/AMD64/BootPlatform.cpp", - "../../src/HEL/AMD64/BootAPI.S", - "../../src/BootTextWriter.cpp", - "../../src/BootSupport.cpp", - "../../src/New+Delete.cpp" + "*.cpp", + "*.S", + "../../src/HEL/AMD64/BootATA.cpp", + "../../src/HEL/AMD64/BootPlatform.cpp", + "../../src/HEL/AMD64/BootAPI.S", + "../../src/BootTextWriter.cpp", + "../../src/BootSupport.cpp", + "../../src/New+Delete.cpp", + "../../../kernel/HALKit/AMD64/PCI/*.cpp", + "../../../kernel/HALKit/AMD64/Storage/*.cpp", + "../../../kernel/src/Storage/*.cpp", + "../../../kernel/src/Network/*.cpp", + "../../../kernel/HALKit/AMD64/*.cpp", + "../../../kernel/HALKit/AMD64/*.s", + "../../../kernel/src/*.cpp" ], "output_name": "chk.efi", "compiler_flags": [ @@ -28,15 +35,15 @@ ], "cpp_macros": [ "__NEOSKRNL__", - "__BOOTZ__", - "__BOOTZ_STANDALONE__", "__NE_AMD64__", "__nekernel_max_cores=8", + "__nekernel_dma_best_align=8", "__nekernel_dma_pool_start=0x1000000", "__nekernel_dma_pool_size=0x1000000", "__nekernel_halkit_include_processor=\"<HALKit/AMD64/Processor.h>\"", "__ATA_PIO__", "BOOTZ_EPM_SUPPORT", + "__NE_MODULAR_KERNEL_COMPONENTS__", "__NE_VEPM__", "kChkVersionHighest=0x0100", "kChkVersionLowest=0x0100", diff --git a/src/boot/modules/SysChk/amd64-pio-gpt.json b/src/boot/modules/SysChk/amd64-pio-gpt.json index ca564067..d954daed 100644 --- a/src/boot/modules/SysChk/amd64-pio-gpt.json +++ b/src/boot/modules/SysChk/amd64-pio-gpt.json @@ -34,6 +34,7 @@ "__ATA_PIO__", "__NE_VEPM__", "__nekernel_max_cores=8", + "__nekernel_dma_best_align=8", "__nekernel_dma_pool_start=0x1000000", "__nekernel_dma_pool_size=0x1000000", "__nekernel_halkit_include_processor=\"<HALKit/AMD64/Processor.h>\"", diff --git a/src/boot/src/BootThread.cpp b/src/boot/src/BootThread.cpp index c0c72d8b..d18026db 100644 --- a/src/boot/src/BootThread.cpp +++ b/src/boot/src/BootThread.cpp @@ -185,29 +185,7 @@ Int32 BootThread::Start(HEL::BootInfoHeader* handover, Bool own_stack) { writer.Write("BootZ: Starting: ").Write(fBlobName).Write("\r"); writer.Write("BootZ: Handover address: ").Write((UIntPtr) fHandover).Write("\r"); - if (own_stack) { - writer.Write("BootZ: Using it's own stack.\r"); - writer.Write("BootZ: Stack address: ").Write((UIntPtr) &fStack[kBootThreadSz - 1]).Write("\r"); - writer.Write("BootZ: Stack size: ").Write(kBootThreadSz).Write("\r"); - - fHandover->f_StackTop = &fStack[kBootThreadSz - 1]; - fHandover->f_StackSz = kBootThreadSz; - - auto ret = rt_jump_to_address(fStartAddress, fHandover, &fStack[kBootThreadSz - 1]); - - // we don't need the stack anymore. - - delete[] fStack; - fStack = nullptr; - - return ret; - } else { - writer.Write("BootZ: Using the bootloader's stack.\r"); - - return reinterpret_cast<HEL::HandoverProc>(fStartAddress)(fHandover); - } - - return kEfiFail; + return reinterpret_cast<HEL::HandoverProc>(fStartAddress)(fHandover); } const Char* BootThread::GetName() { diff --git a/src/boot/src/root/ifs.json b/src/boot/src/root/ifs.json index 354ab503..354ab503 100644..100755 --- a/src/boot/src/root/ifs.json +++ b/src/boot/src/root/ifs.json diff --git a/src/kernel/FSKit/Ext2+IFS.h b/src/kernel/FSKit/Ext2+IFS.h index 48cde432..ea676c97 100644 --- a/src/kernel/FSKit/Ext2+IFS.h +++ b/src/kernel/FSKit/Ext2+IFS.h @@ -31,7 +31,7 @@ class Ext2Context final { } } - Ext2Context(const Ext2Context&) = delete; + Ext2Context(const Ext2Context&) = delete; Ext2Context& operator=(const Ext2Context&) = delete; Ext2Context(Ext2Context&& other) : drive(other.drive), superblock(other.superblock) { diff --git a/src/kernel/FSKit/OpenHeFS.h b/src/kernel/FSKit/OpenHeFS.h index 2bc05213..98b16b28 100644 --- a/src/kernel/FSKit/OpenHeFS.h +++ b/src/kernel/FSKit/OpenHeFS.h @@ -266,7 +266,7 @@ inline UInt32 hefs_hour_get(ATime raw_atime) { /// @return the minute value. /// @note The minute is stored in the lower 8 bits of the ATime value. inline UInt32 hefs_minute_get(ATime raw_atime) { - return (raw_atime) & 0xFF; + return (raw_atime) &0xFF; } inline constexpr UInt32 kOpenHeFSBaseYear = 1970; @@ -386,10 +386,10 @@ class HeFileSystemParser final { ~HeFileSystemParser() = default; public: - HeFileSystemParser(const HeFileSystemParser&) = delete; + HeFileSystemParser(const HeFileSystemParser&) = delete; HeFileSystemParser& operator=(const HeFileSystemParser&) = delete; - HeFileSystemParser(HeFileSystemParser&&) = delete; + HeFileSystemParser(HeFileSystemParser&&) = delete; HeFileSystemParser& operator=(HeFileSystemParser&&) = delete; public: diff --git a/src/kernel/FirmwareKit/EFI/API.h b/src/kernel/FirmwareKit/EFI/API.h index bbd0588b..fce2b411 100644 --- a/src/kernel/FirmwareKit/EFI/API.h +++ b/src/kernel/FirmwareKit/EFI/API.h @@ -1,4 +1,4 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/ne-foss-org/nekernel @@ -71,8 +71,6 @@ inline void ThrowError(const EfiCharType* ErrorCode, const EfiCharType* Reason) } // namespace Boot inline void fw_init_efi(EfiSystemTable* SystemTable) { - if (!SystemTable) return; - ST = SystemTable; BS = ST->BootServices; } diff --git a/src/kernel/FirmwareKit/EFI/EFI.h b/src/kernel/FirmwareKit/EFI/EFI.h index 6deb340c..4dc85ab6 100644 --- a/src/kernel/FirmwareKit/EFI/EFI.h +++ b/src/kernel/FirmwareKit/EFI/EFI.h @@ -55,7 +55,7 @@ typedef Char16 EfiChar16Type; /// @brief Core Handle Kind /// Self is like NT's Win32 HANDLE type. typedef struct EfiHandle { -}* EfiHandlePtr; +} * EfiHandlePtr; /* UEFI uses wide characters by default. */ typedef WideChar EfiCharType; @@ -237,42 +237,64 @@ typedef struct EfiTableHeader { UInt32 Reserved; } EfiTableHeader; -#define EFI_ACPI_TABLE_PROTOCOL_GUID \ - {0xffe06bdd, 0x6107, 0x46a6, {0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c}} +#define EFI_ACPI_TABLE_PROTOCOL_GUID \ + { \ + 0xffe06bdd, 0x6107, 0x46a6, { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c } \ + } -#define EFI_LOAD_FILE_PROTOCOL_GUID \ - {0x56EC3091, 0x954C, 0x11d2, {0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}} +#define EFI_LOAD_FILE_PROTOCOL_GUID \ + { \ + 0x56EC3091, 0x954C, 0x11d2, { 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } -#define EFI_LOAD_FILE2_PROTOCOL_GUID \ - {0x4006c0c1, 0xfcb3, 0x403e, {0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d}} +#define EFI_LOAD_FILE2_PROTOCOL_GUID \ + { \ + 0x4006c0c1, 0xfcb3, 0x403e, { 0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d } \ + } -#define EFI_LOADED_IMAGE_PROTOCOL_GUID \ - {0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}} +#define EFI_LOADED_IMAGE_PROTOCOL_GUID \ + { \ + 0x5B1B31A1, 0x9562, 0x11d2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \ + } -#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ - {0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a}} +#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ + { \ + 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \ + } -#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \ - {0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d}} +#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \ + { \ + 0xA19832B9, 0xAC25, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000 -#define EFI_IP4_PROTOCOL_GUID \ - {0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd}} +#define EFI_IP4_PROTOCOL_GUID \ + { \ + 0x41d94cd2, 0x35b6, 0x455a, { 0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \ + } #define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000 -#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \ - {0x0964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}} +#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \ + { \ + 0x0964e5b22, 0x6459, 0x11d2, { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } -#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \ - {0xbc62157e, 0x3e33, 0x4fec, {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf}} +#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \ + { \ + 0xbc62157e, 0x3e33, 0x4fec, { 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf } \ + } -#define EFI_DEVICE_PATH_PROTOCOL_GUID \ - {0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b}} +#define EFI_DEVICE_PATH_PROTOCOL_GUID \ + { \ + 0x9576e91, 0x6d3f, 0x11d2, { 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } -#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \ - {0x0964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}} +#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \ + { \ + 0x0964e5b22, 0x6459, 0x11d2, { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } typedef UInt64(EfiImageUnload)(EfiHandlePtr ImageHandle); @@ -327,17 +349,17 @@ typedef struct { typedef EFI_STATUS(EFIAPI* EFI_SIMPLE_NETWORK_TRANSMIT)(IN EFI_SIMPLE_NETWORK_PROTOCOL* This, IN UInt32 HeaderSize, IN UInt32 BufferSize, - IN Void* Buffer, - IN EfiMacAddress* SrcAddr OPTIONAL, + IN Void* Buffer, + IN EfiMacAddress* SrcAddr OPTIONAL, IN EfiMacAddress* DestAddr OPTIONAL, - IN UInt16* Protocol OPTIONAL); + IN UInt16* Protocol OPTIONAL); typedef EFI_STATUS(EFIAPI* EFI_SIMPLE_NETWORK_RECEIVE)(IN EFI_SIMPLE_NETWORK_PROTOCOL* This, - OUT UInt32* HeaderSize OPTIONAL, + OUT UInt32* HeaderSize OPTIONAL, IN OUT UInt32* BufferSize, OUT Void* Buffer, - OUT EfiMacAddress* SrcAddr OPTIONAL, + OUT EfiMacAddress* SrcAddr OPTIONAL, OUT EfiMacAddress* DestAddr OPTIONAL, - OUT UInt16* Protocol OPTIONAL); + OUT UInt16* Protocol OPTIONAL); typedef struct EFI_SIMPLE_NETWORK_PROTOCOL { UInt64 Revision; @@ -482,8 +504,10 @@ typedef struct EFI_GUID EFI_FINAL { * Protocol stuff... */ -#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \ - {0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}} +#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \ + { \ + 0x387477c1, 0x69c7, 0x11d2, { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } /** some helpers */ #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 @@ -581,7 +605,7 @@ typedef struct { } EfiInputKey; typedef EfiStatusType(EFI_API* EfiInputReadKey)(IN EfiSimpleTextInputProtocol* This, - OUT EfiInputKey* Key); + OUT EfiInputKey* Key); typedef EfiStatusType(EFI_API* EfiInputReset)(IN EfiSimpleTextInputProtocol* This, IN Boolean ExtendedChk); @@ -639,7 +663,7 @@ typedef struct EfiSystemTable { struct { EFI_GUID VendorGUID; VoidPtr VendorTable; - }* ConfigurationTable; + } * ConfigurationTable; } EfiSystemTable; #define kEfiOk 0 @@ -700,8 +724,10 @@ enum { #define EFI_EXTRA_DESCRIPTOR_SIZE 8 -#define EFI_MP_SERVICES_PROTOCOL_GUID \ - {0x3fdda605, 0xa76e, 0x4f46, {0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08}} +#define EFI_MP_SERVICES_PROTOCOL_GUID \ + { \ + 0x3fdda605, 0xa76e, 0x4f46, { 0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08 } \ + } #define PROCESSOR_AS_BSP_BIT 0x00000001 #define PROCESSOR_ENABLED_BIT 0x00000002 @@ -797,8 +823,10 @@ typedef struct EfiTime { UInt8 Pad2; } EfiTime; -#define EFI_FILE_INFO_GUID \ - {0x09576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}} +#define EFI_FILE_INFO_GUID \ + { \ + 0x09576e92, 0x6d3f, 0x11d2, { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } struct EfiFileInfo EFI_FINAL { /// @brief Structure size. @@ -866,8 +894,8 @@ typedef EfiStatusType EFI_API (*EfiMpServicesStartupThisAP)( IN Void* ProcedureArgument OPTIONAL, OUT Boolean* Finished OPTIONAL); typedef EfiStatusType EFI_API (*EfiMpServicesDisableThisAP)(IN struct _EfiMpServicesProtocol* Self, - IN UInt32 ProcessorNumber, - IN Boolean EnableAP, + IN UInt32 ProcessorNumber, + IN Boolean EnableAP, IN UInt32* HealthFlag OPTIONAL); typedef EfiStatusType EFI_API (*EfiMpServicesWhoAmI)(IN struct _EfiMpServicesProtocol* Self, diff --git a/src/kernel/HALKit/AMD64/HalDebugOutput.cpp b/src/kernel/HALKit/AMD64/HalDebugOutput.cpp index 37e8b10b..a93d458e 100644 --- a/src/kernel/HALKit/AMD64/HalDebugOutput.cpp +++ b/src/kernel/HALKit/AMD64/HalDebugOutput.cpp @@ -27,6 +27,7 @@ namespace Detail { bool hal_serial_init() { if (kState == kStateReady || kState == kStateTransmit) return true; +#ifdef __DEBUG__ HAL::rt_out8(PORT + 1, 0x00); // Disable all interrupts HAL::rt_out8(PORT + 3, 0x80); // Enable DLAB (set baud rate divisor) HAL::rt_out8(PORT + 0, 0x03); // Set divisor to 3 (lo byte) 38400 baud @@ -43,11 +44,12 @@ namespace Detail { return false; } - kState = kStateReady; - // If serial is not faulty set it in normal operation mode // (not-loopback with IRQs enabled and OUT#1 and OUT#2 bits enabled) HAL::rt_out8(PORT + 4, 0x0F); +#endif + + kState = kStateReady; return true; } @@ -88,7 +90,7 @@ EXTERN_C void ke_utf_io_write(IDevice<const Utf8Char*>* obj, const Utf8Char* byt tmp_str[0] = (bytes[index] > 127) ? '?' : bytes[index]; tmp_str[1] = 0; - cg_render_string(tmp_str, kY, kX, RGB(0xff, 0xff, 0xff)); + cg_render_string(tmp_str, kY, kX, RGB(0x00, 0x00, 0x00)); if (bytes[index] == '\r') { kY += kFontSizeY; @@ -144,7 +146,7 @@ EXTERN_C void ke_io_write(IDevice<const Char*>* obj, const Char* bytes) { tmp_str[0] = bytes[index]; tmp_str[1] = 0; - cg_render_string(tmp_str, kY, kX, RGB(0xff, 0xff, 0xff)); + cg_render_string(tmp_str, kY, kX, RGB(0x00, 0x00, 0x00)); if (bytes[index] == '\r') { kY += kFontSizeY; diff --git a/src/kernel/HALKit/AMD64/Paging.h b/src/kernel/HALKit/AMD64/Paging.h index 89d48e8a..1fbde52c 100644 --- a/src/kernel/HALKit/AMD64/Paging.h +++ b/src/kernel/HALKit/AMD64/Paging.h @@ -56,9 +56,7 @@ namespace Detail { kPageEnable = 31, }; - inline UInt8 control_register_cast(ControlRegisterBits reg) { - return static_cast<UInt8>(reg); - } + inline UInt8 control_register_cast(ControlRegisterBits reg) { return static_cast<UInt8>(reg); } } // namespace Detail auto mm_alloc_bitmap(Boolean wr, Boolean user, SizeT size, Bool is_page, SizeT pad = 0) -> VoidPtr; diff --git a/src/kernel/HALKit/ARM64/Paging.h b/src/kernel/HALKit/ARM64/Paging.h index 1984a9f2..bf062e3a 100644 --- a/src/kernel/HALKit/ARM64/Paging.h +++ b/src/kernel/HALKit/ARM64/Paging.h @@ -40,10 +40,14 @@ /// 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 Kernel::HAL { struct PACKED PTE_4KB final { @@ -81,9 +85,7 @@ namespace Detail { PageEnable = 31, }; - inline UInt8 control_register_cast(ControlRegisterBits reg) { - return static_cast<UInt8>(reg); - } + inline UInt8 control_register_cast(ControlRegisterBits reg) { return static_cast<UInt8>(reg); } } // namespace Detail struct PDE_4KB final { diff --git a/src/kernel/KernelKit/CoreProcessScheduler.h b/src/kernel/KernelKit/CoreProcessScheduler.h index f032c705..d3838aa3 100644 --- a/src/kernel/KernelKit/CoreProcessScheduler.h +++ b/src/kernel/KernelKit/CoreProcessScheduler.h @@ -59,11 +59,19 @@ struct ProcessHeapTree final { TreeKind Color{TreeKind::kBlackTreeKind}; - struct ProcessHeapTree<T>* Parent{nullptr}; - struct ProcessHeapTree<T>* Child{nullptr}; - - struct ProcessHeapTree<T>* Prev{nullptr}; - struct ProcessHeapTree<T>* Next{nullptr}; + struct ProcessHeapTree<T>* Parent { + nullptr + }; + struct ProcessHeapTree<T>* Child { + nullptr + }; + + struct ProcessHeapTree<T>* Prev { + nullptr + }; + struct ProcessHeapTree<T>* Next { + nullptr + }; }; template <typename T> @@ -78,13 +86,21 @@ struct ProcessFileTree final { TreeKind Color{TreeKind::kBlackTreeKind}; - struct ProcessFileTree<T>* Parent{nullptr}; + struct ProcessFileTree<T>* Parent { + nullptr + }; - struct ProcessFileTree<T>* Child{nullptr}; + struct ProcessFileTree<T>* Child { + nullptr + }; - struct ProcessFileTree<T>* Prev{nullptr}; + struct ProcessFileTree<T>* Prev { + nullptr + }; - struct ProcessFileTree<T>* Next{nullptr}; + struct ProcessFileTree<T>* Next { + nullptr + }; }; template <typename T> @@ -105,13 +121,21 @@ struct ProcessSpecialTree final { TreeKind Color{TreeKind::kBlackTreeKind}; - struct ProcessSpecialTree<T>* Parent{nullptr}; + struct ProcessSpecialTree<T>* Parent { + nullptr + }; - struct ProcessSpecialTree<T>* Child{nullptr}; + struct ProcessSpecialTree<T>* Child { + nullptr + }; - struct ProcessSpecialTree<T>* Prev{nullptr}; + struct ProcessSpecialTree<T>* Prev { + nullptr + }; - struct ProcessSpecialTree<T>* Next{nullptr}; + struct ProcessSpecialTree<T>* Next { + nullptr + }; }; /***********************************************************************************/ diff --git a/src/kernel/KernelKit/DriveMgr.h b/src/kernel/KernelKit/DriveMgr.h index f4ca294e..7179f930 100644 --- a/src/kernel/KernelKit/DriveMgr.h +++ b/src/kernel/KernelKit/DriveMgr.h @@ -72,7 +72,7 @@ struct DriveTrait final { Void (*fOutput)(DrivePacket& packet){nullptr}; Void (*fVerify)(DrivePacket& packet){nullptr}; Void (*fInit)(DrivePacket& packet){nullptr}; - const Char* (*fProtocol)(Void) {nullptr}; + const Char* (*fProtocol)(Void){nullptr}; }; namespace Probe { diff --git a/src/kernel/KernelKit/HardwareThreadScheduler.h b/src/kernel/KernelKit/HardwareThreadScheduler.h index 8e1caf39..de29eae4 100644 --- a/src/kernel/KernelKit/HardwareThreadScheduler.h +++ b/src/kernel/KernelKit/HardwareThreadScheduler.h @@ -63,10 +63,10 @@ class HardwareThread final { BOOL IsWakeup(); public: - HAL::StackFramePtr StackFrame(); + HAL::StackFramePtr StackFrame(); _Output const ThreadKind& Kind(); BOOL IsBusy(); - _Output const ThreadID& ID(); + _Output const ThreadID& ID(); private: HAL::StackFramePtr fStack{}; @@ -101,7 +101,7 @@ class HardwareThreadScheduler final : public ISchedulable { public: Ref<HardwareThread*> operator[](SizeT idx); bool operator!(); - operator bool(); + operator bool(); Bool IsUser() override { return Yes; } diff --git a/src/kernel/KernelKit/HeapMgr.h b/src/kernel/KernelKit/HeapMgr.h index e62a5911..9e02c13a 100644 --- a/src/kernel/KernelKit/HeapMgr.h +++ b/src/kernel/KernelKit/HeapMgr.h @@ -39,7 +39,7 @@ Boolean mm_protect_ptr(VoidPtr heap_ptr); /// @brief Makes a Kernel page. /// @param heap_ptr the page pointer. /// @return status code - Int32 mm_control_page(VoidPtr heap_ptr, const Bool); +Int32 mm_control_page(VoidPtr heap_ptr, const Bool); /// @brief Overwrites and set the flags of a heap header. /// @param heap_ptr the pointer to update. diff --git a/src/kernel/KernelKit/ILoader.h b/src/kernel/KernelKit/ILoader.h index 2dd8ccc0..005a6987 100644 --- a/src/kernel/KernelKit/ILoader.h +++ b/src/kernel/KernelKit/ILoader.h @@ -25,9 +25,9 @@ class ILoader { public: virtual _Output ErrorOr<VoidPtr> GetBlob() { return ErrorOr<VoidPtr>{}; } - virtual _Output const Char* AsString() { return "(null)"; } - virtual _Output const Char* MIME() { return "*/*"; } - virtual _Output const Char* Path() { return "(null)"; } + virtual _Output const Char* AsString() { return "(null)"; } + virtual _Output const Char* MIME() { return "*/*"; } + virtual _Output const Char* Path() { return "(null)"; } virtual _Output ErrorOr<VoidPtr> FindStart() { return ErrorOr<VoidPtr>{}; } virtual _Output ErrorOr<VoidPtr> FindSymbol(_Input const Char*, _Input Int32) { return ErrorOr<VoidPtr>{}; diff --git a/src/kernel/KernelKit/PCI/DMA.h b/src/kernel/KernelKit/PCI/DMA.h index ea708969..e1006d4a 100644 --- a/src/kernel/KernelKit/PCI/DMA.h +++ b/src/kernel/KernelKit/PCI/DMA.h @@ -46,7 +46,7 @@ class DMAWrapper final { T* Get(UIntPtr off = 0); public: - operator bool(); + operator bool(); bool operator!(); public: diff --git a/src/kernel/NeKit/Config.h b/src/kernel/NeKit/Config.h index effa0696..1d5083a7 100644 --- a/src/kernel/NeKit/Config.h +++ b/src/kernel/NeKit/Config.h @@ -16,7 +16,7 @@ #define NE_ICODEC \ final: \ - public \ + public \ ::Kernel::ICodec /// @brief The **NeKernel** namespace. @@ -112,12 +112,12 @@ inline Args&& move(Args&& arg) { template <class Type> concept IsSerializable = requires() { - { Type::kValue }; + {Type::kValue}; }; template <class Type> concept IsNotSerializable = requires() { - { !Type::kValue }; + {!Type::kValue}; }; /// @brief Encoding interface, used as a proxy to convert T to Char* diff --git a/src/kernel/NeKit/Macros.h b/src/kernel/NeKit/Macros.h index dabf593d..33f01234 100644 --- a/src/kernel/NeKit/Macros.h +++ b/src/kernel/NeKit/Macros.h @@ -15,7 +15,7 @@ #endif #ifndef kib_cast -#define kib_cast(X) (Kernel::UInt64)((X) * 1024) +#define kib_cast(X) (Kernel::UInt64)((X) *1024) #endif #ifndef MIB @@ -116,7 +116,7 @@ #define NE_UNUSED(X) ((Kernel::Void) X) #ifndef RGB -#define RGB(R, G, B) ((Kernel::UInt32) ((0xFF << 24) | ((R) << 16) | ((G) << 8) | (B))) +#define RGB(R, G, B) ((Kernel::UInt32)((0xFF << 24) | ((R) << 16) | ((G) << 8) | (B))) #endif // !RGB #ifdef __NE_AMD64__ diff --git a/src/kernel/NeKit/Utils.h b/src/kernel/NeKit/Utils.h index 618f968e..a42078de 100644 --- a/src/kernel/NeKit/Utils.h +++ b/src/kernel/NeKit/Utils.h @@ -54,9 +54,9 @@ inline constexpr SizeT oe_string_len(const CharType* str) { if (!str) return 0; #if __cplusplus == 202302L - if consteval { - return ARRAY_SIZE(str); - } else { + if + consteval { return ARRAY_SIZE(str); } + else { SizeT len{0}; while (str[len] != 0) ++len; return len; diff --git a/src/kernel/NeKit/Vettable.h b/src/kernel/NeKit/Vettable.h index 9792dde9..4c6bc6ab 100644 --- a/src/kernel/NeKit/Vettable.h +++ b/src/kernel/NeKit/Vettable.h @@ -15,10 +15,14 @@ namespace Kernel { template <class Type> -concept IsVettable = requires(Type) { (Type::kVettable); }; +concept IsVettable = requires(Type) { + (Type::kVettable); +}; template <class Type> -concept IsUnVettable = requires(Type) { (Type::kUnvettable); }; +concept IsUnVettable = requires(Type) { + (Type::kUnvettable); +}; } // namespace Kernel #endif // !__NE_KIT_VETTABLE_H__ diff --git a/src/libDDK/DriverKit/Device.h b/src/libDDK/DriverKit/Device.h index 468b259b..3e50535a 100644 --- a/src/libDDK/DriverKit/Device.h +++ b/src/libDDK/DriverKit/Device.h @@ -17,13 +17,13 @@ struct _DDK_DEVICE; #define DDK_SUB_TYPE_TCP (1) /* TCP/IP */ #define DDK_SUB_TYPE_UDP (2) /* Datagram */ -#define DDK_SUB_TYPE_BT (3) /* Bluetooth */ +#define DDK_SUB_TYPE_BT (3) /* Bluetooth */ /// @brief This enum takes care of the network stack. enum { - DDK_NET_DO_NOT_FLUSH, - DDK_NET_FLUSH_NOW, - DDK_NET_AUTO_FLUSH, + DDK_NET_DO_NOT_FLUSH, + DDK_NET_FLUSH_NOW, + DDK_NET_AUTO_FLUSH, }; /// @brief Kernel Device driver. diff --git a/src/libDDK/DriverKit/ObjectKit/Base.h b/src/libDDK/DriverKit/ObjectKit/Base.h index b700b402..b80d021a 100644 --- a/src/libDDK/DriverKit/ObjectKit/Base.h +++ b/src/libDDK/DriverKit/ObjectKit/Base.h @@ -9,7 +9,7 @@ #define DDK_DRIVER_IMPL \ final: \ - public \ + public \ ::Kernel::DDK::IDriverBase /// @author Amlal El Mahrouss @@ -40,7 +40,7 @@ class IDriverBase { /// @author @amlel-el-mahrouss template <typename Driver> concept IsValidDriver = requires(Driver drv) { - { drv.IsActive() && drv.Type() > kInvalidType }; + {drv.IsActive() && drv.Type() > kInvalidType}; }; } // namespace Kernel::DDK diff --git a/src/libSystem/SystemKit/Macros.h b/src/libSystem/SystemKit/Macros.h index 412b78e7..de16659a 100644 --- a/src/libSystem/SystemKit/Macros.h +++ b/src/libSystem/SystemKit/Macros.h @@ -90,7 +90,7 @@ typedef nullPtr NullPtr; #endif #ifndef kib_cast -#define kib_cast(X) (UInt64)((X) * 1024) +#define kib_cast(X) (UInt64)((X) *1024) #endif #ifndef MIB diff --git a/src/modules/CoreGfx/CoreGfx.h b/src/modules/CoreGfx/CoreGfx.h index 89e7c0a4..c7ce3d4c 100644 --- a/src/modules/CoreGfx/CoreGfx.h +++ b/src/modules/CoreGfx/CoreGfx.h @@ -11,7 +11,7 @@ #define cg_color(R, G, B) RGB(R, G, B) -#define cg_get_clear_clr() RGB(0, 0, 0) +#define cg_get_clear_clr() RGB(0xFF, 0xFF, 0xFF) #define cg_clear() kCGCursor = 0UL |
