diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-18 06:42:53 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-18 06:42:53 +0100 |
| commit | a3887b0695ffc83d2541d2ad8124e0d02f45ceae (patch) | |
| tree | 8ecc0e38c845a85d3d9fb77a3aa81369f7837734 | |
| parent | 233d0343265ccda26ad06bfe52acdb1d12489bf4 (diff) | |
fix: meta: codebase improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | dev/CompilerKit/Ref.h | 4 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Backend/Assembler32x0.cc | 2 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Backend/Assembler64x0.cc | 2 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Backend/AssemblerAMD64.cc | 2 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Backend/AssemblerARM64.cc | 2 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Backend/AssemblerPowerPC.cc | 2 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Frontend/CCompiler64x0.cc | 4 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Frontend/CCompilerARM64.cc | 4 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Frontend/CCompilerPower64.cc | 4 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Frontend/CPlusPlusCompilerAMD64.cc | 14 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Linker/DynamicLinker64PEF.cc | 2 | ||||
| -rw-r--r-- | dev/CompilerKit/src/Macro/CPlusPlusPreprocessor.cc | 2 | ||||
| -rw-r--r-- | dev/DebuggerKit/CommonCLI.inl | 6 | ||||
| -rw-r--r-- | dev/DebuggerKit/NeKernelContract.h | 6 | ||||
| -rw-r--r-- | dev/DebuggerKit/POSIXMachContract.h | 11 |
16 files changed, 33 insertions, 36 deletions
@@ -25,7 +25,7 @@ tools/pef-aarch64-cdrv Examples/ -# NeKernel/MP-UX executable +# NeKernel executable *.exec *.bin diff --git a/dev/CompilerKit/Ref.h b/dev/CompilerKit/Ref.h index 5869644..01b7d96 100644 --- a/dev/CompilerKit/Ref.h +++ b/dev/CompilerKit/Ref.h @@ -13,7 +13,7 @@ #include <CompilerKit/Defines.h> namespace CompilerKit { -/// @author El Mahrouss Amlal +/// @author Amlal El Mahrouss /// @brief Reference holder class, refers to a pointer of data in static memory. template <typename T> class Ref final { @@ -54,7 +54,7 @@ class Ref final { Bool m_Strong{false}; }; -// @author El Mahrouss Amlal +// @author Amlal El Mahrouss // @brief Non null Reference holder class, refers to a pointer of data in static memory. template <typename T> class NonNullRef final { diff --git a/dev/CompilerKit/src/Backend/Assembler32x0.cc b/dev/CompilerKit/src/Backend/Assembler32x0.cc index e85a510..0f94920 100644 --- a/dev/CompilerKit/src/Backend/Assembler32x0.cc +++ b/dev/CompilerKit/src/Backend/Assembler32x0.cc @@ -9,7 +9,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// // @file 32asm.cc -// @author El Mahrouss Amlal +// @author Amlal El Mahrouss // @brief 32x0 Assembler. // REMINDER: when dealing with an undefined symbol use (string diff --git a/dev/CompilerKit/src/Backend/Assembler64x0.cc b/dev/CompilerKit/src/Backend/Assembler64x0.cc index d0cf327..23eeeb7 100644 --- a/dev/CompilerKit/src/Backend/Assembler64x0.cc +++ b/dev/CompilerKit/src/Backend/Assembler64x0.cc @@ -9,7 +9,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// // @file Assembler64x0.cc -// @author El Mahrouss Amlal +// @author Amlal El Mahrouss // @brief 64x000 Assembler. // REMINDER: when dealing with an undefined symbol use (string diff --git a/dev/CompilerKit/src/Backend/AssemblerAMD64.cc b/dev/CompilerKit/src/Backend/AssemblerAMD64.cc index c684a07..48e1e9c 100644 --- a/dev/CompilerKit/src/Backend/AssemblerAMD64.cc +++ b/dev/CompilerKit/src/Backend/AssemblerAMD64.cc @@ -7,7 +7,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// /// @file AssemblerAMD64.cc -/// @author El Mahrouss Amlal +/// @author Amlal El Mahrouss /// @brief AMD64 Assembler. /// REMINDER: when dealing with an undefined symbol use (string /// size):LinkerFindSymbol:(string) so that ld will look for it. diff --git a/dev/CompilerKit/src/Backend/AssemblerARM64.cc b/dev/CompilerKit/src/Backend/AssemblerARM64.cc index 0cb7540..d7fb1d3 100644 --- a/dev/CompilerKit/src/Backend/AssemblerARM64.cc +++ b/dev/CompilerKit/src/Backend/AssemblerARM64.cc @@ -7,7 +7,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// /// @file AssemblerARM64.cc -/// @author El Mahrouss Amlal +/// @author Amlal El Mahrouss /// @brief 'ACORN' Assembler. /// REMINDER: when dealing with an undefined symbol use (string diff --git a/dev/CompilerKit/src/Backend/AssemblerPowerPC.cc b/dev/CompilerKit/src/Backend/AssemblerPowerPC.cc index 084e1fe..3ec3357 100644 --- a/dev/CompilerKit/src/Backend/AssemblerPowerPC.cc +++ b/dev/CompilerKit/src/Backend/AssemblerPowerPC.cc @@ -7,7 +7,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// /// @file AssemblerPower.cc -/// @author El Mahrouss Amlal +/// @author Amlal El Mahrouss /// @brief POWER Assembler. /// REMINDER: when dealing with an undefined symbol use (string diff --git a/dev/CompilerKit/src/Frontend/CCompiler64x0.cc b/dev/CompilerKit/src/Frontend/CCompiler64x0.cc index ec72570..804e1a1 100644 --- a/dev/CompilerKit/src/Frontend/CCompiler64x0.cc +++ b/dev/CompilerKit/src/Frontend/CCompiler64x0.cc @@ -27,7 +27,7 @@ /* This is part of the CompilerKit. */ /* (c) Amlal El Mahrouss */ -/// @author El Mahrouss Amlal (amlel) +/// @author Amlal El Mahrouss (amlal@nekernel.org) /// @file 64x0-cc.cc /// @brief 64x0 C Compiler. @@ -59,7 +59,7 @@ struct CompilerRegisterMap final { }; // \brief Map for C structs -// \author amlel +// \author amlal@nekernel.org struct CompilerStructMap final { // 'my_foo' std::string fName; diff --git a/dev/CompilerKit/src/Frontend/CCompilerARM64.cc b/dev/CompilerKit/src/Frontend/CCompilerARM64.cc index 9d1fd87..c9fee19 100644 --- a/dev/CompilerKit/src/Frontend/CCompilerARM64.cc +++ b/dev/CompilerKit/src/Frontend/CCompilerARM64.cc @@ -28,7 +28,7 @@ /* This is part of the CompilerKit. */ /* (c) Amlal El Mahrouss */ -/// @author El Mahrouss Amlal (amlel) +/// @author Amlal El Mahrouss (amlal@nekernel.org) /// @file ARM64-cc.cc /// @brief ARM64 C Compiler. @@ -60,7 +60,7 @@ struct CompilerRegisterMap final { }; // \brief Map for C structs -// \author amlel +// \author amlal@nekernel.org struct CompilerStructMap final { // 'my_foo' std::string fName; diff --git a/dev/CompilerKit/src/Frontend/CCompilerPower64.cc b/dev/CompilerKit/src/Frontend/CCompilerPower64.cc index 6cdfc09..80d88dc 100644 --- a/dev/CompilerKit/src/Frontend/CCompilerPower64.cc +++ b/dev/CompilerKit/src/Frontend/CCompilerPower64.cc @@ -22,7 +22,7 @@ #define kExitOK 0 -/// @author El Mahrouss Amlal (amlal@nekernel.org) +/// @author Amlal El Mahrouss (amlal@nekernel.org) /// @file cc.cc /// @brief POWER64 C Compiler. @@ -50,7 +50,7 @@ struct CompilerRegisterMap final { }; // \brief Map for C structs -// \author amlel +// \author amlal@nekernel.org struct CompilerStructMap final { /// 'struct::my_foo' std::string fName; diff --git a/dev/CompilerKit/src/Frontend/CPlusPlusCompilerAMD64.cc b/dev/CompilerKit/src/Frontend/CPlusPlusCompilerAMD64.cc index bf6ece0..7c761f4 100644 --- a/dev/CompilerKit/src/Frontend/CPlusPlusCompilerAMD64.cc +++ b/dev/CompilerKit/src/Frontend/CPlusPlusCompilerAMD64.cc @@ -43,7 +43,7 @@ /* This is part of the CompilerKit. */ /* (c) Amlal El Mahrouss 2024-2025 */ -/// @author El Mahrouss Amlal (amlal@nekernel.org) +/// @author Amlal El Mahrouss (amlal@nekernel.org) /// @file CPlusPlusCompilerAMD64.cxx /// @brief Optimized C++ Compiler Driver. @@ -71,14 +71,14 @@ std::filesystem::path necti_expand_home(const std::filesystem::path& input) { } struct CompilerRegisterMap final { - CompilerKit::STLString fName; - CompilerKit::STLString fReg; + CompilerKit::STLString fName{}; + CompilerKit::STLString fReg{}; }; /// \brief Offset based struct/class struct CompilerStructMap final { - CompilerKit::STLString fName; - CompilerKit::STLString fReg; + CompilerKit::STLString fName{}; + CompilerKit::STLString fReg{}; std::vector<std::pair<UInt32, CompilerKit::STLString>> fOffsets; }; @@ -86,8 +86,8 @@ struct CompilerStructMap final { struct CompilerState final { std::vector<CompilerRegisterMap> fStackMapVector; std::vector<CompilerStructMap> fStructMapVector; - CompilerKit::STLString fLastFile; - CompilerKit::STLString fLastError; + CompilerKit::STLString fLastFile{}; + CompilerKit::STLString fLastError{}; }; /// @brief prints an error into stdout. diff --git a/dev/CompilerKit/src/Linker/DynamicLinker64PEF.cc b/dev/CompilerKit/src/Linker/DynamicLinker64PEF.cc index 93f7919..23bad66 100644 --- a/dev/CompilerKit/src/Linker/DynamicLinker64PEF.cc +++ b/dev/CompilerKit/src/Linker/DynamicLinker64PEF.cc @@ -7,7 +7,7 @@ ------------------------------------------- */ -/// @author El Mahrouss Amlal (amlal@nekernel.org) +/// @author Amlal El Mahrouss (amlal@nekernel.org) /// @brief NeKernel.org 64-bit PEF Linker. /// Last Rev: Sat Apr 19 CET 2025 /// @note Do not look up for anything with .code64/.data64/.zero64! diff --git a/dev/CompilerKit/src/Macro/CPlusPlusPreprocessor.cc b/dev/CompilerKit/src/Macro/CPlusPlusPreprocessor.cc index fa5b043..8163c40 100644 --- a/dev/CompilerKit/src/Macro/CPlusPlusPreprocessor.cc +++ b/dev/CompilerKit/src/Macro/CPlusPlusPreprocessor.cc @@ -20,7 +20,7 @@ #define kMacroPrefix '#' -/// @author El Mahrouss Amlal (amlel) +/// @author Amlal El Mahrouss (amlal@nekernel.org) /// @file CPlusPlusPreprocessor.cc /// @brief Preprocessor. diff --git a/dev/DebuggerKit/CommonCLI.inl b/dev/DebuggerKit/CommonCLI.inl index eb56257..a4f13ca 100644 --- a/dev/DebuggerKit/CommonCLI.inl +++ b/dev/DebuggerKit/CommonCLI.inl @@ -5,10 +5,6 @@ Purpose: Common Debugger symbols. */ -#include <cstdint> -#include <iostream> -#include <string> - #define kBlank "\e[0;30m" #define kRed "\e[0;31m" #define kWhite "\e[0;97m" @@ -25,4 +21,4 @@ static DebuggerKit::POSIX::POSIXMachContract kDebugger; static DebuggerKit::ProcessID kPID = 0L; static DebuggerKit::CAddress kActiveAddress = nullptr; -static std::string kPath = ""; +static CompilerKit::STLString kPath = ""; diff --git a/dev/DebuggerKit/NeKernelContract.h b/dev/DebuggerKit/NeKernelContract.h index f0da828..3a1fbad 100644 --- a/dev/DebuggerKit/NeKernelContract.h +++ b/dev/DebuggerKit/NeKernelContract.h @@ -27,7 +27,7 @@ namespace Detail { typedef int64_t dk_socket_type; } // namespace Detail -class NeKernelContract DK_DEBUGGER_CONTRACT { +class NeKernelContract final DK_DEBUGGER_CONTRACT { public: NeKernelContract(); virtual ~NeKernelContract() override; @@ -37,8 +37,8 @@ class NeKernelContract DK_DEBUGGER_CONTRACT { NeKernelContract(const NeKernelContract&) = default; public: - bool Attach(std::string path, std::string arg_v, ProcessID& pid) noexcept override; - bool BreakAt(std::string symbol) noexcept override; + bool Attach(CompilerKit::STLString path, CompilerKit::STLString arg_v, ProcessID& pid) noexcept override; + bool BreakAt(CompilerKit::STLString symbol) noexcept override; bool Break() noexcept override; bool Continue() noexcept override; bool Detach() noexcept override; diff --git a/dev/DebuggerKit/POSIXMachContract.h b/dev/DebuggerKit/POSIXMachContract.h index 1864aff..2df6ef1 100644 --- a/dev/DebuggerKit/POSIXMachContract.h +++ b/dev/DebuggerKit/POSIXMachContract.h @@ -44,7 +44,7 @@ CK_IMPORT_C kern_return_t mach_vm_protect(vm_map_t target_task, mach_vm_address_ namespace DebuggerKit::POSIX { /// \brief POSIXMachContract engine interface class in C++ /// \author Amlal El Mahrouss -class POSIXMachContract : public DebuggerContract { +class POSIXMachContract final DK_DEBUGGER_CONTRACT { public: explicit POSIXMachContract() = default; ~POSIXMachContract() override = default; @@ -54,7 +54,7 @@ class POSIXMachContract : public DebuggerContract { POSIXMachContract(const POSIXMachContract&) = default; public: - Bool Attach(std::string path, std::string argv, ProcessID& pid) noexcept override { + Bool Attach(CompilerKit::STLString path, CompilerKit::STLString argv, ProcessID& pid) noexcept override { pid = fork(); if (pid == 0) { @@ -82,7 +82,7 @@ class POSIXMachContract : public DebuggerContract { return true; } - void SetPath(std::string path) noexcept { + void SetPath(CompilerKit::STLString path) noexcept { if (path.empty()) { return; } @@ -90,7 +90,7 @@ class POSIXMachContract : public DebuggerContract { m_path = path; } - Bool BreakAt(std::string symbol) noexcept override { + Bool BreakAt(CompilerKit::STLString symbol) noexcept override { if (!m_path.empty() && std::filesystem::exists(m_path) && std::filesystem::is_regular_file(m_path)) { auto handle = dlopen(m_path.c_str(), RTLD_LAZY); @@ -112,6 +112,7 @@ class POSIXMachContract : public DebuggerContract { mach_vm_protect(task, (mach_vm_address_t) addr, sizeof(uint32_t), false, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE); + mach_vm_write(task, (mach_vm_address_t) addr, (vm_offset_t) &brk_inst, sizeof(addr)); return true; @@ -151,7 +152,7 @@ class POSIXMachContract : public DebuggerContract { private: ProcessID m_pid{0}; - std::string m_path; + CompilerKit::STLString m_path; }; } // namespace DebuggerKit::POSIX |
