diff options
| author | Amlal EL Mahrouss <amlal@softwarelabs.com> | 2024-06-14 23:50:01 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlal@softwarelabs.com> | 2024-06-14 23:50:01 +0200 |
| commit | 4ba42279946a3f819406f8aebf960201a74f8bd3 (patch) | |
| tree | bd331b149161d7c7a7366a86931f998a166d7175 | |
| parent | 9c02ac7a15d18da351baa81b25ebd8c967b4e5ee (diff) | |
MHR-21: work in progress arm64 support, made a structure to describe
opcodes.
Signed-off-by: Amlal EL Mahrouss <amlal@softwarelabs.com>
| -rw-r--r-- | Comm/AsmKit/CPU/amd64.hpp | 27 | ||||
| -rw-r--r-- | Comm/AsmKit/CPU/arm64.hpp | 27 | ||||
| -rw-r--r-- | Comm/AsmKit/CPU/ppc.hpp | 10 | ||||
| -rw-r--r-- | Comm/Public/SDK/CRT/__mpcc_defines.hxx | 24 | ||||
| -rw-r--r-- | Sources/64asm.cc | 2 | ||||
| -rw-r--r-- | Sources/i64asm.cc | 2 | ||||
| -rw-r--r-- | Sources/link.cc | 2 | ||||
| -rw-r--r-- | Sources/ppcasm.cc | 2 | ||||
| -rw-r--r-- | codetools.10x | 48 |
9 files changed, 112 insertions, 32 deletions
diff --git a/Comm/AsmKit/CPU/amd64.hpp b/Comm/AsmKit/CPU/amd64.hpp index 63ed1b3..17b515b 100644 --- a/Comm/AsmKit/CPU/amd64.hpp +++ b/Comm/AsmKit/CPU/amd64.hpp @@ -39,18 +39,19 @@ struct CpuOpcodeAMD64 inline std::vector<CpuOpcodeAMD64> kOpcodesAMD64 = { kAsmOpcodeDecl("int", 0xCD) - kAsmOpcodeDecl("into", 0xCE) - kAsmOpcodeDecl("intd", 0xF1) - kAsmOpcodeDecl("int3", 0xC3) - kAsmOpcodeDecl("iret", 0xCF) - kAsmOpcodeDecl("retf", 0xCB) - kAsmOpcodeDecl("retn", 0xC3) - kAsmOpcodeDecl("ret", 0xC3) - kAsmOpcodeDecl("sti", 0xfb) - kAsmOpcodeDecl("cli", 0xfa) - kAsmOpcodeDecl("hlt", 0xf4) - kAsmOpcodeDecl("nop", 0x90) - kAsmOpcodeDecl("mov", 0x48) - kAsmOpcodeDecl("call", 0xFF)}; + kAsmOpcodeDecl("into", 0xCE) + kAsmOpcodeDecl("intd", 0xF1) + kAsmOpcodeDecl("int3", 0xC3) + kAsmOpcodeDecl("iret", 0xCF) + kAsmOpcodeDecl("retf", 0xCB) + kAsmOpcodeDecl("retn", 0xC3) + kAsmOpcodeDecl("ret", 0xC3) + kAsmOpcodeDecl("sti", 0xfb) + kAsmOpcodeDecl("cli", 0xfa) + kAsmOpcodeDecl("hlt", 0xf4) + kAsmOpcodeDecl("nop", 0x90) + kAsmOpcodeDecl("mov", 0x48) + kAsmOpcodeDecl("call", 0xFF) +}; #define kAsmRegisterLimit 15 diff --git a/Comm/AsmKit/CPU/arm64.hpp b/Comm/AsmKit/CPU/arm64.hpp new file mode 100644 index 0000000..a6b558a --- /dev/null +++ b/Comm/AsmKit/CPU/arm64.hpp @@ -0,0 +1,27 @@ +/* ------------------------------------------- + +Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +#include <Comm/Defines.hpp> + +/// @brief ARM64 encoding support. +/// @file CPU/arm64.hpp + +struct CpuOpcodeArm64; + +/// @brief ARM64 opcode header. +struct CpuOpcodeArm64 final +{ + uint8_t fOpcode; // opcode + uint8_t fRegisterLeft; // left register index + uint8_t fRegisterRight; // right register index + bool fRegisterLeftHooked; + bool fRegisterRightHooked; + uint32_t fImmediateValue; // immediate 32-bit value + bool fImmediateValueHooked; +}; + diff --git a/Comm/AsmKit/CPU/ppc.hpp b/Comm/AsmKit/CPU/ppc.hpp index c4265da..4afbf5a 100644 --- a/Comm/AsmKit/CPU/ppc.hpp +++ b/Comm/AsmKit/CPU/ppc.hpp @@ -1,3 +1,13 @@ +/* ------------------------------------------- + + Some modifications are copyrighted under: + Zeta Electronics Corporation + + Original author: + Apple Inc + +------------------------------------------- */ + #pragma once #include <cstdint> diff --git a/Comm/Public/SDK/CRT/__mpcc_defines.hxx b/Comm/Public/SDK/CRT/__mpcc_defines.hxx index c05ee73..a526fd3 100644 --- a/Comm/Public/SDK/CRT/__mpcc_defines.hxx +++ b/Comm/Public/SDK/CRT/__mpcc_defines.hxx @@ -30,8 +30,9 @@ typedef char* caddr_t; #ifdef __GNUC__ #include <CRT/__mpcc_alloca.hxx> #define __mpcc_alloca(sz) __mpcc_alloca_gcc(sz) +#define __packed__ __attribute__((packed)) #elif defined(__MPCC__) - +#define __packed__ __mpcc_packed__ #define __alloca(sz) __mpcc_alloca(sz) #endif @@ -41,24 +42,17 @@ typedef char* caddr_t; #define __init_decl() \ extern "C" \ { + + #define __fini_decl() \ - } \ - ; + }; \ + + #else #define __init_decl() #define __fini_decl() #endif -#if __has_builtin(__builtin_alloca) -#define alloca(sz) __builtin_alloca(sz) -#ifdef __alloca -#undef __alloca -#endif -#define __alloca alloca -#else -#warning alloca not detected (MPCC) -#endif - typedef long long off_t; typedef unsigned long long uoff_t; @@ -71,7 +65,7 @@ typedef union float_cast { }; float f; -} __attribute__((packed)) float_cast_t; +} __packed__ float_cast_t; typedef union double_cast { struct @@ -82,7 +76,7 @@ typedef union double_cast { }; double f; -} __attribute__((packed)) double_cast_t; +} __packed__ double_cast_t; #endif // ifndef __GNUC__ diff --git a/Sources/64asm.cc b/Sources/64asm.cc index 859bfd4..9f56570 100644 --- a/Sources/64asm.cc +++ b/Sources/64asm.cc @@ -9,7 +9,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// // @file 64asm.cxx -// @author Zeta Electronics Corporation +// @author Amlal EL Mahrouss // @brief 64x0 Assembler. // REMINDER: when dealing with an undefined symbol use (string diff --git a/Sources/i64asm.cc b/Sources/i64asm.cc index b805c95..b10be54 100644 --- a/Sources/i64asm.cc +++ b/Sources/i64asm.cc @@ -7,7 +7,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// /// @file i64asm.cxx -/// @author Zeta Electronics Corporation +/// @author Amlal EL Mahrouss /// @brief AMD64 Assembler. /// REMINDER: when dealing with an undefined symbol use (string diff --git a/Sources/link.cc b/Sources/link.cc index 08e9dd0..296ada5 100644 --- a/Sources/link.cc +++ b/Sources/link.cc @@ -5,7 +5,7 @@ ------------------------------------------- */ /// @file link.cc -/// @author Zeta Electronics Corporation (amlel) +/// @author Amlal EL Mahrouss (amlel) /// @brief Zeta Electronics Corporation Linker. /// Last Rev: Sat Feb 24 CET 2024 diff --git a/Sources/ppcasm.cc b/Sources/ppcasm.cc index 53c99c1..7f51c72 100644 --- a/Sources/ppcasm.cc +++ b/Sources/ppcasm.cc @@ -7,7 +7,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// /// @file ppcasm.cxx -/// @author Zeta Electronics Corporation +/// @author Amlal EL Mahrouss /// @brief POWER Assembler. /// REMINDER: when dealing with an undefined symbol use (string diff --git a/codetools.10x b/codetools.10x new file mode 100644 index 0000000..2961860 --- /dev/null +++ b/codetools.10x @@ -0,0 +1,48 @@ +<?xml version="1.0"?> +<N10X> + <Workspace> + <IncludeFilter>*.c,*.cc,*.cpp,*.c++,*.cp,*.cxx,*.h,*.hh,*.hpp,*.h++,*.hp,*.hxx,*.inl,*.cs,*.rs,*.java,*.jav,*.js,*.jsc,*.jsx,*.json,*.cls,*.py,*.rpy,*.php,*.php3,*.phl,*.phtml,*.rhtml,*.tpl,*.phps,*.lua,*.html,*.html5,*.htm,*.xml,*.xaml,*.css,*.ssi,*.haml,*.yaml,*.bat,*.wbf,*.wbt,*.txt,*.cmake,*.make,*.makefile,*.mak,*.mk,*.sh,*.bash,*.csv,*.asp,*.pl,*.mac,*.ws,*.vbs,*.perl,*.src,*.rss,*.inc,*.f,*.go,*.prl,*.plx,*.rb,*.lsp,*.lpx,*.ps1,*.command,*.cbl,*.cob,*.qs,*.wxs,*.ph,*.msc,*.glsl,*.hlsl,*.fx,*.vert,*.tesc,*.tese,*.geom,*.frag,*.comp,*.pssl,*.scons,*.cu,*.jai,</IncludeFilter> + <ExcludeFilter></ExcludeFilter> + <SyncFiles>true</SyncFiles> + <Recursive>true</Recursive> + <ShowEmptyFolders>true</ShowEmptyFolders> + <IncludeFilesWithoutExt>false</IncludeFilesWithoutExt> + <IsVirtual>false</IsVirtual> + <IsFolder>false</IsFolder> + <BuildCommand></BuildCommand> + <RebuildCommand></RebuildCommand> + <BuildFileCommand></BuildFileCommand> + <CleanCommand></CleanCommand> + <BuildWorkingDirectory></BuildWorkingDirectory> + <CancelBuild></CancelBuild> + <RunCommand></RunCommand> + <RunCommandWorkingDirectory></RunCommandWorkingDirectory> + <DebugCommand></DebugCommand> + <DebugArguments></DebugArguments> + <ExePathCommand></ExePathCommand> + <DebugSln></DebugSln> + <UseVisualStudioEnvBat>false</UseVisualStudioEnvBat> + <Configurations> + <Configuration>Debug</Configuration> + <Configuration>Release</Configuration> + </Configurations> + <Platforms> + <Platform>x64</Platform> + <Platform>Win32</Platform> + </Platforms> + <AdditionalIncludePaths> + <AdditionalIncludePath>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\include</AdditionalIncludePath> + <AdditionalIncludePath>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\include</AdditionalIncludePath> + <AdditionalIncludePath>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include</AdditionalIncludePath> + <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt</AdditionalIncludePath> + <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um</AdditionalIncludePath> + <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared</AdditionalIncludePath> + <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt</AdditionalIncludePath> + <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt</AdditionalIncludePath> + <AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um</AdditionalIncludePath> + </AdditionalIncludePaths> + <Defines></Defines> + <ConfigProperties></ConfigProperties> + <Children></Children> + </Workspace> +</N10X> |
