diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:09:20 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:09:20 +0200 |
| commit | 8ca205395dc7d76fecd2baf8d6b59d7df01825fd (patch) | |
| tree | 9151d7620c88760e3cdb2d4df9799ccc99922647 | |
| parent | 150b0404a4c074bb90692c037f6efb93caa93325 (diff) | |
MHR-24: Add run_format.sh
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | .clang-format | 15 | ||||
| -rw-r--r-- | Examples/ExampleCDialect.c | 21 | ||||
| -rw-r--r-- | Headers/AsmKit/AsmKit.hpp | 327 | ||||
| -rw-r--r-- | Headers/AsmKit/CPU/32x0.hpp | 65 | ||||
| -rw-r--r-- | Headers/AsmKit/CPU/64x0.hpp | 91 | ||||
| -rw-r--r-- | Headers/AsmKit/CPU/amd64.hpp | 42 | ||||
| -rw-r--r-- | Headers/AsmKit/CPU/ppc.hpp | 3751 | ||||
| -rw-r--r-- | Headers/CompilerKit.hpp | 28 | ||||
| -rw-r--r-- | Headers/Defines.hpp | 111 | ||||
| -rw-r--r-- | Headers/ParserKit.hpp | 234 | ||||
| -rw-r--r-- | Headers/StdKit/AE.hpp | 159 | ||||
| -rw-r--r-- | Headers/StdKit/ELF.hpp | 514 | ||||
| -rw-r--r-- | Headers/StdKit/ErrorID.hpp | 14 | ||||
| -rw-r--r-- | Headers/StdKit/ErrorOr.hpp | 78 | ||||
| -rw-r--r-- | Headers/StdKit/PEF.hpp | 187 | ||||
| -rw-r--r-- | Headers/StdKit/Ref.hpp | 133 | ||||
| -rw-r--r-- | Headers/StdKit/String.hpp | 99 | ||||
| -rw-r--r-- | Headers/StdKit/XCOFF.hxx | 38 | ||||
| -rw-r--r-- | Headers/UUID.hpp | 1612 | ||||
| -rw-r--r-- | SDK/__mpcc_defines.hxx | 56 | ||||
| -rw-r--r-- | Sources/Detail/asmutils.h | 170 | ||||
| -rwxr-xr-x | run_format.sh | 16 |
22 files changed, 4044 insertions, 3717 deletions
diff --git a/.clang-format b/.clang-format index c3c4f3e..fb3cacb 100644 --- a/.clang-format +++ b/.clang-format @@ -1,3 +1,16 @@ --- +BasedOnStyle: Microsoft +AccessModifierOffset: '-4' +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: 'true' +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +BinPackParameters: 'false' +ColumnLimit: '0' Language: Cpp -BasedOnStyle: Google +NamespaceIndentation: All +PointerAlignment: Left +ReflowComments: 'true' +SortIncludes: 'false' +UseTab: Always +... diff --git a/Examples/ExampleCDialect.c b/Examples/ExampleCDialect.c index 8c65bf0..e6d92fb 100644 --- a/Examples/ExampleCDialect.c +++ b/Examples/ExampleCDialect.c @@ -1,17 +1,20 @@ -struct { +struct +{ int a; int b; int c; }; -int __ImageStart(int argc, char const* argv[]) { - int* foo = 0x1000; +int __ImageStart(int argc, char const* argv[]) +{ + int* foo = 0x1000; - if (foo == 57) { - foo = 0x2000; - *foo = 5; - return foo; - } + if (foo == 57) + { + foo = 0x2000; + *foo = 5; + return foo; + } - return 57; + return 57; } diff --git a/Headers/AsmKit/AsmKit.hpp b/Headers/AsmKit/AsmKit.hpp index 7fbe842..2ea4796 100644 --- a/Headers/AsmKit/AsmKit.hpp +++ b/Headers/AsmKit/AsmKit.hpp @@ -10,175 +10,208 @@ #include <Headers/Defines.hpp> #include <Headers/StdKit/String.hpp> -namespace CompilerKit { -// -// @brief Frontend to Assembly mountpoint. -// -class AssemblyInterface { - public: - explicit AssemblyInterface() = default; - virtual ~AssemblyInterface() = default; - - MPCC_COPY_DEFAULT(AssemblyInterface); - - //@ brief compile to object file. - // Example C++ -> MASM -> AE object. - virtual Int32 CompileToFormat(std::string& src, Int32 arch) = 0; -}; - -/// @brief Simple assembly factory -class AssemblyFactory final { - public: - explicit AssemblyFactory() = default; - ~AssemblyFactory() = default; - - MPCC_COPY_DEFAULT(AssemblyFactory); - - public: - enum { - kArchAMD64, - kArch32x0, - kArch64x0, - kArchRISCV, - kArchPowerPC, - kArchUnknown, - }; - - Int32 Compile(std::string& sourceFile, const Int32& arch) noexcept; - - void Mount(AssemblyInterface* mountPtr) noexcept; - AssemblyInterface* Unmount() noexcept; - - private: - AssemblyInterface* fMounted{nullptr}; -}; - -union NumberCastBase { - NumberCastBase() = default; - ~NumberCastBase() = default; -}; - -union NumberCast64 final { - NumberCast64() = default; - explicit NumberCast64(UInt64 raw) : raw(raw) {} - ~NumberCast64() { raw = 0; } - - CharType number[8]; - UInt64 raw; -}; - -union NumberCast32 final { - NumberCast32() = default; - explicit NumberCast32(UInt32 raw) : raw(raw) {} - ~NumberCast32() { raw = 0; } - - CharType number[4]; - UInt32 raw; -}; - -union NumberCast16 final { - NumberCast16() = default; - explicit NumberCast16(UInt16 raw) : raw(raw) {} - ~NumberCast16() { raw = 0; } - - CharType number[2]; - UInt16 raw; -}; - -union NumberCast8 final { - NumberCast8() = default; - explicit NumberCast8(UInt8 raw) : raw(raw) {} - ~NumberCast8() { raw = 0; } - - CharType number; - UInt8 raw; -}; - -class EncoderInterface { - public: - explicit EncoderInterface() = default; - virtual ~EncoderInterface() = default; - - MPCC_COPY_DEFAULT(EncoderInterface); - - virtual std::string CheckLine(std::string& line, const std::string& file) = 0; - virtual bool WriteLine(std::string& line, const std::string& file) = 0; - virtual bool WriteNumber(const std::size_t& pos, std::string& from_what) = 0; -}; +namespace CompilerKit +{ + // + // @brief Frontend to Assembly mountpoint. + // + class AssemblyInterface + { + public: + explicit AssemblyInterface() = default; + virtual ~AssemblyInterface() = default; + + MPCC_COPY_DEFAULT(AssemblyInterface); + + //@ brief compile to object file. + // Example C++ -> MASM -> AE object. + virtual Int32 CompileToFormat(std::string& src, Int32 arch) = 0; + }; + + /// @brief Simple assembly factory + class AssemblyFactory final + { + public: + explicit AssemblyFactory() = default; + ~AssemblyFactory() = default; + + MPCC_COPY_DEFAULT(AssemblyFactory); + + public: + enum + { + kArchAMD64, + kArch32x0, + kArch64x0, + kArchRISCV, + kArchPowerPC, + kArchUnknown, + }; + + Int32 Compile(std::string& sourceFile, const Int32& arch) noexcept; + + void Mount(AssemblyInterface* mountPtr) noexcept; + AssemblyInterface* Unmount() noexcept; + + private: + AssemblyInterface* fMounted{nullptr}; + }; + + union NumberCastBase { + NumberCastBase() = default; + ~NumberCastBase() = default; + }; + + union NumberCast64 final { + NumberCast64() = default; + explicit NumberCast64(UInt64 raw) + : raw(raw) + { + } + ~NumberCast64() + { + raw = 0; + } + + CharType number[8]; + UInt64 raw; + }; + + union NumberCast32 final { + NumberCast32() = default; + explicit NumberCast32(UInt32 raw) + : raw(raw) + { + } + ~NumberCast32() + { + raw = 0; + } + + CharType number[4]; + UInt32 raw; + }; + + union NumberCast16 final { + NumberCast16() = default; + explicit NumberCast16(UInt16 raw) + : raw(raw) + { + } + ~NumberCast16() + { + raw = 0; + } + + CharType number[2]; + UInt16 raw; + }; + + union NumberCast8 final { + NumberCast8() = default; + explicit NumberCast8(UInt8 raw) + : raw(raw) + { + } + ~NumberCast8() + { + raw = 0; + } + + CharType number; + UInt8 raw; + }; + + class EncoderInterface + { + public: + explicit EncoderInterface() = default; + virtual ~EncoderInterface() = default; + + MPCC_COPY_DEFAULT(EncoderInterface); + + virtual std::string CheckLine(std::string& line, const std::string& file) = 0; + virtual bool WriteLine(std::string& line, const std::string& file) = 0; + virtual bool WriteNumber(const std::size_t& pos, std::string& from_what) = 0; + }; #ifdef __ASM_NEED_AMD64__ -class EncoderAMD64 final : public EncoderInterface { - public: - explicit EncoderAMD64() = default; - ~EncoderAMD64() override = default; + class EncoderAMD64 final : public EncoderInterface + { + public: + explicit EncoderAMD64() = default; + ~EncoderAMD64() override = default; - MPCC_COPY_DEFAULT(EncoderAMD64); + MPCC_COPY_DEFAULT(EncoderAMD64); - virtual std::string CheckLine(std::string& line, - const std::string& file) override; - virtual bool WriteLine(std::string& line, const std::string& file) override; - virtual bool WriteNumber(const std::size_t& pos, - std::string& from_what) override; + virtual std::string CheckLine(std::string& line, + const std::string& file) override; + virtual bool WriteLine(std::string& line, const std::string& file) override; + virtual bool WriteNumber(const std::size_t& pos, + std::string& from_what) override; - virtual bool WriteNumber16(const std::size_t& pos, std::string& from_what); - virtual bool WriteNumber32(const std::size_t& pos, std::string& from_what); - virtual bool WriteNumber8(const std::size_t& pos, std::string& from_what); -}; + virtual bool WriteNumber16(const std::size_t& pos, std::string& from_what); + virtual bool WriteNumber32(const std::size_t& pos, std::string& from_what); + virtual bool WriteNumber8(const std::size_t& pos, std::string& from_what); + }; -#endif // __ASM_NEED_AMD64__ +#endif // __ASM_NEED_AMD64__ #ifdef __ASM_NEED_64x0__ -class Encoder64x0 final : public EncoderInterface { - public: - explicit Encoder64x0() = default; - ~Encoder64x0() override = default; + class Encoder64x0 final : public EncoderInterface + { + public: + explicit Encoder64x0() = default; + ~Encoder64x0() override = default; - MPCC_COPY_DEFAULT(Encoder64x0); + MPCC_COPY_DEFAULT(Encoder64x0); - virtual std::string CheckLine(std::string& line, - const std::string& file) override; - virtual bool WriteLine(std::string& line, const std::string& file) override; - virtual bool WriteNumber(const std::size_t& pos, - std::string& from_what) override; -}; + virtual std::string CheckLine(std::string& line, + const std::string& file) override; + virtual bool WriteLine(std::string& line, const std::string& file) override; + virtual bool WriteNumber(const std::size_t& pos, + std::string& from_what) override; + }; -#endif // __ASM_NEED_64x0__ +#endif // __ASM_NEED_64x0__ #ifdef __ASM_NEED_32x0__ -class Encoder32x0 final : public EncoderInterface { - public: - explicit Encoder32x0() = default; - ~Encoder32x0() override = default; + class Encoder32x0 final : public EncoderInterface + { + public: + explicit Encoder32x0() = default; + ~Encoder32x0() override = default; - MPCC_COPY_DEFAULT(Encoder32x0); + MPCC_COPY_DEFAULT(Encoder32x0); - virtual std::string CheckLine(std::string& line, - const std::string& file) override; - virtual bool WriteLine(std::string& line, const std::string& file) override; - virtual bool WriteNumber(const std::size_t& pos, - std::string& from_what) override; -}; + virtual std::string CheckLine(std::string& line, + const std::string& file) override; + virtual bool WriteLine(std::string& line, const std::string& file) override; + virtual bool WriteNumber(const std::size_t& pos, + std::string& from_what) override; + }; -#endif // __ASM_NEED_32x0__ +#endif // __ASM_NEED_32x0__ #ifdef __ASM_NEED_PPC__ -class EncoderPowerPC final : public EncoderInterface { - public: - explicit EncoderPowerPC() = default; - ~EncoderPowerPC() override = default; + class EncoderPowerPC final : public EncoderInterface + { + public: + explicit EncoderPowerPC() = default; + ~EncoderPowerPC() override = default; - MPCC_COPY_DEFAULT(EncoderPowerPC); + MPCC_COPY_DEFAULT(EncoderPowerPC); - virtual std::string CheckLine(std::string& line, - const std::string& file) override; - virtual bool WriteLine(std::string& line, const std::string& file) override; - virtual bool WriteNumber(const std::size_t& pos, - std::string& from_what) override; -}; + virtual std::string CheckLine(std::string& line, + const std::string& file) override; + virtual bool WriteLine(std::string& line, const std::string& file) override; + virtual bool WriteNumber(const std::size_t& pos, + std::string& from_what) override; + }; -#endif // __ASM_NEED_32x0__ -} // namespace CompilerKit +#endif // __ASM_NEED_32x0__ +} // namespace CompilerKit diff --git a/Headers/AsmKit/CPU/32x0.hpp b/Headers/AsmKit/CPU/32x0.hpp index ed9c20f..a78a04b 100644 --- a/Headers/AsmKit/CPU/32x0.hpp +++ b/Headers/AsmKit/CPU/32x0.hpp @@ -12,44 +12,45 @@ // @file CPU/32x0.hpp #define kAsmOpcodeDecl(__NAME, __OPCODE, __FUNCT3, __FUNCT7) \ - {.fName = __NAME, \ - .fOpcode = __OPCODE, \ - .fFunct3 = __FUNCT3, \ - .fFunct7 = __FUNCT7}, + {.fName = __NAME, \ + .fOpcode = __OPCODE, \ + .fFunct3 = __FUNCT3, \ + .fFunct7 = __FUNCT7}, #define kAsmImmediate 0x01 -#define kAsmSyscall 0x02 -#define kAsmJump 0x03 -#define kAsmNoArgs 0x04 +#define kAsmSyscall 0x02 +#define kAsmJump 0x03 +#define kAsmNoArgs 0x04 -#define kAsmByte 0 +#define kAsmByte 0 #define kAsmHWord 1 -#define kAsmWord 2 - -struct CpuCode32x0 { - const char fName[32]; - char fOpcode; - char fSize; - char fFunct3; - char fFunct7; +#define kAsmWord 2 + +struct CpuCode32x0 +{ + const char fName[32]; + char fOpcode; + char fSize; + char fFunct3; + char fFunct7; }; #define kAsmDWordStr ".dword" /* 64 bit */ -#define kAsmWordStr ".word" /* 32-bit */ +#define kAsmWordStr ".word" /* 32-bit */ #define kAsmHWordStr ".half" /* 16-bit */ -#define kAsmByteStr ".byte" /* 8-bit */ +#define kAsmByteStr ".byte" /* 8-bit */ inline std::vector<CpuCode32x0> kOpcodes32x0 = { - kAsmOpcodeDecl("nop", 0b0100011, 0b000, kAsmNoArgs) // nothing to do. - kAsmOpcodeDecl("br", 0b1110011, 0b001, kAsmJump) // jump to branch - kAsmOpcodeDecl("mr", 0b0100011, 0b101, kAsmImmediate) // move registers - kAsmOpcodeDecl("psh", 0b0111011, 0b000, kAsmImmediate) // push to sp - kAsmOpcodeDecl("pop", 0b0111011, 0b001, kAsmImmediate) // pop from sp. - kAsmOpcodeDecl("cls", 0b0111011, 0b010, - kAsmImmediate) // setup stack and call, store address to CR. - kAsmOpcodeDecl("rts", 0b0111011, 0b110, - kAsmImmediate) // pull stack and return form CR. - kAsmOpcodeDecl("int", 0b0111111, 0b000, kAsmSyscall) // raise interrupt + kAsmOpcodeDecl("nop", 0b0100011, 0b000, kAsmNoArgs) // nothing to do. + kAsmOpcodeDecl("br", 0b1110011, 0b001, kAsmJump) // jump to branch + kAsmOpcodeDecl("mr", 0b0100011, 0b101, kAsmImmediate) // move registers + kAsmOpcodeDecl("psh", 0b0111011, 0b000, kAsmImmediate) // push to sp + kAsmOpcodeDecl("pop", 0b0111011, 0b001, kAsmImmediate) // pop from sp. + kAsmOpcodeDecl("cls", 0b0111011, 0b010, + kAsmImmediate) // setup stack and call, store address to CR. + kAsmOpcodeDecl("rts", 0b0111011, 0b110, + kAsmImmediate) // pull stack and return form CR. + kAsmOpcodeDecl("int", 0b0111111, 0b000, kAsmSyscall) // raise interrupt }; // \brief 64x0 register prefix @@ -58,10 +59,10 @@ inline std::vector<CpuCode32x0> kOpcodes32x0 = { // r0 -> hw zero #define kAsmRegisterPrefix "r" -#define kAsmRegisterLimit 16 -#define kAsmPcRegister 17 -#define kAsmCrRegister 18 -#define kAsmSpRegister 5 +#define kAsmRegisterLimit 16 +#define kAsmPcRegister 17 +#define kAsmCrRegister 18 +#define kAsmSpRegister 5 /* return address register */ #define kAsmRetRegister 19 diff --git a/Headers/AsmKit/CPU/64x0.hpp b/Headers/AsmKit/CPU/64x0.hpp index 01e2a61..a72f72f 100644 --- a/Headers/AsmKit/CPU/64x0.hpp +++ b/Headers/AsmKit/CPU/64x0.hpp @@ -13,56 +13,53 @@ // @file CPU/64x0.hpp #define kAsmOpcodeDecl(__NAME, __OPCODE, __FUNCT3, __FUNCT7) \ - {.fName = __NAME, \ - .fOpcode = __OPCODE, \ - .fFunct3 = __FUNCT3, \ - .fFunct7 = __FUNCT7}, + {.fName = __NAME, \ + .fOpcode = __OPCODE, \ + .fFunct3 = __FUNCT3, \ + .fFunct7 = __FUNCT7}, #define kAsmImmediate 0x01 -#define kAsmRegToReg 0x02 -#define kAsmSyscall 0x03 -#define kAsmJump 0x04 -#define kAsmNoArgs 0x00 +#define kAsmRegToReg 0x02 +#define kAsmSyscall 0x03 +#define kAsmJump 0x04 +#define kAsmNoArgs 0x00 -typedef char e64k_character_t; +typedef char e64k_character_t; typedef uint8_t e64k_num_t; -struct CpuOpcode64x0 { - const e64k_character_t fName[32]; - e64k_num_t fOpcode; - e64k_num_t fFunct3; - e64k_num_t fFunct7; +struct CpuOpcode64x0 +{ + const e64k_character_t fName[32]; + e64k_num_t fOpcode; + e64k_num_t fFunct3; + e64k_num_t fFunct7; }; inline std::vector<CpuOpcode64x0> kOpcodes64x0 = { - kAsmOpcodeDecl("nop", 0b0000000, 0b0000000, kAsmNoArgs) // no-operation. - kAsmOpcodeDecl("np", 0b0000000, 0b0000000, kAsmNoArgs) // no-operation. - kAsmOpcodeDecl("jlr", 0b1110011, 0b0000111, - kAsmJump) // jump to linked return register - kAsmOpcodeDecl("jrl", 0b1110011, 0b0001111, - kAsmJump) // jump from return register. - kAsmOpcodeDecl("mv", 0b0100011, 0b101, kAsmRegToReg) kAsmOpcodeDecl( - "bg", 0b1100111, 0b111, - kAsmRegToReg) kAsmOpcodeDecl("bl", 0b1100111, 0b011, kAsmRegToReg) - kAsmOpcodeDecl("beq", 0b1100111, 0b000, kAsmRegToReg) kAsmOpcodeDecl( - "bne", 0b1100111, 0b001, - kAsmRegToReg) kAsmOpcodeDecl("bge", 0b1100111, 0b101, kAsmRegToReg) - kAsmOpcodeDecl("ble", 0b1100111, 0b100, kAsmRegToReg) - kAsmOpcodeDecl("stw", 0b0001111, 0b100, kAsmImmediate) - kAsmOpcodeDecl("ldw", 0b0001111, 0b100, kAsmImmediate) - kAsmOpcodeDecl("lda", 0b0001111, 0b101, kAsmImmediate) - kAsmOpcodeDecl("sta", 0b0001111, 0b001, - kAsmImmediate) - // add/sub without carry flag - kAsmOpcodeDecl("add", 0b0101011, 0b100, kAsmImmediate) - kAsmOpcodeDecl("dec", 0b0101011, 0b101, kAsmImmediate) - // add/sub with carry flag - kAsmOpcodeDecl("addc", 0b0101011, 0b110, kAsmImmediate) - kAsmOpcodeDecl("decc", 0b0101011, 0b111, kAsmImmediate) - kAsmOpcodeDecl("int", 0b1110011, 0b00, kAsmSyscall) - kAsmOpcodeDecl("pha", 0b1110011, 0b00, kAsmNoArgs) - kAsmOpcodeDecl("pla", 0b1110011, 0b01, kAsmNoArgs) -}; + kAsmOpcodeDecl("nop", 0b0000000, 0b0000000, kAsmNoArgs) // no-operation. + kAsmOpcodeDecl("np", 0b0000000, 0b0000000, kAsmNoArgs) // no-operation. + kAsmOpcodeDecl("jlr", 0b1110011, 0b0000111, + kAsmJump) // jump to linked return register + kAsmOpcodeDecl("jrl", 0b1110011, 0b0001111, + kAsmJump) // jump from return register. + kAsmOpcodeDecl("mv", 0b0100011, 0b101, kAsmRegToReg) kAsmOpcodeDecl( + "bg", 0b1100111, 0b111, kAsmRegToReg) kAsmOpcodeDecl("bl", 0b1100111, 0b011, kAsmRegToReg) + kAsmOpcodeDecl("beq", 0b1100111, 0b000, kAsmRegToReg) kAsmOpcodeDecl( + "bne", 0b1100111, 0b001, kAsmRegToReg) kAsmOpcodeDecl("bge", 0b1100111, 0b101, kAsmRegToReg) + kAsmOpcodeDecl("ble", 0b1100111, 0b100, kAsmRegToReg) + kAsmOpcodeDecl("stw", 0b0001111, 0b100, kAsmImmediate) + kAsmOpcodeDecl("ldw", 0b0001111, 0b100, kAsmImmediate) + kAsmOpcodeDecl("lda", 0b0001111, 0b101, kAsmImmediate) + kAsmOpcodeDecl("sta", 0b0001111, 0b001, kAsmImmediate) + // add/sub without carry flag + kAsmOpcodeDecl("add", 0b0101011, 0b100, kAsmImmediate) + kAsmOpcodeDecl("dec", 0b0101011, 0b101, kAsmImmediate) + // add/sub with carry flag + kAsmOpcodeDecl("addc", 0b0101011, 0b110, kAsmImmediate) + kAsmOpcodeDecl("decc", 0b0101011, 0b111, kAsmImmediate) + kAsmOpcodeDecl("int", 0b1110011, 0b00, kAsmSyscall) + kAsmOpcodeDecl("pha", 0b1110011, 0b00, kAsmNoArgs) + kAsmOpcodeDecl("pla", 0b1110011, 0b01, kAsmNoArgs)}; // \brief 64x0 register prefix // example: r32, r0 @@ -70,13 +67,13 @@ inline std::vector<CpuOpcode64x0> kOpcodes64x0 = { // r0 -> hw zero #define kAsmFloatZeroRegister 0 -#define kAsmZeroRegister 0 +#define kAsmZeroRegister 0 #define kAsmRegisterPrefix "r" -#define kAsmRegisterLimit 30 -#define kAsmPcRegister 17 -#define kAsmCrRegister 18 -#define kAsmSpRegister 5 +#define kAsmRegisterLimit 30 +#define kAsmPcRegister 17 +#define kAsmCrRegister 18 +#define kAsmSpRegister 5 /* return address register */ #define kAsmRetRegister 19 diff --git a/Headers/AsmKit/CPU/amd64.hpp b/Headers/AsmKit/CPU/amd64.hpp index 189980f..5a8f72a 100644 --- a/Headers/AsmKit/CPU/amd64.hpp +++ b/Headers/AsmKit/CPU/amd64.hpp @@ -13,37 +13,37 @@ #define kAsmOpcodeDecl(__NAME, __OPCODE) {.fName = __NAME, .fOpcode = __OPCODE}, -typedef char i64_character_t; -typedef uint8_t i64_byte_t; +typedef char i64_character_t; +typedef uint8_t i64_byte_t; typedef uint16_t i64_hword_t; typedef uint32_t i64_word_t; -struct CpuOpcodeAMD64 { - std::string fName; - i64_byte_t fPrefixBytes[4]; - i64_hword_t fOpcode; - i64_hword_t fModReg; - i64_word_t fDisplacment; - i64_word_t fImmediate; +struct CpuOpcodeAMD64 +{ + std::string fName; + i64_byte_t fPrefixBytes[4]; + i64_hword_t fOpcode; + i64_hword_t fModReg; + i64_word_t fDisplacment; + i64_word_t fImmediate; }; /// these two are edge cases -#define kAsmIntOpcode 0xCC +#define kAsmIntOpcode 0xCC #define kasmIntOpcodeAlt 0xCD -#define kAsmJumpOpcode 0x0F80 -#define kJumpLimit 30 -#define kJumpLimitStandard 0xE3 +#define kAsmJumpOpcode 0x0F80 +#define kJumpLimit 30 +#define kJumpLimitStandard 0xE3 #define kJumpLimitStandardLimit 0xEB 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("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)}; #define kAsmRegisterLimit 15 diff --git a/Headers/AsmKit/CPU/ppc.hpp b/Headers/AsmKit/CPU/ppc.hpp index 247783a..c29286d 100644 --- a/Headers/AsmKit/CPU/ppc.hpp +++ b/Headers/AsmKit/CPU/ppc.hpp @@ -10,1907 +10,1910 @@ * is zero it can execute on all cpus. The defines are or'ed together. This * information is used to set the cpusubtype in the resulting object file. */ -#define CPU601 0x1 -#define IMPL64 0x2 -#define OPTIONAL 0x4 -#define VMX 0x8 -#define CPU970 0x10 /* added to OPTIONAL insts that the 970 has */ +#define CPU601 0x1 +#define IMPL64 0x2 +#define OPTIONAL 0x4 +#define VMX 0x8 +#define CPU970 0x10 /* added to OPTIONAL insts that the 970 has */ #define CPUMAHROUSS 0x12 /* optional mahrouss insts. */ -enum optype { - NONE, /* no operand */ - JBSR, /* jbsr pseudo op */ - PCREL, /* PC relative (branch offset) */ - BADDR, /* Branch address (sign extended absolute address) */ - D, /* 16 bit displacement */ - DS, /* 14 bit displacement (double word) */ - SI, /* signed 16 bit immediate */ - UI, /* unsigned 16 bit immediate */ - HI, /* high 16 bit immediate (with truncation) */ - GREG, /* general register */ - G0REG, /* general register r1-r31 or 0 */ - FREG, /* float register */ - VREG, /* vector register */ - SGREG, /* segment register */ - SPREG, /* special register (or 10 bit number, 5 bit halves reversed) */ - BCND, /* branch condition opcode */ - CRF, /* condition register field */ - CRFONLY, /* condition register field only no expression allowed */ - sh, /* 6 bit number (0 - 63) (sh field, split and reversed) */ - mb, /* 6 bit number (0 - 63) (mb field, mb5 || mb0:4 reversed) */ - NUM, /* number */ - SNUM, /* signed number */ - NUM0, /* number (where 1<<width is the same as 0) */ - MBE, /* mask defined by MB and ME fields */ - FXM, /* 8-bit mask with only one bit set */ - ZERO /* the number zero */ +enum optype +{ + NONE, /* no operand */ + JBSR, /* jbsr pseudo op */ + PCREL, /* PC relative (branch offset) */ + BADDR, /* Branch address (sign extended absolute address) */ + D, /* 16 bit displacement */ + DS, /* 14 bit displacement (double word) */ + SI, /* signed 16 bit immediate */ + UI, /* unsigned 16 bit immediate */ + HI, /* high 16 bit immediate (with truncation) */ + GREG, /* general register */ + G0REG, /* general register r1-r31 or 0 */ + FREG, /* float register */ + VREG, /* vector register */ + SGREG, /* segment register */ + SPREG, /* special register (or 10 bit number, 5 bit halves reversed) */ + BCND, /* branch condition opcode */ + CRF, /* condition register field */ + CRFONLY, /* condition register field only no expression allowed */ + sh, /* 6 bit number (0 - 63) (sh field, split and reversed) */ + mb, /* 6 bit number (0 - 63) (mb field, mb5 || mb0:4 reversed) */ + NUM, /* number */ + SNUM, /* signed number */ + NUM0, /* number (where 1<<width is the same as 0) */ + MBE, /* mask defined by MB and ME fields */ + FXM, /* 8-bit mask with only one bit set */ + ZERO /* the number zero */ }; -struct op { - uint32_t offset : 5; - uint32_t width : 5; - enum optype type : 6; +struct op +{ + uint32_t offset : 5; + uint32_t width : 5; + enum optype type : 6; }; -struct CpuOpcodePPC { - uint32_t opcode; - const char *name; // c++ wants the string to be const, it makes sense here. - struct op ops[5]; - uint32_t cpus; +struct CpuOpcodePPC +{ + uint32_t opcode; + const char* name; // c++ wants the string to be const, it makes sense here. + struct op ops[5]; + uint32_t cpus; }; #define kOpcodePPCCount (1073U) inline CpuOpcodePPC kOpcodesPowerPC[] = { - {0x38000000, "addi", {{21, 5, GREG}, {16, 5, G0REG}, {0, 16, SI}}}, - {0x38000000, "li", {{21, 5, GREG}, {0, 16, SI}}}, - {0x3c000000, "addis", {{21, 5, GREG}, {16, 5, G0REG}, {0, 16, HI}}}, - {0x3c000000, "lis", {{21, 5, GREG}, {0, 16, HI}}}, - {0x30000000, "addic", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}}, - {0x34000000, "addic.", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}}, - {0x7c000214, "add", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000215, "add.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000614, "addo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000615, "addo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000014, "addc", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000015, "addc.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000414, "addco", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000415, "addco.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000114, "adde", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000115, "adde.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000514, "addeo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000515, "addeo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c0001d4, "addme", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c0001d5, "addme.", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c0005d4, "addmeo", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c0005d5, "addmeo.", {{21, 5, GREG}, {16, 5, GREG}}}, - - {0x7c000194, "addze", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c000195, "addze.", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c000594, "addzeo", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c000595, "addzeo.", {{21, 5, GREG}, {16, 5, GREG}}}, - - {0x70000000, "andi.", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, - {0x74000000, "andis.", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, - {0x7c000038, "and", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000039, "and.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000078, "andc", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000079, "andc.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - - {0x48000000, "b", {{2, 24, PCREL}}}, - {0x48000002, "ba", {{2, 24, BADDR}}}, - {0x48000001, "bl", {{2, 24, PCREL}}}, - {0x48000003, "bla", {{2, 24, BADDR}}}, - - {0x48000001, "jbsr", {{0, 0, JBSR}, {2, 24, PCREL}}}, - {0x48000000, "jmp", {{0, 0, JBSR}, {2, 24, PCREL}}}, - - {0x40000000, "bc", {{21, 5, NUM}, {16, 5, NUM}, {2, 14, PCREL}}}, - {0x40000002, "bca", {{21, 5, NUM}, {16, 5, NUM}, {2, 14, BADDR}}}, - {0x40000001, "bcl", {{21, 5, NUM}, {16, 5, NUM}, {2, 14, PCREL}}}, - {0x40000003, "bcla", {{21, 5, NUM}, {16, 5, NUM}, {2, 14, BADDR}}}, - - {0x4c000420, "bcctr", {{21, 5, NUM}, {16, 5, NUM}}}, - {0x4c000420, "bcctr", {{21, 5, NUM}, {16, 5, NUM}, {11, 2, NUM}}}, - {0x4c000421, "bcctrl", {{21, 5, NUM}, {16, 5, NUM}}}, - {0x4c000421, "bcctrl", {{21, 5, NUM}, {16, 5, NUM}, {11, 2, NUM}}}, - {0x4c000020, "bclr", {{21, 5, NUM}, {16, 5, NUM}}}, - {0x4c000020, "bclr", {{21, 5, NUM}, {16, 5, NUM}, {11, 2, NUM}}}, - {0x4c000021, "bclrl", {{21, 5, NUM}, {16, 5, NUM}}}, - {0x4c000021, "bclrl", {{21, 5, NUM}, {16, 5, NUM}, {11, 2, NUM}}}, - - /* Basic branch mnemonics (assember extended mnemonics) */ - /* { 0x42800000, "b", {{2,14,PCREL}} }, overlaps */ - /* { 0x42800001, "bl", {{2,14,PCREL}} }, overlaps */ - {0x41800000, "bt", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x41800001, "btl", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x40800000, "bf", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x40800001, "bfl", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x42000000, "bdnz", {{2, 14, PCREL}}}, - {0x42000001, "bdnzl", {{2, 14, PCREL}}}, - {0x41000000, "bdnzt", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x41000001, "bdnztl", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x40000000, "bdnzf", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x40000001, "bdnzfl", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x42400000, "bdz", {{2, 14, PCREL}}}, - {0x42400001, "bdzl", {{2, 14, PCREL}}}, - {0x41400000, "bdzt", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x41400001, "bdztl", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x40400000, "bdzf", {{16, 5, BCND}, {2, 14, PCREL}}}, - {0x40400001, "bdzfl", {{16, 5, BCND}, {2, 14, PCREL}}}, - - /* { 0x42800002, "ba", {{2,14,BADDR}} }, overlaps */ - /* { 0x42800003, "bla", {{2,14,BADDR}} }, overlaps */ - {0x41800002, "bta", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x41800003, "btla", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x40800002, "bfa", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x40800003, "bfla", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x42000002, "bdnza", {{2, 14, BADDR}}}, - {0x42000003, "bdnzla", {{2, 14, BADDR}}}, - {0x41000002, "bdnzta", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x41000003, "bdnztla", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x40000002, "bdnzfa", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x40000003, "bdnzfla", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x42400002, "bdza", {{2, 14, BADDR}}}, - {0x42400003, "bdzla", {{2, 14, BADDR}}}, - {0x41400002, "bdzta", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x41400003, "bdztla", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x40400002, "bdzfa", {{16, 5, BCND}, {2, 14, BADDR}}}, - {0x40400003, "bdzfla", {{16, 5, BCND}, {2, 14, BADDR}}}, - - { - 0x4e800020, - "blr", - }, - {0x4e800020, "blr", {{11, 2, NUM}}}, - { - 0x4e800021, - "blrl", - }, - {0x4e800021, "blrl", {{11, 2, NUM}}}, - {0x4d800020, "btlr", {{16, 5, BCND}}}, - {0x4d800020, "btlr", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4d800021, "btlrl", {{16, 5, BCND}}}, - {0x4d800021, "btlrl", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4c800020, "bflr", {{16, 5, BCND}}}, - {0x4c800020, "bflr", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4c800021, "bflrl", {{16, 5, BCND}}}, - {0x4c800021, "bflrl", {{16, 5, BCND}, {11, 2, NUM}}}, - { - 0x4e000020, - "bdnzlr", - }, - {0x4e000020, "bdnzlr", {{11, 2, NUM}}}, - { - 0x4e000021, - "bdnzlrl", - }, - {0x4e000021, "bdnzlrl", {{11, 2, NUM}}}, - {0x4d000020, "bdnztlr", {{16, 5, BCND}}}, - {0x4d000020, "bdnztlr", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4d000021, "bdnztlrl", {{16, 5, BCND}}}, - {0x4d000021, "bdnztlrl", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4c000020, "bdnzflr", {{16, 5, BCND}}}, - {0x4c000020, "bdnzflr", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4c000021, "bdnzflrl", {{16, 5, BCND}}}, - {0x4c000021, "bdnzflrl", {{16, 5, BCND}, {11, 2, NUM}}}, - { - 0x4e400020, - "bdzlr", - }, - {0x4e400020, "bdzlr", {{11, 2, NUM}}}, - { - 0x4e400021, - "bdzlrl", - }, - {0x4e400021, "bdzlrl", {{11, 2, NUM}}}, - {0x4d400020, "bdztlr", {{16, 5, BCND}}}, - {0x4d400020, "bdztlr", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4d400021, "bdztlrl", {{16, 5, BCND}}}, - {0x4d400021, "bdztlrl", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4c400020, "bdzflr", {{16, 5, BCND}}}, - {0x4c400020, "bdzflr", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4c400021, "bdzflrl", {{16, 5, BCND}}}, - {0x4c400021, "bdzflrl", {{16, 5, BCND}, {11, 2, NUM}}}, - - {0x4c000420, "bctr", {{21, 5, NUM}, {16, 5, NUM}}}, - { - 0x4e800420, - "bctr", - }, - {0x4e800420, "bctr", {{11, 2, NUM}}}, - {0x4c000421, "bctrl", {{21, 5, NUM}, {16, 5, NUM}}}, - { - 0x4e800421, - "bctrl", - }, - {0x4e800421, "bctrl", {{11, 2, NUM}}}, - {0x4d800420, "btctr", {{16, 5, BCND}}}, - {0x4d800420, "btctr", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4d800421, "btctrl", {{16, 5, BCND}}}, - {0x4d800421, "btctrl", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4c800420, "bfctr", {{16, 5, BCND}}}, - {0x4c800420, "bfctr", {{16, 5, BCND}, {11, 2, NUM}}}, - {0x4c800421, "bfctrl", {{16, 5, BCND}}}, - {0x4c800421, "bfctrl", {{16, 5, BCND}, {11, 2, NUM}}}, - - /* branch mnemonics incorporating conditions (assember extended mnemonics) + {0x38000000, "addi", {{21, 5, GREG}, {16, 5, G0REG}, {0, 16, SI}}}, + {0x38000000, "li", {{21, 5, GREG}, {0, 16, SI}}}, + {0x3c000000, "addis", {{21, 5, GREG}, {16, 5, G0REG}, {0, 16, HI}}}, + {0x3c000000, "lis", {{21, 5, GREG}, {0, 16, HI}}}, + {0x30000000, "addic", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}}, + {0x34000000, "addic.", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}}, + {0x7c000214, "add", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000215, "add.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000614, "addo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000615, "addo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000014, "addc", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000015, "addc.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000414, "addco", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000415, "addco.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000114, "adde", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000115, "adde.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000514, "addeo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000515, "addeo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c0001d4, "addme", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c0001d5, "addme.", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c0005d4, "addmeo", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c0005d5, "addmeo.", {{21, 5, GREG}, {16, 5, GREG}}}, + + {0x7c000194, "addze", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c000195, "addze.", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c000594, "addzeo", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c000595, "addzeo.", {{21, 5, GREG}, {16, 5, GREG}}}, + + {0x70000000, "andi.", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, + {0x74000000, "andis.", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, + {0x7c000038, "and", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000039, "and.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000078, "andc", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000079, "andc.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + + {0x48000000, "b", {{2, 24, PCREL}}}, + {0x48000002, "ba", {{2, 24, BADDR}}}, + {0x48000001, "bl", {{2, 24, PCREL}}}, + {0x48000003, "bla", {{2, 24, BADDR}}}, + + {0x48000001, "jbsr", {{0, 0, JBSR}, {2, 24, PCREL}}}, + {0x48000000, "jmp", {{0, 0, JBSR}, {2, 24, PCREL}}}, + + {0x40000000, "bc", {{21, 5, NUM}, {16, 5, NUM}, {2, 14, PCREL}}}, + {0x40000002, "bca", {{21, 5, NUM}, {16, 5, NUM}, {2, 14, BADDR}}}, + {0x40000001, "bcl", {{21, 5, NUM}, {16, 5, NUM}, {2, 14, PCREL}}}, + {0x40000003, "bcla", {{21, 5, NUM}, {16, 5, NUM}, {2, 14, BADDR}}}, + + {0x4c000420, "bcctr", {{21, 5, NUM}, {16, 5, NUM}}}, + {0x4c000420, "bcctr", {{21, 5, NUM}, {16, 5, NUM}, {11, 2, NUM}}}, + {0x4c000421, "bcctrl", {{21, 5, NUM}, {16, 5, NUM}}}, + {0x4c000421, "bcctrl", {{21, 5, NUM}, {16, 5, NUM}, {11, 2, NUM}}}, + {0x4c000020, "bclr", {{21, 5, NUM}, {16, 5, NUM}}}, + {0x4c000020, "bclr", {{21, 5, NUM}, {16, 5, NUM}, {11, 2, NUM}}}, + {0x4c000021, "bclrl", {{21, 5, NUM}, {16, 5, NUM}}}, + {0x4c000021, "bclrl", {{21, 5, NUM}, {16, 5, NUM}, {11, 2, NUM}}}, + + /* Basic branch mnemonics (assember extended mnemonics) */ + /* { 0x42800000, "b", {{2,14,PCREL}} }, overlaps */ + /* { 0x42800001, "bl", {{2,14,PCREL}} }, overlaps */ + {0x41800000, "bt", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x41800001, "btl", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x40800000, "bf", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x40800001, "bfl", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x42000000, "bdnz", {{2, 14, PCREL}}}, + {0x42000001, "bdnzl", {{2, 14, PCREL}}}, + {0x41000000, "bdnzt", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x41000001, "bdnztl", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x40000000, "bdnzf", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x40000001, "bdnzfl", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x42400000, "bdz", {{2, 14, PCREL}}}, + {0x42400001, "bdzl", {{2, 14, PCREL}}}, + {0x41400000, "bdzt", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x41400001, "bdztl", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x40400000, "bdzf", {{16, 5, BCND}, {2, 14, PCREL}}}, + {0x40400001, "bdzfl", {{16, 5, BCND}, {2, 14, PCREL}}}, + + /* { 0x42800002, "ba", {{2,14,BADDR}} }, overlaps */ + /* { 0x42800003, "bla", {{2,14,BADDR}} }, overlaps */ + {0x41800002, "bta", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x41800003, "btla", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x40800002, "bfa", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x40800003, "bfla", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x42000002, "bdnza", {{2, 14, BADDR}}}, + {0x42000003, "bdnzla", {{2, 14, BADDR}}}, + {0x41000002, "bdnzta", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x41000003, "bdnztla", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x40000002, "bdnzfa", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x40000003, "bdnzfla", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x42400002, "bdza", {{2, 14, BADDR}}}, + {0x42400003, "bdzla", {{2, 14, BADDR}}}, + {0x41400002, "bdzta", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x41400003, "bdztla", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x40400002, "bdzfa", {{16, 5, BCND}, {2, 14, BADDR}}}, + {0x40400003, "bdzfla", {{16, 5, BCND}, {2, 14, BADDR}}}, + + { + 0x4e800020, + "blr", + }, + {0x4e800020, "blr", {{11, 2, NUM}}}, + { + 0x4e800021, + "blrl", + }, + {0x4e800021, "blrl", {{11, 2, NUM}}}, + {0x4d800020, "btlr", {{16, 5, BCND}}}, + {0x4d800020, "btlr", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4d800021, "btlrl", {{16, 5, BCND}}}, + {0x4d800021, "btlrl", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4c800020, "bflr", {{16, 5, BCND}}}, + {0x4c800020, "bflr", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4c800021, "bflrl", {{16, 5, BCND}}}, + {0x4c800021, "bflrl", {{16, 5, BCND}, {11, 2, NUM}}}, + { + 0x4e000020, + "bdnzlr", + }, + {0x4e000020, "bdnzlr", {{11, 2, NUM}}}, + { + 0x4e000021, + "bdnzlrl", + }, + {0x4e000021, "bdnzlrl", {{11, 2, NUM}}}, + {0x4d000020, "bdnztlr", {{16, 5, BCND}}}, + {0x4d000020, "bdnztlr", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4d000021, "bdnztlrl", {{16, 5, BCND}}}, + {0x4d000021, "bdnztlrl", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4c000020, "bdnzflr", {{16, 5, BCND}}}, + {0x4c000020, "bdnzflr", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4c000021, "bdnzflrl", {{16, 5, BCND}}}, + {0x4c000021, "bdnzflrl", {{16, 5, BCND}, {11, 2, NUM}}}, + { + 0x4e400020, + "bdzlr", + }, + {0x4e400020, "bdzlr", {{11, 2, NUM}}}, + { + 0x4e400021, + "bdzlrl", + }, + {0x4e400021, "bdzlrl", {{11, 2, NUM}}}, + {0x4d400020, "bdztlr", {{16, 5, BCND}}}, + {0x4d400020, "bdztlr", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4d400021, "bdztlrl", {{16, 5, BCND}}}, + {0x4d400021, "bdztlrl", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4c400020, "bdzflr", {{16, 5, BCND}}}, + {0x4c400020, "bdzflr", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4c400021, "bdzflrl", {{16, 5, BCND}}}, + {0x4c400021, "bdzflrl", {{16, 5, BCND}, {11, 2, NUM}}}, + + {0x4c000420, "bctr", {{21, 5, NUM}, {16, 5, NUM}}}, + { + 0x4e800420, + "bctr", + }, + {0x4e800420, "bctr", {{11, 2, NUM}}}, + {0x4c000421, "bctrl", {{21, 5, NUM}, {16, 5, NUM}}}, + { + 0x4e800421, + "bctrl", + }, + {0x4e800421, "bctrl", {{11, 2, NUM}}}, + {0x4d800420, "btctr", {{16, 5, BCND}}}, + {0x4d800420, "btctr", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4d800421, "btctrl", {{16, 5, BCND}}}, + {0x4d800421, "btctrl", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4c800420, "bfctr", {{16, 5, BCND}}}, + {0x4c800420, "bfctr", {{16, 5, BCND}, {11, 2, NUM}}}, + {0x4c800421, "bfctrl", {{16, 5, BCND}}}, + {0x4c800421, "bfctrl", {{16, 5, BCND}, {11, 2, NUM}}}, + + /* branch mnemonics incorporating conditions (assember extended mnemonics) */ - {0x41800000, "blt", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41800000, "blt", {{2, 14, PCREL}}}, - {0x41800001, "bltl", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41800001, "bltl", {{2, 14, PCREL}}}, - {0x40810000, "ble", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40810000, "ble", {{2, 14, PCREL}}}, - {0x40810001, "blel", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40810001, "blel", {{2, 14, PCREL}}}, - {0x41820000, "beq", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41820000, "beq", {{2, 14, PCREL}}}, - {0x41820001, "beql", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41820001, "beql", {{2, 14, PCREL}}}, - {0x40800000, "bge", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40800000, "bge", {{2, 14, PCREL}}}, - {0x40800001, "bgel", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40800001, "bgel", {{2, 14, PCREL}}}, - {0x41810000, "bgt", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41810000, "bgt", {{2, 14, PCREL}}}, - {0x41810001, "bgtl", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41810001, "bgtl", {{2, 14, PCREL}}}, - {0x40800000, "bnl", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40800000, "bnl", {{2, 14, PCREL}}}, - {0x40800001, "bnll", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40800001, "bnll", {{2, 14, PCREL}}}, - {0x40820000, "bne", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40820000, "bne", {{2, 14, PCREL}}}, - {0x40820001, "bnel", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40820001, "bnel", {{2, 14, PCREL}}}, - {0x40810000, "bng", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40810000, "bng", {{2, 14, PCREL}}}, - {0x40810001, "bngl", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40810001, "bngl", {{2, 14, PCREL}}}, - {0x41830000, "bso", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41830000, "bso", {{2, 14, PCREL}}}, - {0x41830001, "bsol", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41830001, "bsol", {{2, 14, PCREL}}}, - {0x40830000, "bns", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40830000, "bns", {{2, 14, PCREL}}}, - {0x40830001, "bnsl", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40830001, "bnsl", {{2, 14, PCREL}}}, - {0x41830000, "bun", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41830000, "bun", {{2, 14, PCREL}}}, - {0x41830001, "bunl", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x41830001, "bunl", {{2, 14, PCREL}}}, - {0x40830000, "bnu", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40830000, "bnu", {{2, 14, PCREL}}}, - {0x40830001, "bnul", {{16, 5, CRF}, {2, 14, PCREL}}}, - {0x40830001, "bnul", {{2, 14, PCREL}}}, - - {0x41800002, "blta", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41800002, "blta", {{2, 14, BADDR}}}, - {0x41800003, "bltla", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41800003, "bltla", {{2, 14, BADDR}}}, - {0x40810002, "blea", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40810002, "blea", {{2, 14, BADDR}}}, - {0x40810003, "blela", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40810003, "blela", {{2, 14, BADDR}}}, - {0x41820002, "beqa", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41820002, "beqa", {{2, 14, BADDR}}}, - {0x41820003, "beqla", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41820003, "beqla", {{2, 14, BADDR}}}, - {0x40800002, "bgea", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40800002, "bgea", {{2, 14, BADDR}}}, - {0x40800003, "bgela", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40800003, "bgela", {{2, 14, BADDR}}}, - {0x41810002, "bgta", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41810002, "bgta", {{2, 14, BADDR}}}, - {0x41810003, "bgtla", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41810003, "bgtla", {{2, 14, BADDR}}}, - {0x40800002, "bnla", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40800002, "bnla", {{2, 14, BADDR}}}, - {0x40800003, "bnlla", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40800003, "bnlla", {{2, 14, BADDR}}}, - {0x40820002, "bnea", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40820002, "bnea", {{2, 14, BADDR}}}, - {0x40820003, "bnela", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40820003, "bnela", {{2, 14, BADDR}}}, - {0x40810002, "bnga", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40810002, "bnga", {{2, 14, BADDR}}}, - {0x40810003, "bngla", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40810003, "bngla", {{2, 14, BADDR}}}, - {0x41830002, "bsoa", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41830002, "bsoa", {{2, 14, BADDR}}}, - {0x41830003, "bsola", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41830003, "bsola", {{2, 14, BADDR}}}, - {0x40830002, "bnsa", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40830002, "bnsa", {{2, 14, BADDR}}}, - {0x40830003, "bnsla", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40830003, "bnsla", {{2, 14, BADDR}}}, - {0x41830002, "buna", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41830002, "buna", {{2, 14, BADDR}}}, - {0x41830003, "bunla", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x41830003, "bunla", {{2, 14, BADDR}}}, - {0x40830002, "bnua", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40830002, "bnua", {{2, 14, BADDR}}}, - {0x40830003, "bnula", {{16, 5, CRF}, {2, 14, BADDR}}}, - {0x40830003, "bnula", {{2, 14, BADDR}}}, - - {0x4d800020, "bltlr", {{16, 5, CRF}}}, - {0x4d800020, "bltlr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d800020, - "bltlr", - }, - {0x4d800021, "bltlrl", {{16, 5, CRF}}}, - {0x4d800021, "bltlrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d800021, - "bltlrl", - }, - {0x4c810020, "blelr", {{16, 5, CRF}}}, - {0x4c810020, "blelr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c810020, - "blelr", - }, - {0x4c810021, "blelrl", {{16, 5, CRF}}}, - {0x4c810021, "blelrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c810021, - "blelrl", - }, - {0x4d820020, "beqlr", {{16, 5, CRF}}}, - {0x4d820020, "beqlr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d820020, - "beqlr", - }, - {0x4d820021, "beqlrl", {{16, 5, CRF}}}, - {0x4d820021, "beqlrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d820021, - "beqlrl", - }, - {0x4c800020, "bgelr", {{16, 5, CRF}}}, - {0x4c800020, "bgelr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c800020, - "bgelr", - }, - {0x4c800021, "bgelrl", {{16, 5, CRF}}}, - {0x4c800021, "bgelrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c800021, - "bgelrl", - }, - {0x4d810020, "bgtlr", {{16, 5, CRF}}}, - {0x4d810020, "bgtlr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d810020, - "bgtlr", - }, - {0x4d810021, "bgtlrl", {{16, 5, CRF}}}, - {0x4d810021, "bgtlrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d810021, - "bgtlrl", - }, - {0x4c800020, "bnllr", {{16, 5, CRF}}}, - {0x4c800020, "bnllr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c800020, - "bnllr", - }, - {0x4c800021, "bnllrl", {{16, 5, CRF}}}, - {0x4c800021, "bnllrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c800021, - "bnllrl", - }, - {0x4c820020, "bnelr", {{16, 5, CRF}}}, - {0x4c820020, "bnelr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c820020, - "bnelr", - }, - {0x4c820021, "bnelrl", {{16, 5, CRF}}}, - {0x4c820021, "bnelrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c820021, - "bnelrl", - }, - {0x4c810020, "bnglr", {{16, 5, CRF}}}, - {0x4c810020, "bnglr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c810020, - "bnglr", - }, - {0x4c810021, "bnglrl", {{16, 5, CRF}}}, - {0x4c810021, "bnglrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c810021, - "bnglrl", - }, - {0x4d830020, "bsolr", {{16, 5, CRF}}}, - {0x4d830020, "bsolr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d830020, - "bsolr", - }, - {0x4d830021, "bsolrl", {{16, 5, CRF}}}, - {0x4d830021, "bsolrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d830021, - "bsolrl", - }, - {0x4c830020, "bnslr", {{16, 5, CRF}}}, - {0x4c830020, "bnslr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c830020, - "bnslr", - }, - {0x4c830021, "bnslrl", {{16, 5, CRF}}}, - {0x4c830021, "bnslrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c830021, - "bnslrl", - }, - {0x4d830020, "bunlr", {{16, 5, CRF}}}, - {0x4d830020, "bunlr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d830020, - "bunlr", - }, - {0x4d830021, "bunlrl", {{16, 5, CRF}}}, - {0x4d830021, "bunlrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d830021, - "bunlrl", - }, - {0x4c830020, "bnulr", {{16, 5, CRF}}}, - {0x4c830020, "bnulr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c830020, - "bnulr", - }, - {0x4c830021, "bnulrl", {{16, 5, CRF}}}, - {0x4c830021, "bnulrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c830021, - "bnulrl", - }, - - {0x4d800420, "bltctr", {{16, 5, CRF}}}, - {0x4d800420, "bltctr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d800420, - "bltctr", - }, - {0x4d800421, "bltctrl", {{16, 5, CRF}}}, - {0x4d800421, "bltctrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d800421, - "bltctrl", - }, - {0x4c810420, "blectr", {{16, 5, CRF}}}, - {0x4c810420, "blectr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c810420, - "blectr", - }, - {0x4c810421, "blectrl", {{16, 5, CRF}}}, - {0x4c810421, "blectrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c810421, - "blectrl", - }, - {0x4d820420, "beqctr", {{16, 5, CRF}}}, - {0x4d820420, "beqctr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d820420, - "beqctr", - }, - {0x4d820421, "beqctrl", {{16, 5, CRF}}}, - {0x4d820421, "beqctrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d820421, - "beqctrl", - }, - {0x4c800420, "bgectr", {{16, 5, CRF}}}, - {0x4c800420, "bgectr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c800420, - "bgectr", - }, - {0x4c800421, "bgectrl", {{16, 5, CRF}}}, - {0x4c800421, "bgectrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c800421, - "bgectrl", - }, - {0x4d810420, "bgtctr", {{16, 5, CRF}}}, - {0x4d810420, "bgtctr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d810420, - "bgtctr", - }, - {0x4d810421, "bgtctrl", {{16, 5, CRF}}}, - {0x4d810421, "bgtctrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d810421, - "bgtctrl", - }, - {0x4c800420, "bnlctr", {{16, 5, CRF}}}, - {0x4c800420, "bnlctr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c800420, - "bnlctr", - }, - {0x4c800421, "bnlctrl", {{16, 5, CRF}}}, - {0x4c800421, "bnlctrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c800421, - "bnlctrl", - }, - {0x4c820420, "bnectr", {{16, 5, CRF}}}, - {0x4c820420, "bnectr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c820420, - "bnectr", - }, - {0x4c820421, "bnectrl", {{16, 5, CRF}}}, - {0x4c820421, "bnectrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c820421, - "bnectrl", - }, - {0x4c810420, "bngctr", {{16, 5, CRF}}}, - {0x4c810420, "bngctr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c810420, - "bngctr", - }, - {0x4c810421, "bngctrl", {{16, 5, CRF}}}, - {0x4c810421, "bngctrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c810421, - "bngctrl", - }, - {0x4d830420, "bsoctr", {{16, 5, CRF}}}, - {0x4d830420, "bsoctr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d830420, - "bsoctr", - }, - {0x4d830421, "bsoctrl", {{16, 5, CRF}}}, - {0x4d830421, "bsoctrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d830421, - "bsoctrl", - }, - {0x4c830420, "bnsctr", {{16, 5, CRF}}}, - {0x4c830420, "bnsctr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c830420, - "bnsctr", - }, - {0x4c830421, "bnsctrl", {{16, 5, CRF}}}, - {0x4c830421, "bnsctrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c830421, - "bnsctrl", - }, - {0x4d830420, "bunctr", {{16, 5, CRF}}}, - {0x4d830420, "bunctr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d830420, - "bunctr", - }, - {0x4d830421, "bunctrl", {{16, 5, CRF}}}, - {0x4d830421, "bunctrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4d830421, - "bunctrl", - }, - {0x4c830420, "bnuctr", {{16, 5, CRF}}}, - {0x4c830420, "bnuctr", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c830420, - "bnuctr", - }, - {0x4c830421, "bnuctrl", {{16, 5, CRF}}}, - {0x4c830421, "bnuctrl", {{16, 5, CRF}, {11, 2, NUM}}}, - { - 0x4c830421, - "bnuctrl", - }, - - {0x2c000000, "cmpi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, SI}}}, - {0x2c000000, - "cmpi", - {{21, 5, CRFONLY}, {21, 1, NUM}, {16, 5, GREG}, {0, 16, SI}}}, - {0x2c000000, "cmpi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, SI}}}, - {0x2c000000, - "cmpi", - {{23, 3, NUM}, {21, 1, NUM}, {16, 5, GREG}, {0, 16, SI}}}, - {0x2c000000, "cmpwi", {{16, 5, GREG}, {0, 16, SI}}}, - {0x2c000000, "cmpwi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, SI}}}, - {0x2c000000, "cmpwi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, SI}}}, - {0x2c200000, "cmpdi", {{16, 5, GREG}, {0, 16, SI}}}, - {0x2c200000, "cmpdi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, SI}}}, - {0x2c200000, "cmpdi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, SI}}}, - - {0x7c000000, "cmp", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000000, - "cmp", - {{21, 5, CRFONLY}, {21, 1, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000000, "cmp", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000000, - "cmp", - {{23, 3, NUM}, {21, 1, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000000, "cmpw", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000000, "cmpw", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000000, "cmpw", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c200000, "cmpd", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7c200000, "cmpd", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c200000, "cmpd", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x28000000, "cmpli", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, UI}}}, - {0x28000000, - "cmpli", - {{21, 5, CRFONLY}, {21, 1, NUM}, {16, 5, GREG}, {0, 16, UI}}}, - {0x28000000, "cmpli", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, UI}}}, - {0x28000000, - "cmpli", - {{23, 3, NUM}, {21, 1, NUM}, {16, 5, GREG}, {0, 16, UI}}}, - {0x28000000, "cmplwi", {{16, 5, GREG}, {0, 16, UI}}}, - {0x28000000, "cmplwi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, UI}}}, - {0x28000000, "cmplwi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, UI}}}, - {0x28200000, "cmpldi", {{16, 5, GREG}, {0, 16, UI}}}, - {0x28200000, "cmpldi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, UI}}}, - {0x28200000, "cmpldi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, UI}}}, - - {0x7c000040, "cmpl", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000040, - "cmpl", - {{21, 5, CRFONLY}, {21, 1, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000040, "cmpl", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000040, - "cmpl", - {{23, 3, NUM}, {21, 1, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000040, "cmplw", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000040, "cmplw", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000040, "cmplw", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c200040, "cmpld", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7c200040, "cmpld", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c200040, "cmpld", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000034, "cntlzw", {{16, 5, GREG}, {21, 5, GREG}}}, - {0x7c000035, "cntlzw.", {{16, 5, GREG}, {21, 5, GREG}}}, - {0x7c000074, "cntlzd", {{16, 5, GREG}, {21, 5, GREG}}, IMPL64}, - {0x7c000075, "cntlzd.", {{16, 5, GREG}, {21, 5, GREG}}, IMPL64}, - - {0x4c000202, "crand", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, - {0x4c000102, "crandc", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, - {0x4c000242, "creqv", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, - {0x4c0001c2, "crnand", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, - {0x4c000042, "crnor", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, - {0x4c000382, "cror", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, - {0x4c000342, "crorc", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, - {0x4c000182, "crxor", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, - - {0x7c0003d2, "divd", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7c0003d3, - "divd.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c0007d2, - "divdo", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c0007d3, - "divdo.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - - {0x7c000392, - "divdu", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c000393, - "divdu.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c000792, - "divduo", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c000793, - "divduo.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - - {0x7c0003d6, "divw", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c0003d7, "divw.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c0007d6, "divwo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c0007d7, "divwo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000396, "divwu", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000397, "divwu.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000796, "divwuo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000797, "divwuo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000238, "eqv", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000239, "eqv.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000774, "extsb", {{16, 5, GREG}, {21, 5, GREG}}}, - {0x7c000775, "extsb.", {{16, 5, GREG}, {21, 5, GREG}}}, - {0x7c000734, "extsh", {{16, 5, GREG}, {21, 5, GREG}}}, - {0x7c000735, "extsh.", {{16, 5, GREG}, {21, 5, GREG}}}, - {0x7c0007b4, "extsw", {{16, 5, GREG}, {21, 5, GREG}}, IMPL64}, - {0x7c0007b5, "extsw.", {{16, 5, GREG}, {21, 5, GREG}}, IMPL64}, - - {0xfc00002a, "fadd", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xfc00002b, "fadd.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xec00002a, "fadds", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xec00002b, "fadds.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xfc000028, "fsub", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xfc000029, "fsub.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xec000028, "fsubs", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xec000029, "fsubs.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xfc000032, "fmul", {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}}}, - {0xfc000033, "fmul.", {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}}}, - {0xec000032, "fmuls", {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}}}, - {0xec000033, "fmuls.", {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}}}, - {0xfc000024, "fdiv", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xfc000025, "fdiv.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xec000024, "fdivs", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xec000025, "fdivs.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, - - {0xfc00003a, - "fmadd", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xfc00003b, - "fmadd.", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xec00003a, - "fmadds", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xec00003b, - "fmadds.", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xfc000038, - "fmsub", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xfc000039, - "fmsub.", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xec000038, - "fmsubs", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xec000039, - "fmsubs.", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xfc00003e, - "fnmadd", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xfc00003f, - "fnmadd.", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xec00003e, - "fnmadds", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xec00003f, - "fnmadds.", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xfc00003c, - "fnmsub", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xfc00003d, - "fnmsub.", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xec00003c, - "fnmsubs", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xec00003d, - "fnmsubs.", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - - {0xfc000090, "fmr", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000091, "fmr.", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000210, "fabs", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000211, "fabs.", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000050, "fneg", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000051, "fneg.", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000110, "fnabs", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000111, "fnabs.", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xec000030, "fres", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xec000031, "fres.", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000018, "frsp", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000019, "frsp.", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000034, "frsqrte", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc000035, "frsqrte.", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc00002e, - "fsel", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xfc00002f, - "fsel.", - {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, - {0xfc00002c, "fsqrt", {{21, 5, FREG}, {11, 5, FREG}}, OPTIONAL | CPU970}, - {0xfc00002d, "fsqrt.", {{21, 5, FREG}, {11, 5, FREG}}, OPTIONAL | CPU970}, - {0xec00002c, "fsqrts", {{21, 5, FREG}, {11, 5, FREG}}, OPTIONAL | CPU970}, - {0xec00002d, "fsqrts.", {{21, 5, FREG}, {11, 5, FREG}}, OPTIONAL | CPU970}, - {0xfc00065c, "fctid", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, - {0xfc00065d, "fctid.", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, - {0xfc00065e, "fctidz", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, - {0xfc00065f, "fctidz.", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, - {0xfc00001c, "fctiw", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc00001d, "fctiw.", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc00001e, "fctiwz", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc00001f, "fctiwz.", {{21, 5, FREG}, {11, 5, FREG}}}, - {0xfc00069c, "fcfid", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, - {0xfc00069d, "fcfid.", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, - - {0xfc000000, "fcmpu", {{21, 5, CRFONLY}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xfc000000, "fcmpu", {{23, 3, NUM}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xfc000040, "fcmpo", {{21, 5, CRFONLY}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xfc000040, "fcmpo", {{23, 3, NUM}, {16, 5, FREG}, {11, 5, FREG}}}, - {0xfc00048e, "mffs", {{21, 5, FREG}}}, - {0xfc00048f, "mffs.", {{21, 5, FREG}}}, - {0xfc000080, "mcrfs", {{21, 5, CRFONLY}, {18, 5, NUM}}}, - {0xfc000080, "mcrfs", {{23, 3, NUM}, {18, 5, NUM}}}, - {0xfc00010c, "mtfsfi", {{23, 3, NUM}, {12, 4, NUM}}}, - {0xfc00010d, "mtfsfi.", {{23, 3, NUM}, {12, 4, NUM}}}, - {0xfc00058e, "mtfsf", {{17, 8, NUM}, {11, 5, FREG}}}, - {0xfc00058f, "mtfsf.", {{17, 8, NUM}, {11, 5, FREG}}}, - {0xfc00008c, "mtfsb0", {{21, 5, NUM}}}, - {0xfc00008d, "mtfsb0.", {{21, 5, NUM}}}, - {0xfc00004c, "mtfsb1", {{21, 5, NUM}}}, - {0xfc00004d, "mtfsb1.", {{21, 5, NUM}}}, - - {0x88000000, "lbz", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0x7c0000ae, "lbzx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x8c000000, "lbzu", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0x7c0000ee, "lbzux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0xa0000000, "lhz", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0x7c00022e, "lhzx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0xa4000000, "lhzu", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0x7c00026e, "lhzux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0xa8000000, "lha", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0x7c0002ae, "lhax", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0xac000000, "lhau", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, - {0x7c0002ee, "lhaux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x80000000, "lwz", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0x7c00002e, "lwzx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x84000000, "lwzu", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, - {0x7c00006e, "lwzux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0xe8000002, "lwa", {{21, 5, GREG}, {2, 14, DS}, {16, 5, G0REG}}, IMPL64}, - {0x7c0002aa, - "lwax", - {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, - IMPL64}, - {0x7c0002ea, - "lwaux", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0xe8000000, "ld", {{21, 5, GREG}, {2, 14, DS}, {16, 5, G0REG}}, IMPL64}, - {0x7c00002a, "ldx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, IMPL64}, - {0xe8000001, "ldu", {{21, 5, GREG}, {2, 14, DS}, {16, 5, GREG}}, IMPL64}, - {0x7c00006a, "ldux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - - {0xb8000000, "lmw", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0xbc000000, "stmw", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - - {0x7c00062c, "lhbrx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00042c, "lwbrx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00042a, "lswx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c000028, "lwarx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c0000a8, - "ldarx", - {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, - IMPL64}, - - {0x7c00022a, - "lscbx", - {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, - CPU601}, - {0x7c00022b, - "lscbx.", - {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, - CPU601}, - - {0x7c0004aa, "lswi", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, NUM0}}}, - - {0xc0000000, "lfs", {{21, 5, FREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0xc4000000, "lfsu", {{21, 5, FREG}, {0, 16, D}, {16, 5, GREG}}}, - {0x7c00042e, "lfsx", {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00046e, "lfsux", {{21, 5, FREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0xc8000000, "lfd", {{21, 5, FREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0xcc000000, "lfdu", {{21, 5, FREG}, {0, 16, D}, {16, 5, GREG}}}, - {0x7c0004ae, "lfdx", {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c0004ee, "lfdux", {{21, 5, FREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x38000000, "la", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - - {0x4c000000, "mcrf", {{21, 5, CRFONLY}, {16, 5, CRFONLY}}}, - {0x4c000000, "mcrf", {{23, 3, NUM}, {18, 3, NUM}}}, - - {0x7c0002a6, "mfspr", {{21, 5, GREG}, {11, 10, SPREG}}}, - {0x7c0003a6, "mtspr", {{11, 10, SPREG}, {21, 5, GREG}}}, - {0x7c000120, "mtcrf", {{12, 8, FXM}, {21, 5, GREG}}}, - {0x7c000120, "mtocrf", {{12, 8, FXM}, {21, 5, GREG}}}, - {0x7c000400, "mcrxr", {{21, 5, CRFONLY}}}, - {0x7c000400, "mcrxr", {{23, 3, NUM}}}, - {0x7c000026, "mfcr", {{21, 5, GREG}}}, - {0x7c100026, "mfcr", {{21, 5, GREG}, {12, 8, FXM}}}, - {0x7c100026, "mfocrf", {{21, 5, GREG}, {12, 8, FXM}}}, - - /* Move to/from spr mnemonics (assember extended mnemonics) */ - {0x7c0102a6, "mfxer", {{21, 5, GREG}}}, - {0x7c0802a6, "mflr", {{21, 5, GREG}}}, - {0x7c0902a6, "mfctr", {{21, 5, GREG}}}, - {0x7c0103a6, "mtxer", {{21, 5, GREG}}}, - {0x7c0803a6, "mtlr", {{21, 5, GREG}}}, - {0x7c0903a6, "mtctr", {{21, 5, GREG}}}, - {0x7c0002a6, "mfmq", {{21, 5, GREG}}}, - {0x7c0502a6, "mfrtcl", {{21, 5, GREG}}}, - {0x7c0402a6, "mfrtcu", {{21, 5, GREG}}}, - {0x7c0003a6, "mtmq", {{21, 5, GREG}}}, - {0x7c1503a6, "mtrtcl", {{21, 5, GREG}}}, - {0x7c1403a6, "mtrtcu", {{21, 5, GREG}}}, + {0x41800000, "blt", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41800000, "blt", {{2, 14, PCREL}}}, + {0x41800001, "bltl", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41800001, "bltl", {{2, 14, PCREL}}}, + {0x40810000, "ble", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40810000, "ble", {{2, 14, PCREL}}}, + {0x40810001, "blel", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40810001, "blel", {{2, 14, PCREL}}}, + {0x41820000, "beq", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41820000, "beq", {{2, 14, PCREL}}}, + {0x41820001, "beql", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41820001, "beql", {{2, 14, PCREL}}}, + {0x40800000, "bge", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40800000, "bge", {{2, 14, PCREL}}}, + {0x40800001, "bgel", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40800001, "bgel", {{2, 14, PCREL}}}, + {0x41810000, "bgt", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41810000, "bgt", {{2, 14, PCREL}}}, + {0x41810001, "bgtl", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41810001, "bgtl", {{2, 14, PCREL}}}, + {0x40800000, "bnl", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40800000, "bnl", {{2, 14, PCREL}}}, + {0x40800001, "bnll", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40800001, "bnll", {{2, 14, PCREL}}}, + {0x40820000, "bne", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40820000, "bne", {{2, 14, PCREL}}}, + {0x40820001, "bnel", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40820001, "bnel", {{2, 14, PCREL}}}, + {0x40810000, "bng", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40810000, "bng", {{2, 14, PCREL}}}, + {0x40810001, "bngl", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40810001, "bngl", {{2, 14, PCREL}}}, + {0x41830000, "bso", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41830000, "bso", {{2, 14, PCREL}}}, + {0x41830001, "bsol", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41830001, "bsol", {{2, 14, PCREL}}}, + {0x40830000, "bns", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40830000, "bns", {{2, 14, PCREL}}}, + {0x40830001, "bnsl", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40830001, "bnsl", {{2, 14, PCREL}}}, + {0x41830000, "bun", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41830000, "bun", {{2, 14, PCREL}}}, + {0x41830001, "bunl", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x41830001, "bunl", {{2, 14, PCREL}}}, + {0x40830000, "bnu", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40830000, "bnu", {{2, 14, PCREL}}}, + {0x40830001, "bnul", {{16, 5, CRF}, {2, 14, PCREL}}}, + {0x40830001, "bnul", {{2, 14, PCREL}}}, + + {0x41800002, "blta", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41800002, "blta", {{2, 14, BADDR}}}, + {0x41800003, "bltla", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41800003, "bltla", {{2, 14, BADDR}}}, + {0x40810002, "blea", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40810002, "blea", {{2, 14, BADDR}}}, + {0x40810003, "blela", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40810003, "blela", {{2, 14, BADDR}}}, + {0x41820002, "beqa", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41820002, "beqa", {{2, 14, BADDR}}}, + {0x41820003, "beqla", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41820003, "beqla", {{2, 14, BADDR}}}, + {0x40800002, "bgea", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40800002, "bgea", {{2, 14, BADDR}}}, + {0x40800003, "bgela", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40800003, "bgela", {{2, 14, BADDR}}}, + {0x41810002, "bgta", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41810002, "bgta", {{2, 14, BADDR}}}, + {0x41810003, "bgtla", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41810003, "bgtla", {{2, 14, BADDR}}}, + {0x40800002, "bnla", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40800002, "bnla", {{2, 14, BADDR}}}, + {0x40800003, "bnlla", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40800003, "bnlla", {{2, 14, BADDR}}}, + {0x40820002, "bnea", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40820002, "bnea", {{2, 14, BADDR}}}, + {0x40820003, "bnela", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40820003, "bnela", {{2, 14, BADDR}}}, + {0x40810002, "bnga", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40810002, "bnga", {{2, 14, BADDR}}}, + {0x40810003, "bngla", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40810003, "bngla", {{2, 14, BADDR}}}, + {0x41830002, "bsoa", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41830002, "bsoa", {{2, 14, BADDR}}}, + {0x41830003, "bsola", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41830003, "bsola", {{2, 14, BADDR}}}, + {0x40830002, "bnsa", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40830002, "bnsa", {{2, 14, BADDR}}}, + {0x40830003, "bnsla", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40830003, "bnsla", {{2, 14, BADDR}}}, + {0x41830002, "buna", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41830002, "buna", {{2, 14, BADDR}}}, + {0x41830003, "bunla", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x41830003, "bunla", {{2, 14, BADDR}}}, + {0x40830002, "bnua", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40830002, "bnua", {{2, 14, BADDR}}}, + {0x40830003, "bnula", {{16, 5, CRF}, {2, 14, BADDR}}}, + {0x40830003, "bnula", {{2, 14, BADDR}}}, + + {0x4d800020, "bltlr", {{16, 5, CRF}}}, + {0x4d800020, "bltlr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d800020, + "bltlr", + }, + {0x4d800021, "bltlrl", {{16, 5, CRF}}}, + {0x4d800021, "bltlrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d800021, + "bltlrl", + }, + {0x4c810020, "blelr", {{16, 5, CRF}}}, + {0x4c810020, "blelr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c810020, + "blelr", + }, + {0x4c810021, "blelrl", {{16, 5, CRF}}}, + {0x4c810021, "blelrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c810021, + "blelrl", + }, + {0x4d820020, "beqlr", {{16, 5, CRF}}}, + {0x4d820020, "beqlr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d820020, + "beqlr", + }, + {0x4d820021, "beqlrl", {{16, 5, CRF}}}, + {0x4d820021, "beqlrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d820021, + "beqlrl", + }, + {0x4c800020, "bgelr", {{16, 5, CRF}}}, + {0x4c800020, "bgelr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c800020, + "bgelr", + }, + {0x4c800021, "bgelrl", {{16, 5, CRF}}}, + {0x4c800021, "bgelrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c800021, + "bgelrl", + }, + {0x4d810020, "bgtlr", {{16, 5, CRF}}}, + {0x4d810020, "bgtlr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d810020, + "bgtlr", + }, + {0x4d810021, "bgtlrl", {{16, 5, CRF}}}, + {0x4d810021, "bgtlrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d810021, + "bgtlrl", + }, + {0x4c800020, "bnllr", {{16, 5, CRF}}}, + {0x4c800020, "bnllr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c800020, + "bnllr", + }, + {0x4c800021, "bnllrl", {{16, 5, CRF}}}, + {0x4c800021, "bnllrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c800021, + "bnllrl", + }, + {0x4c820020, "bnelr", {{16, 5, CRF}}}, + {0x4c820020, "bnelr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c820020, + "bnelr", + }, + {0x4c820021, "bnelrl", {{16, 5, CRF}}}, + {0x4c820021, "bnelrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c820021, + "bnelrl", + }, + {0x4c810020, "bnglr", {{16, 5, CRF}}}, + {0x4c810020, "bnglr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c810020, + "bnglr", + }, + {0x4c810021, "bnglrl", {{16, 5, CRF}}}, + {0x4c810021, "bnglrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c810021, + "bnglrl", + }, + {0x4d830020, "bsolr", {{16, 5, CRF}}}, + {0x4d830020, "bsolr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d830020, + "bsolr", + }, + {0x4d830021, "bsolrl", {{16, 5, CRF}}}, + {0x4d830021, "bsolrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d830021, + "bsolrl", + }, + {0x4c830020, "bnslr", {{16, 5, CRF}}}, + {0x4c830020, "bnslr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c830020, + "bnslr", + }, + {0x4c830021, "bnslrl", {{16, 5, CRF}}}, + {0x4c830021, "bnslrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c830021, + "bnslrl", + }, + {0x4d830020, "bunlr", {{16, 5, CRF}}}, + {0x4d830020, "bunlr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d830020, + "bunlr", + }, + {0x4d830021, "bunlrl", {{16, 5, CRF}}}, + {0x4d830021, "bunlrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d830021, + "bunlrl", + }, + {0x4c830020, "bnulr", {{16, 5, CRF}}}, + {0x4c830020, "bnulr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c830020, + "bnulr", + }, + {0x4c830021, "bnulrl", {{16, 5, CRF}}}, + {0x4c830021, "bnulrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c830021, + "bnulrl", + }, + + {0x4d800420, "bltctr", {{16, 5, CRF}}}, + {0x4d800420, "bltctr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d800420, + "bltctr", + }, + {0x4d800421, "bltctrl", {{16, 5, CRF}}}, + {0x4d800421, "bltctrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d800421, + "bltctrl", + }, + {0x4c810420, "blectr", {{16, 5, CRF}}}, + {0x4c810420, "blectr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c810420, + "blectr", + }, + {0x4c810421, "blectrl", {{16, 5, CRF}}}, + {0x4c810421, "blectrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c810421, + "blectrl", + }, + {0x4d820420, "beqctr", {{16, 5, CRF}}}, + {0x4d820420, "beqctr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d820420, + "beqctr", + }, + {0x4d820421, "beqctrl", {{16, 5, CRF}}}, + {0x4d820421, "beqctrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d820421, + "beqctrl", + }, + {0x4c800420, "bgectr", {{16, 5, CRF}}}, + {0x4c800420, "bgectr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c800420, + "bgectr", + }, + {0x4c800421, "bgectrl", {{16, 5, CRF}}}, + {0x4c800421, "bgectrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c800421, + "bgectrl", + }, + {0x4d810420, "bgtctr", {{16, 5, CRF}}}, + {0x4d810420, "bgtctr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d810420, + "bgtctr", + }, + {0x4d810421, "bgtctrl", {{16, 5, CRF}}}, + {0x4d810421, "bgtctrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d810421, + "bgtctrl", + }, + {0x4c800420, "bnlctr", {{16, 5, CRF}}}, + {0x4c800420, "bnlctr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c800420, + "bnlctr", + }, + {0x4c800421, "bnlctrl", {{16, 5, CRF}}}, + {0x4c800421, "bnlctrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c800421, + "bnlctrl", + }, + {0x4c820420, "bnectr", {{16, 5, CRF}}}, + {0x4c820420, "bnectr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c820420, + "bnectr", + }, + {0x4c820421, "bnectrl", {{16, 5, CRF}}}, + {0x4c820421, "bnectrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c820421, + "bnectrl", + }, + {0x4c810420, "bngctr", {{16, 5, CRF}}}, + {0x4c810420, "bngctr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c810420, + "bngctr", + }, + {0x4c810421, "bngctrl", {{16, 5, CRF}}}, + {0x4c810421, "bngctrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c810421, + "bngctrl", + }, + {0x4d830420, "bsoctr", {{16, 5, CRF}}}, + {0x4d830420, "bsoctr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d830420, + "bsoctr", + }, + {0x4d830421, "bsoctrl", {{16, 5, CRF}}}, + {0x4d830421, "bsoctrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d830421, + "bsoctrl", + }, + {0x4c830420, "bnsctr", {{16, 5, CRF}}}, + {0x4c830420, "bnsctr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c830420, + "bnsctr", + }, + {0x4c830421, "bnsctrl", {{16, 5, CRF}}}, + {0x4c830421, "bnsctrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c830421, + "bnsctrl", + }, + {0x4d830420, "bunctr", {{16, 5, CRF}}}, + {0x4d830420, "bunctr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d830420, + "bunctr", + }, + {0x4d830421, "bunctrl", {{16, 5, CRF}}}, + {0x4d830421, "bunctrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4d830421, + "bunctrl", + }, + {0x4c830420, "bnuctr", {{16, 5, CRF}}}, + {0x4c830420, "bnuctr", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c830420, + "bnuctr", + }, + {0x4c830421, "bnuctrl", {{16, 5, CRF}}}, + {0x4c830421, "bnuctrl", {{16, 5, CRF}, {11, 2, NUM}}}, + { + 0x4c830421, + "bnuctrl", + }, + + {0x2c000000, "cmpi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, SI}}}, + {0x2c000000, + "cmpi", + {{21, 5, CRFONLY}, {21, 1, NUM}, {16, 5, GREG}, {0, 16, SI}}}, + {0x2c000000, "cmpi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, SI}}}, + {0x2c000000, + "cmpi", + {{23, 3, NUM}, {21, 1, NUM}, {16, 5, GREG}, {0, 16, SI}}}, + {0x2c000000, "cmpwi", {{16, 5, GREG}, {0, 16, SI}}}, + {0x2c000000, "cmpwi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, SI}}}, + {0x2c000000, "cmpwi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, SI}}}, + {0x2c200000, "cmpdi", {{16, 5, GREG}, {0, 16, SI}}}, + {0x2c200000, "cmpdi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, SI}}}, + {0x2c200000, "cmpdi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, SI}}}, + + {0x7c000000, "cmp", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000000, + "cmp", + {{21, 5, CRFONLY}, {21, 1, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000000, "cmp", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000000, + "cmp", + {{23, 3, NUM}, {21, 1, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000000, "cmpw", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000000, "cmpw", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000000, "cmpw", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c200000, "cmpd", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7c200000, "cmpd", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c200000, "cmpd", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x28000000, "cmpli", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, UI}}}, + {0x28000000, + "cmpli", + {{21, 5, CRFONLY}, {21, 1, NUM}, {16, 5, GREG}, {0, 16, UI}}}, + {0x28000000, "cmpli", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, UI}}}, + {0x28000000, + "cmpli", + {{23, 3, NUM}, {21, 1, NUM}, {16, 5, GREG}, {0, 16, UI}}}, + {0x28000000, "cmplwi", {{16, 5, GREG}, {0, 16, UI}}}, + {0x28000000, "cmplwi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, UI}}}, + {0x28000000, "cmplwi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, UI}}}, + {0x28200000, "cmpldi", {{16, 5, GREG}, {0, 16, UI}}}, + {0x28200000, "cmpldi", {{21, 5, CRFONLY}, {16, 5, GREG}, {0, 16, UI}}}, + {0x28200000, "cmpldi", {{23, 3, NUM}, {16, 5, GREG}, {0, 16, UI}}}, + + {0x7c000040, "cmpl", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000040, + "cmpl", + {{21, 5, CRFONLY}, {21, 1, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000040, "cmpl", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000040, + "cmpl", + {{23, 3, NUM}, {21, 1, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000040, "cmplw", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000040, "cmplw", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000040, "cmplw", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c200040, "cmpld", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7c200040, "cmpld", {{21, 5, CRFONLY}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c200040, "cmpld", {{23, 3, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000034, "cntlzw", {{16, 5, GREG}, {21, 5, GREG}}}, + {0x7c000035, "cntlzw.", {{16, 5, GREG}, {21, 5, GREG}}}, + {0x7c000074, "cntlzd", {{16, 5, GREG}, {21, 5, GREG}}, IMPL64}, + {0x7c000075, "cntlzd.", {{16, 5, GREG}, {21, 5, GREG}}, IMPL64}, + + {0x4c000202, "crand", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, + {0x4c000102, "crandc", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, + {0x4c000242, "creqv", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, + {0x4c0001c2, "crnand", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, + {0x4c000042, "crnor", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, + {0x4c000382, "cror", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, + {0x4c000342, "crorc", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, + {0x4c000182, "crxor", {{21, 5, NUM}, {16, 5, NUM}, {11, 5, NUM}}}, + + {0x7c0003d2, "divd", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7c0003d3, + "divd.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c0007d2, + "divdo", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c0007d3, + "divdo.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + + {0x7c000392, + "divdu", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c000393, + "divdu.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c000792, + "divduo", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c000793, + "divduo.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + + {0x7c0003d6, "divw", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0003d7, "divw.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0007d6, "divwo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0007d7, "divwo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000396, "divwu", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000397, "divwu.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000796, "divwuo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000797, "divwuo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000238, "eqv", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000239, "eqv.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000774, "extsb", {{16, 5, GREG}, {21, 5, GREG}}}, + {0x7c000775, "extsb.", {{16, 5, GREG}, {21, 5, GREG}}}, + {0x7c000734, "extsh", {{16, 5, GREG}, {21, 5, GREG}}}, + {0x7c000735, "extsh.", {{16, 5, GREG}, {21, 5, GREG}}}, + {0x7c0007b4, "extsw", {{16, 5, GREG}, {21, 5, GREG}}, IMPL64}, + {0x7c0007b5, "extsw.", {{16, 5, GREG}, {21, 5, GREG}}, IMPL64}, + + {0xfc00002a, "fadd", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xfc00002b, "fadd.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xec00002a, "fadds", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xec00002b, "fadds.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xfc000028, "fsub", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xfc000029, "fsub.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xec000028, "fsubs", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xec000029, "fsubs.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xfc000032, "fmul", {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}}}, + {0xfc000033, "fmul.", {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}}}, + {0xec000032, "fmuls", {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}}}, + {0xec000033, "fmuls.", {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}}}, + {0xfc000024, "fdiv", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xfc000025, "fdiv.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xec000024, "fdivs", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xec000025, "fdivs.", {{21, 5, FREG}, {16, 5, FREG}, {11, 5, FREG}}}, + + {0xfc00003a, + "fmadd", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xfc00003b, + "fmadd.", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xec00003a, + "fmadds", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xec00003b, + "fmadds.", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xfc000038, + "fmsub", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xfc000039, + "fmsub.", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xec000038, + "fmsubs", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xec000039, + "fmsubs.", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xfc00003e, + "fnmadd", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xfc00003f, + "fnmadd.", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xec00003e, + "fnmadds", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xec00003f, + "fnmadds.", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xfc00003c, + "fnmsub", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xfc00003d, + "fnmsub.", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xec00003c, + "fnmsubs", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xec00003d, + "fnmsubs.", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + + {0xfc000090, "fmr", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000091, "fmr.", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000210, "fabs", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000211, "fabs.", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000050, "fneg", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000051, "fneg.", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000110, "fnabs", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000111, "fnabs.", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xec000030, "fres", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xec000031, "fres.", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000018, "frsp", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000019, "frsp.", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000034, "frsqrte", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc000035, "frsqrte.", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc00002e, + "fsel", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xfc00002f, + "fsel.", + {{21, 5, FREG}, {16, 5, FREG}, {6, 5, FREG}, {11, 5, FREG}}}, + {0xfc00002c, "fsqrt", {{21, 5, FREG}, {11, 5, FREG}}, OPTIONAL | CPU970}, + {0xfc00002d, "fsqrt.", {{21, 5, FREG}, {11, 5, FREG}}, OPTIONAL | CPU970}, + {0xec00002c, "fsqrts", {{21, 5, FREG}, {11, 5, FREG}}, OPTIONAL | CPU970}, + {0xec00002d, "fsqrts.", {{21, 5, FREG}, {11, 5, FREG}}, OPTIONAL | CPU970}, + {0xfc00065c, "fctid", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, + {0xfc00065d, "fctid.", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, + {0xfc00065e, "fctidz", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, + {0xfc00065f, "fctidz.", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, + {0xfc00001c, "fctiw", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc00001d, "fctiw.", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc00001e, "fctiwz", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc00001f, "fctiwz.", {{21, 5, FREG}, {11, 5, FREG}}}, + {0xfc00069c, "fcfid", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, + {0xfc00069d, "fcfid.", {{21, 5, FREG}, {11, 5, FREG}}, IMPL64}, + + {0xfc000000, "fcmpu", {{21, 5, CRFONLY}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xfc000000, "fcmpu", {{23, 3, NUM}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xfc000040, "fcmpo", {{21, 5, CRFONLY}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xfc000040, "fcmpo", {{23, 3, NUM}, {16, 5, FREG}, {11, 5, FREG}}}, + {0xfc00048e, "mffs", {{21, 5, FREG}}}, + {0xfc00048f, "mffs.", {{21, 5, FREG}}}, + {0xfc000080, "mcrfs", {{21, 5, CRFONLY}, {18, 5, NUM}}}, + {0xfc000080, "mcrfs", {{23, 3, NUM}, {18, 5, NUM}}}, + {0xfc00010c, "mtfsfi", {{23, 3, NUM}, {12, 4, NUM}}}, + {0xfc00010d, "mtfsfi.", {{23, 3, NUM}, {12, 4, NUM}}}, + {0xfc00058e, "mtfsf", {{17, 8, NUM}, {11, 5, FREG}}}, + {0xfc00058f, "mtfsf.", {{17, 8, NUM}, {11, 5, FREG}}}, + {0xfc00008c, "mtfsb0", {{21, 5, NUM}}}, + {0xfc00008d, "mtfsb0.", {{21, 5, NUM}}}, + {0xfc00004c, "mtfsb1", {{21, 5, NUM}}}, + {0xfc00004d, "mtfsb1.", {{21, 5, NUM}}}, + + {0x88000000, "lbz", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0x7c0000ae, "lbzx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x8c000000, "lbzu", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0x7c0000ee, "lbzux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0xa0000000, "lhz", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0x7c00022e, "lhzx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0xa4000000, "lhzu", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0x7c00026e, "lhzux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0xa8000000, "lha", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0x7c0002ae, "lhax", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0xac000000, "lhau", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, + {0x7c0002ee, "lhaux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x80000000, "lwz", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0x7c00002e, "lwzx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x84000000, "lwzu", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, + {0x7c00006e, "lwzux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0xe8000002, "lwa", {{21, 5, GREG}, {2, 14, DS}, {16, 5, G0REG}}, IMPL64}, + {0x7c0002aa, + "lwax", + {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, + IMPL64}, + {0x7c0002ea, + "lwaux", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0xe8000000, "ld", {{21, 5, GREG}, {2, 14, DS}, {16, 5, G0REG}}, IMPL64}, + {0x7c00002a, "ldx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, IMPL64}, + {0xe8000001, "ldu", {{21, 5, GREG}, {2, 14, DS}, {16, 5, GREG}}, IMPL64}, + {0x7c00006a, "ldux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + + {0xb8000000, "lmw", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0xbc000000, "stmw", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + + {0x7c00062c, "lhbrx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00042c, "lwbrx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00042a, "lswx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c000028, "lwarx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c0000a8, + "ldarx", + {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, + IMPL64}, + + {0x7c00022a, + "lscbx", + {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, + CPU601}, + {0x7c00022b, + "lscbx.", + {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, + CPU601}, + + {0x7c0004aa, "lswi", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, NUM0}}}, + + {0xc0000000, "lfs", {{21, 5, FREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0xc4000000, "lfsu", {{21, 5, FREG}, {0, 16, D}, {16, 5, GREG}}}, + {0x7c00042e, "lfsx", {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00046e, "lfsux", {{21, 5, FREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0xc8000000, "lfd", {{21, 5, FREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0xcc000000, "lfdu", {{21, 5, FREG}, {0, 16, D}, {16, 5, GREG}}}, + {0x7c0004ae, "lfdx", {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c0004ee, "lfdux", {{21, 5, FREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x38000000, "la", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + + {0x4c000000, "mcrf", {{21, 5, CRFONLY}, {16, 5, CRFONLY}}}, + {0x4c000000, "mcrf", {{23, 3, NUM}, {18, 3, NUM}}}, + + {0x7c0002a6, "mfspr", {{21, 5, GREG}, {11, 10, SPREG}}}, + {0x7c0003a6, "mtspr", {{11, 10, SPREG}, {21, 5, GREG}}}, + {0x7c000120, "mtcrf", {{12, 8, FXM}, {21, 5, GREG}}}, + {0x7c000120, "mtocrf", {{12, 8, FXM}, {21, 5, GREG}}}, + {0x7c000400, "mcrxr", {{21, 5, CRFONLY}}}, + {0x7c000400, "mcrxr", {{23, 3, NUM}}}, + {0x7c000026, "mfcr", {{21, 5, GREG}}}, + {0x7c100026, "mfcr", {{21, 5, GREG}, {12, 8, FXM}}}, + {0x7c100026, "mfocrf", {{21, 5, GREG}, {12, 8, FXM}}}, + + /* Move to/from spr mnemonics (assember extended mnemonics) */ + {0x7c0102a6, "mfxer", {{21, 5, GREG}}}, + {0x7c0802a6, "mflr", {{21, 5, GREG}}}, + {0x7c0902a6, "mfctr", {{21, 5, GREG}}}, + {0x7c0103a6, "mtxer", {{21, 5, GREG}}}, + {0x7c0803a6, "mtlr", {{21, 5, GREG}}}, + {0x7c0903a6, "mtctr", {{21, 5, GREG}}}, + {0x7c0002a6, "mfmq", {{21, 5, GREG}}}, + {0x7c0502a6, "mfrtcl", {{21, 5, GREG}}}, + {0x7c0402a6, "mfrtcu", {{21, 5, GREG}}}, + {0x7c0003a6, "mtmq", {{21, 5, GREG}}}, + {0x7c1503a6, "mtrtcl", {{21, 5, GREG}}}, + {0x7c1403a6, "mtrtcu", {{21, 5, GREG}}}, #ifdef NRW_COMPILER - {0x7c0001d6, "mull", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c0001d7, "mull.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c0005d6, "mullo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c0005d7, "mullo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0001d6, "mull", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0001d7, "mull.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0005d6, "mullo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0005d7, "mullo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, #endif /* NRW_COMPILER */ - {0x7c0001d6, "mullw", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c0001d7, "mullw.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c0005d6, "mullwo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c0005d7, "mullwo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000092, - "mulhd", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c000093, - "mulhd.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, + {0x7c0001d6, "mullw", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0001d7, "mullw.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0005d6, "mullwo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c0005d7, "mullwo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000092, + "mulhd", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c000093, + "mulhd.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, #ifdef NRW_COMPILER - {0x7c000096, "mulwd", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000097, "mulwd.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000096, "mulwd", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000097, "mulwd.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, #endif /* NRW_COMPILER */ - {0x7c000096, "mulhw", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000097, "mulhw.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000012, - "mulhdu", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c000013, - "mulhdu.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - - {0x7c000016, "mulhwu", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000017, "mulhwu.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c0001d2, - "mulld", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c0001d3, - "mulld.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c0005d2, - "mulldo", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - {0x7c0005d3, - "mulldo.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - - {0x7c0003b8, "nand", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c0003b9, "nand.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - - {0x7c0000d0, "neg", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c0000d1, "neg.", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c0004d0, "nego", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c0004d1, "nego.", {{21, 5, GREG}, {16, 5, GREG}}}, - - {0x7c0000f8, "nor", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c0000f9, "nor.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - - /* Miscellaneous mnemonics (assember extended mnemonics) */ - { - 0x60000000, - "nop", - }, - - {0x60000000, "ori", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, - {0x60000000, "ori", {{16, 5, ZERO}, {21, 5, ZERO}, {0, 16, ZERO}}}, - {0x64000000, "oris", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, - {0x7c000378, "or", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000379, "or.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - - /// @brief Move register - {0x7c000378, "mr", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000338, "orc", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000339, "orc.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - - {0x78000000, - "rldicl", - {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, - IMPL64}, - {0x78000001, - "rldicl.", - {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, - IMPL64}, - {0x78000004, - "rldicr", - {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, - IMPL64}, - {0x78000005, - "rldicr.", - {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, - IMPL64}, - {0x78000008, - "rldic", - {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, - IMPL64}, - {0x78000009, - "rldic.", - {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, - IMPL64}, - {0x7800000c, - "rldimi", - {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, - IMPL64}, - {0x7800000d, - "rldimi.", - {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, - IMPL64}, - {0x78000010, - "rldcl", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {0, 0, mb}}, - IMPL64}, - {0x78000011, - "rldcl.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {0, 0, mb}}, - IMPL64}, - {0x78000012, - "rldcr", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {0, 0, mb}}, - IMPL64}, - {0x78000013, - "rldcr.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {0, 0, mb}}, - IMPL64}, - - {0x54000000, - "rlwinm", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM0}, {6, 5, MBE}, {1, 5, MBE}}}, - {0x54000001, - "rlwinm.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM0}, {6, 5, MBE}, {1, 5, MBE}}}, - {0x5c000000, - "rlwnm", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {6, 5, MBE}, {1, 5, MBE}}}, - {0x5c000001, - "rlwnm.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {6, 5, MBE}, {1, 5, MBE}}}, - {0x50000000, - "rlwimi", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM0}, {6, 5, MBE}, {1, 5, MBE}}}, - {0x50000001, - "rlwimi.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM0}, {6, 5, MBE}, {1, 5, MBE}}}, - - { - 0x44000002, - "sc", - }, - {0x4c000024, "rfid", {{0}}, IMPL64 | OPTIONAL}, - - {0x7c000030, "slw", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000031, "slw.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000036, "sld", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7c000037, "sld.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, - - {0x7c000430, "srw", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000431, "srw.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000436, "srd", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7c000437, "srd.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, - - {0x7c000670, "srawi", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}}, - {0x7c000671, "srawi.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}}, - {0x7c000674, "sradi", {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}}, IMPL64}, - {0x7c000675, "sradi.", {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}}, IMPL64}, - - {0x7c000630, "sraw", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000631, "sraw.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000634, "srad", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7c000635, - "srad.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - - {0x98000000, "stb", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0x9c000000, "stbu", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, - {0x7c0001ae, "stbx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c0001ee, "stbux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0xb0000000, "sth", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0xb4000000, "sthu", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, - {0x7c00032e, "sthx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00036e, "sthux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x90000000, "stw", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0x94000000, "stwu", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, - {0x7c00012e, "stwx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00016e, "stwux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0xf8000000, "std", {{21, 5, GREG}, {2, 14, DS}, {16, 5, G0REG}}, IMPL64}, - {0xf8000001, "stdu", {{21, 5, GREG}, {2, 14, DS}, {16, 5, GREG}}, IMPL64}, - {0x7c00012a, - "stdx", - {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, - IMPL64}, - {0x7c00016a, - "stdux", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - IMPL64}, - - {0x7c00072c, "sthbrx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00052c, "stwbrx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00052a, "stswx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00012d, "stwcx.", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c0001ad, - "stdcx.", - {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, - IMPL64}, - - {0x7c0005aa, "stswi", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, NUM0}}}, - - { - 0x7c0007ae, - "stfiwx", - {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}, - }, - - {0xd0000000, "stfs", {{21, 5, FREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0xd4000000, "stfsu", {{21, 5, FREG}, {0, 16, D}, {16, 5, GREG}}}, - {0x7c00052e, "stfsx", {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00056e, "stfsux", {{21, 5, FREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0xd8000000, "stfd", {{21, 5, FREG}, {0, 16, D}, {16, 5, G0REG}}}, - {0xdc000000, "stfdu", {{21, 5, FREG}, {0, 16, D}, {16, 5, GREG}}}, - {0x7c0005ae, "stfdx", {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c0005ee, "stfdux", {{21, 5, FREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x20000000, "subfic", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}}, - {0x7c000050, "sub", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, - {0x7c000051, "sub.", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, - {0x7c000450, "subo", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, - {0x7c000451, "subo.", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, - {0x7c000050, "subf", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000051, "subf.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000450, "subfo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000451, "subfo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000010, "subc", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, - {0x7c000011, "subc.", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, - {0x7c000410, "subco", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, - {0x7c000411, "subco.", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, - {0x7c000010, "subfc", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000011, "subfc.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000410, "subfco", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000411, "subfco.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c000110, "subfe", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000111, "subfe.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000510, "subfeo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000511, "subfeo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, - - {0x7c0001d0, "subfme", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c0001d1, "subfme.", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c0005d0, "subfmeo", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c0005d1, "subfmeo.", {{21, 5, GREG}, {16, 5, GREG}}}, - - {0x7c000190, "subfze", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c000191, "subfze.", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c000590, "subfzeo", {{21, 5, GREG}, {16, 5, GREG}}}, - {0x7c000591, "subfzeo.", {{21, 5, GREG}, {16, 5, GREG}}}, - - { - 0x7c0004ac, - "sync", - }, - {0x7c0004ac, "sync", {{21, 2, NUM}}}, - { - 0x7c2004ac, - "lwsync", - }, - { - 0x7c4004ac, - "ptesync", - }, - - {0x08000000, "tdi", {{21, 5, NUM}, {16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x0a000000, "tdlti", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x0a800000, "tdlei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x08800000, "tdeqi", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x09800000, "tdgei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x09000000, "tdgti", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x09800000, "tdnli", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x0b000000, "tdnei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x0a800000, "tdngi", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x08400000, "tdllti", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x08c00000, "tdllei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x08a00000, "tdlgei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x08200000, "tdlgti", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x08a00000, "tdlnli", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - {0x08c00000, "tdlngi", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, - - {0x7c000088, "td", {{21, 5, NUM}, {16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7e000088, "tdlt", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7e800088, "tdle", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7c800088, "tdeq", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7d800088, "tdge", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7d000088, "tdgt", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7d800088, "tdnl", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7f000088, "tdne", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7e800088, "tdng", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7c400088, "tdllt", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7cc00088, "tdlle", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7ca00088, "tdlge", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7c200088, "tdlgt", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7ca00088, "tdlnl", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - {0x7cc00088, "tdlng", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, - - {0x0c000000, "twi", {{21, 5, NUM}, {16, 5, GREG}, {0, 16, SI}}}, - {0x0e000000, "twlti", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0e800000, "twlei", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0c800000, "tweqi", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0d800000, "twgei", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0d000000, "twgti", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0d800000, "twnli", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0f000000, "twnei", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0e800000, "twngi", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0c400000, "twllti", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0cc00000, "twllei", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0ca00000, "twlgei", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0c200000, "twlgti", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0ca00000, "twlnli", {{16, 5, GREG}, {0, 16, SI}}}, - {0x0cc00000, "twlngi", {{16, 5, GREG}, {0, 16, SI}}}, - - {0x7c000008, "tw", {{21, 5, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, - {0x7c000008, "tw", {{21, 5, NUM}, {16, 5, ZERO}, {11, 5, ZERO}}}, - {0x7e000008, "twlt", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7e800008, "twle", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7c800008, "tweq", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7d800008, "twge", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7d000008, "twgt", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7d800008, "twnl", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7f000008, "twne", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7e800008, "twng", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7c400008, "twllt", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7cc00008, "twlle", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7ca00008, "twlge", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7c200008, "twlgt", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7ca00008, "twlnl", {{16, 5, GREG}, {11, 5, GREG}}}, - {0x7cc00008, "twlng", {{16, 5, GREG}, {11, 5, GREG}}}, - { - 0x7fe00008, - "trap", - }, - - {0x68000000, "xori", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, - {0x6c000000, "xoris", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, - {0x7c000278, "xor", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000279, "xor.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, - - /* Cache Management Instructions (from book II) */ - {0x7c0007ac, "icbi", {{16, 5, G0REG}, {11, 5, GREG}}}, - { - 0x4c00012c, - "isync", - }, - {0x7c00022c, "dcbt", {{16, 5, G0REG}, {11, 5, GREG}}}, - { - 0x7c00022c, - "dcbt", - {{16, 5, G0REG}, {11, 5, GREG}, {21, 4, NUM}}, - }, - {0x7c0001ec, "dcbtst", {{16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00022c, - "dcbt128", - {{16, 5, G0REG}, {11, 5, GREG}, {21, 4, NUM}}, - IMPL64 | OPTIONAL}, - {0x7c0007ec, "dcbz", {{16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c2007ec, "dcbzl", {{16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c2007ec, "dcbz128", {{16, 5, G0REG}, {11, 5, GREG}}, IMPL64 | OPTIONAL}, - {0x7c00006c, "dcbst", {{16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c0000ac, "dcbf", {{16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c00026c, - "eciwx", - {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, - OPTIONAL | CPU970}, - {0x7c00036c, - "ecowx", - {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, - OPTIONAL | CPU970}, - { - 0x7c0006ac, - "eieio", - }, - /* Instructions (from book III) */ - { - 0x4c000064, - "rfi", - }, - {0x7c000124, "mtmsr", {{21, 5, GREG}}}, - {0x7c000164, "mtmsrd", {{21, 5, GREG}}, IMPL64 | OPTIONAL}, - {0x7c000164, "mtmsrd", {{21, 5, GREG}, {16, 1, NUM}}, IMPL64 | OPTIONAL}, - {0x7c0000a6, "mfmsr", {{21, 5, GREG}}}, - {0x7c0005ec, "dcba", {{16, 5, G0REG}, {11, 5, GREG}}, OPTIONAL}, - {0x7c0003ac, "dcbi", {{16, 5, G0REG}, {11, 5, GREG}}}, - {0x7c0001a4, "mtsr", {{16, 4, SGREG}, {21, 5, GREG}}}, - {0x7c0004a6, "mfsr", {{21, 5, GREG}, {16, 4, SGREG}}}, - {0x7c0001e4, "mtsrin", {{21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000526, "mfsrin", {{21, 5, GREG}, {11, 5, GREG}}}, - {0x7c000364, "slbie", {{11, 5, GREG}}, IMPL64 | OPTIONAL}, - {0x7c0003e4, "slbia", {{0}}, IMPL64 | OPTIONAL}, - {0x7c000324, "slbmte", {{21, 5, GREG}, {11, 5, GREG}}, IMPL64 | OPTIONAL}, - {0x7c0006a6, "slbmfev", {{21, 5, GREG}, {11, 5, GREG}}, IMPL64 | OPTIONAL}, - {0x7c000726, "slbmfee", {{21, 5, GREG}, {11, 5, GREG}}, IMPL64 | OPTIONAL}, - {0x7c000264, "tlbie", {{11, 5, GREG}}, OPTIONAL | CPU970}, - {0x7c000264, - "tlbie", - {{11, 5, GREG}, {21, 1, NUM}}, - IMPL64 | OPTIONAL | CPU970}, - {0x7c000224, "tlbiel", {{11, 5, GREG}}, IMPL64 | OPTIONAL}, - {0x7c0002e4, "tlbia", {{0}}, OPTIONAL | CPU970}, - {0x7c00046c, "tlbsync", {{0}}, OPTIONAL | CPU970}, - {0x7c1c43a6, "mttbl", {{21, 5, GREG}}}, - {0x7c1d43a6, "mttbu", {{21, 5, GREG}}}, - {0x7c0002e6, "mftb", {{21, 5, GREG}, {11, 10, SPREG}}}, - {0x7c0c42e6, "mftb", {{21, 5, GREG}}}, - {0x7c0d42e6, "mftbu", {{21, 5, GREG}}}, - {0x00000200, "attn", {{11, 15, NUM}}, OPTIONAL | CPU970}, - - /* Instructions (from book IV) */ - {0x24000000, "dozi", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}, CPU601}, - {0x7c000210, "doz", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000211, "doz.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000610, "dozo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000611, - "dozo.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c0002d0, "abs", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, - {0x7c0002d1, "abs.", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, - {0x7c0006d0, "abso", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, - {0x7c0006d1, "abso.", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, - - {0x7c0003d0, "nabs", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, - {0x7c0003d1, "nabs.", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, - {0x7c0007d0, "nabso", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, - {0x7c0007d1, "nabso.", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, - - {0x1c000000, "mulli", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}}, - - {0x7c0000d6, "mul", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c0000d7, "mul.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c0004d6, "mulo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c0004d7, - "mulo.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c000296, "div", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000297, "div.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000696, "divo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000697, - "divo.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c0002d6, "divs", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c0002d7, - "divs.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - CPU601}, - {0x7c0006d6, - "divso", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - CPU601}, - {0x7c0006d7, - "divso.", - {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x58000000, - "rlmi", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {6, 5, MBE}, {1, 5, MBE}}, - CPU601}, - {0x58000001, - "rlmi.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {6, 5, MBE}, {1, 5, MBE}}, - CPU601}, - - {0x7c000432, "rrib", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000433, - "rrib.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c00003a, - "maskg", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - {0x7c00003b, - "maskg.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c00043a, - "maskir", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - {0x7c00043b, - "maskir.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c000130, "slq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000131, "slq.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - - {0x7c000530, "srq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000531, "srq.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - - {0x7c000170, "sliq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, - {0x7c000171, "sliq.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, - - {0x7c000570, "sriq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, - {0x7c000571, "sriq.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, - - {0x7c0001f0, "slliq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, - {0x7c0001f1, - "slliq.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, - CPU601}, - - {0x7c0005f0, "srliq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, - {0x7c0005f1, - "srliq.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, - CPU601}, - - {0x7c0001b0, "sllq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c0001b1, - "sllq.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c0005b0, "srlq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c0005b1, - "srlq.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c000132, "sle", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000133, "sle.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - - {0x7c000532, "sre", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000533, "sre.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - - {0x7c0001b2, "sleq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c0001b3, - "sleq.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c0005b2, "sreq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c0005b3, - "sreq.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c000770, "sraiq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, - {0x7c000771, - "sraiq.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, - CPU601}, - - {0x7c000730, "sraq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000731, - "sraq.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - {0x7c000732, "srea", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, - {0x7c000733, - "srea.", - {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, - CPU601}, - - /* Added from the POWER 601 book */ - {0x7c000426, "clcs", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, - - /* Added from the POWER 603 book. + {0x7c000096, "mulhw", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000097, "mulhw.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000012, + "mulhdu", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c000013, + "mulhdu.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + + {0x7c000016, "mulhwu", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000017, "mulhwu.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c0001d2, + "mulld", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c0001d3, + "mulld.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c0005d2, + "mulldo", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + {0x7c0005d3, + "mulldo.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + + {0x7c0003b8, "nand", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c0003b9, "nand.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + + {0x7c0000d0, "neg", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c0000d1, "neg.", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c0004d0, "nego", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c0004d1, "nego.", {{21, 5, GREG}, {16, 5, GREG}}}, + + {0x7c0000f8, "nor", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c0000f9, "nor.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + + /* Miscellaneous mnemonics (assember extended mnemonics) */ + { + 0x60000000, + "nop", + }, + + {0x60000000, "ori", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, + {0x60000000, "ori", {{16, 5, ZERO}, {21, 5, ZERO}, {0, 16, ZERO}}}, + {0x64000000, "oris", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, + {0x7c000378, "or", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000379, "or.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + + /// @brief Move register + {0x7c000378, "mr", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000338, "orc", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000339, "orc.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + + {0x78000000, + "rldicl", + {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, + IMPL64}, + {0x78000001, + "rldicl.", + {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, + IMPL64}, + {0x78000004, + "rldicr", + {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, + IMPL64}, + {0x78000005, + "rldicr.", + {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, + IMPL64}, + {0x78000008, + "rldic", + {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, + IMPL64}, + {0x78000009, + "rldic.", + {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, + IMPL64}, + {0x7800000c, + "rldimi", + {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, + IMPL64}, + {0x7800000d, + "rldimi.", + {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}, {0, 0, mb}}, + IMPL64}, + {0x78000010, + "rldcl", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {0, 0, mb}}, + IMPL64}, + {0x78000011, + "rldcl.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {0, 0, mb}}, + IMPL64}, + {0x78000012, + "rldcr", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {0, 0, mb}}, + IMPL64}, + {0x78000013, + "rldcr.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {0, 0, mb}}, + IMPL64}, + + {0x54000000, + "rlwinm", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM0}, {6, 5, MBE}, {1, 5, MBE}}}, + {0x54000001, + "rlwinm.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM0}, {6, 5, MBE}, {1, 5, MBE}}}, + {0x5c000000, + "rlwnm", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {6, 5, MBE}, {1, 5, MBE}}}, + {0x5c000001, + "rlwnm.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {6, 5, MBE}, {1, 5, MBE}}}, + {0x50000000, + "rlwimi", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM0}, {6, 5, MBE}, {1, 5, MBE}}}, + {0x50000001, + "rlwimi.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM0}, {6, 5, MBE}, {1, 5, MBE}}}, + + { + 0x44000002, + "sc", + }, + {0x4c000024, "rfid", {{0}}, IMPL64 | OPTIONAL}, + + {0x7c000030, "slw", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000031, "slw.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000036, "sld", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7c000037, "sld.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, + + {0x7c000430, "srw", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000431, "srw.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000436, "srd", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7c000437, "srd.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, + + {0x7c000670, "srawi", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}}, + {0x7c000671, "srawi.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}}, + {0x7c000674, "sradi", {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}}, IMPL64}, + {0x7c000675, "sradi.", {{16, 5, GREG}, {21, 5, GREG}, {0, 0, sh}}, IMPL64}, + + {0x7c000630, "sraw", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000631, "sraw.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000634, "srad", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7c000635, + "srad.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + + {0x98000000, "stb", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0x9c000000, "stbu", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, + {0x7c0001ae, "stbx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c0001ee, "stbux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0xb0000000, "sth", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0xb4000000, "sthu", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, + {0x7c00032e, "sthx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00036e, "sthux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x90000000, "stw", {{21, 5, GREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0x94000000, "stwu", {{21, 5, GREG}, {0, 16, D}, {16, 5, GREG}}}, + {0x7c00012e, "stwx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00016e, "stwux", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0xf8000000, "std", {{21, 5, GREG}, {2, 14, DS}, {16, 5, G0REG}}, IMPL64}, + {0xf8000001, "stdu", {{21, 5, GREG}, {2, 14, DS}, {16, 5, GREG}}, IMPL64}, + {0x7c00012a, + "stdx", + {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, + IMPL64}, + {0x7c00016a, + "stdux", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + IMPL64}, + + {0x7c00072c, "sthbrx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00052c, "stwbrx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00052a, "stswx", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00012d, "stwcx.", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c0001ad, + "stdcx.", + {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, + IMPL64}, + + {0x7c0005aa, "stswi", {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, NUM0}}}, + + { + 0x7c0007ae, + "stfiwx", + {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}, + }, + + {0xd0000000, "stfs", {{21, 5, FREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0xd4000000, "stfsu", {{21, 5, FREG}, {0, 16, D}, {16, 5, GREG}}}, + {0x7c00052e, "stfsx", {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00056e, "stfsux", {{21, 5, FREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0xd8000000, "stfd", {{21, 5, FREG}, {0, 16, D}, {16, 5, G0REG}}}, + {0xdc000000, "stfdu", {{21, 5, FREG}, {0, 16, D}, {16, 5, GREG}}}, + {0x7c0005ae, "stfdx", {{21, 5, FREG}, {16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c0005ee, "stfdux", {{21, 5, FREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x20000000, "subfic", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}}, + {0x7c000050, "sub", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, + {0x7c000051, "sub.", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, + {0x7c000450, "subo", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, + {0x7c000451, "subo.", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, + {0x7c000050, "subf", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000051, "subf.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000450, "subfo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000451, "subfo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000010, "subc", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, + {0x7c000011, "subc.", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, + {0x7c000410, "subco", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, + {0x7c000411, "subco.", {{21, 5, GREG}, {11, 5, GREG}, {16, 5, GREG}}}, + {0x7c000010, "subfc", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000011, "subfc.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000410, "subfco", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000411, "subfco.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c000110, "subfe", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000111, "subfe.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000510, "subfeo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000511, "subfeo.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}}, + + {0x7c0001d0, "subfme", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c0001d1, "subfme.", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c0005d0, "subfmeo", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c0005d1, "subfmeo.", {{21, 5, GREG}, {16, 5, GREG}}}, + + {0x7c000190, "subfze", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c000191, "subfze.", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c000590, "subfzeo", {{21, 5, GREG}, {16, 5, GREG}}}, + {0x7c000591, "subfzeo.", {{21, 5, GREG}, {16, 5, GREG}}}, + + { + 0x7c0004ac, + "sync", + }, + {0x7c0004ac, "sync", {{21, 2, NUM}}}, + { + 0x7c2004ac, + "lwsync", + }, + { + 0x7c4004ac, + "ptesync", + }, + + {0x08000000, "tdi", {{21, 5, NUM}, {16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x0a000000, "tdlti", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x0a800000, "tdlei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x08800000, "tdeqi", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x09800000, "tdgei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x09000000, "tdgti", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x09800000, "tdnli", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x0b000000, "tdnei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x0a800000, "tdngi", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x08400000, "tdllti", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x08c00000, "tdllei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x08a00000, "tdlgei", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x08200000, "tdlgti", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x08a00000, "tdlnli", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + {0x08c00000, "tdlngi", {{16, 5, GREG}, {0, 16, SI}}, IMPL64}, + + {0x7c000088, "td", {{21, 5, NUM}, {16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7e000088, "tdlt", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7e800088, "tdle", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7c800088, "tdeq", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7d800088, "tdge", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7d000088, "tdgt", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7d800088, "tdnl", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7f000088, "tdne", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7e800088, "tdng", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7c400088, "tdllt", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7cc00088, "tdlle", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7ca00088, "tdlge", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7c200088, "tdlgt", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7ca00088, "tdlnl", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + {0x7cc00088, "tdlng", {{16, 5, GREG}, {11, 5, GREG}}, IMPL64}, + + {0x0c000000, "twi", {{21, 5, NUM}, {16, 5, GREG}, {0, 16, SI}}}, + {0x0e000000, "twlti", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0e800000, "twlei", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0c800000, "tweqi", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0d800000, "twgei", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0d000000, "twgti", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0d800000, "twnli", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0f000000, "twnei", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0e800000, "twngi", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0c400000, "twllti", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0cc00000, "twllei", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0ca00000, "twlgei", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0c200000, "twlgti", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0ca00000, "twlnli", {{16, 5, GREG}, {0, 16, SI}}}, + {0x0cc00000, "twlngi", {{16, 5, GREG}, {0, 16, SI}}}, + + {0x7c000008, "tw", {{21, 5, NUM}, {16, 5, GREG}, {11, 5, GREG}}}, + {0x7c000008, "tw", {{21, 5, NUM}, {16, 5, ZERO}, {11, 5, ZERO}}}, + {0x7e000008, "twlt", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7e800008, "twle", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7c800008, "tweq", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7d800008, "twge", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7d000008, "twgt", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7d800008, "twnl", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7f000008, "twne", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7e800008, "twng", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7c400008, "twllt", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7cc00008, "twlle", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7ca00008, "twlge", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7c200008, "twlgt", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7ca00008, "twlnl", {{16, 5, GREG}, {11, 5, GREG}}}, + {0x7cc00008, "twlng", {{16, 5, GREG}, {11, 5, GREG}}}, + { + 0x7fe00008, + "trap", + }, + + {0x68000000, "xori", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, + {0x6c000000, "xoris", {{16, 5, GREG}, {21, 5, GREG}, {0, 16, UI}}}, + {0x7c000278, "xor", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000279, "xor.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}}, + + /* Cache Management Instructions (from book II) */ + {0x7c0007ac, "icbi", {{16, 5, G0REG}, {11, 5, GREG}}}, + { + 0x4c00012c, + "isync", + }, + {0x7c00022c, "dcbt", {{16, 5, G0REG}, {11, 5, GREG}}}, + { + 0x7c00022c, + "dcbt", + {{16, 5, G0REG}, {11, 5, GREG}, {21, 4, NUM}}, + }, + {0x7c0001ec, "dcbtst", {{16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00022c, + "dcbt128", + {{16, 5, G0REG}, {11, 5, GREG}, {21, 4, NUM}}, + IMPL64 | OPTIONAL}, + {0x7c0007ec, "dcbz", {{16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c2007ec, "dcbzl", {{16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c2007ec, "dcbz128", {{16, 5, G0REG}, {11, 5, GREG}}, IMPL64 | OPTIONAL}, + {0x7c00006c, "dcbst", {{16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c0000ac, "dcbf", {{16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c00026c, + "eciwx", + {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, + OPTIONAL | CPU970}, + {0x7c00036c, + "ecowx", + {{21, 5, GREG}, {16, 5, G0REG}, {11, 5, GREG}}, + OPTIONAL | CPU970}, + { + 0x7c0006ac, + "eieio", + }, + /* Instructions (from book III) */ + { + 0x4c000064, + "rfi", + }, + {0x7c000124, "mtmsr", {{21, 5, GREG}}}, + {0x7c000164, "mtmsrd", {{21, 5, GREG}}, IMPL64 | OPTIONAL}, + {0x7c000164, "mtmsrd", {{21, 5, GREG}, {16, 1, NUM}}, IMPL64 | OPTIONAL}, + {0x7c0000a6, "mfmsr", {{21, 5, GREG}}}, + {0x7c0005ec, "dcba", {{16, 5, G0REG}, {11, 5, GREG}}, OPTIONAL}, + {0x7c0003ac, "dcbi", {{16, 5, G0REG}, {11, 5, GREG}}}, + {0x7c0001a4, "mtsr", {{16, 4, SGREG}, {21, 5, GREG}}}, + {0x7c0004a6, "mfsr", {{21, 5, GREG}, {16, 4, SGREG}}}, + {0x7c0001e4, "mtsrin", {{21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000526, "mfsrin", {{21, 5, GREG}, {11, 5, GREG}}}, + {0x7c000364, "slbie", {{11, 5, GREG}}, IMPL64 | OPTIONAL}, + {0x7c0003e4, "slbia", {{0}}, IMPL64 | OPTIONAL}, + {0x7c000324, "slbmte", {{21, 5, GREG}, {11, 5, GREG}}, IMPL64 | OPTIONAL}, + {0x7c0006a6, "slbmfev", {{21, 5, GREG}, {11, 5, GREG}}, IMPL64 | OPTIONAL}, + {0x7c000726, "slbmfee", {{21, 5, GREG}, {11, 5, GREG}}, IMPL64 | OPTIONAL}, + {0x7c000264, "tlbie", {{11, 5, GREG}}, OPTIONAL | CPU970}, + {0x7c000264, + "tlbie", + {{11, 5, GREG}, {21, 1, NUM}}, + IMPL64 | OPTIONAL | CPU970}, + {0x7c000224, "tlbiel", {{11, 5, GREG}}, IMPL64 | OPTIONAL}, + {0x7c0002e4, "tlbia", {{0}}, OPTIONAL | CPU970}, + {0x7c00046c, "tlbsync", {{0}}, OPTIONAL | CPU970}, + {0x7c1c43a6, "mttbl", {{21, 5, GREG}}}, + {0x7c1d43a6, "mttbu", {{21, 5, GREG}}}, + {0x7c0002e6, "mftb", {{21, 5, GREG}, {11, 10, SPREG}}}, + {0x7c0c42e6, "mftb", {{21, 5, GREG}}}, + {0x7c0d42e6, "mftbu", {{21, 5, GREG}}}, + {0x00000200, "attn", {{11, 15, NUM}}, OPTIONAL | CPU970}, + + /* Instructions (from book IV) */ + {0x24000000, "dozi", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}, CPU601}, + {0x7c000210, "doz", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000211, "doz.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000610, "dozo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000611, + "dozo.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c0002d0, "abs", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, + {0x7c0002d1, "abs.", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, + {0x7c0006d0, "abso", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, + {0x7c0006d1, "abso.", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, + + {0x7c0003d0, "nabs", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, + {0x7c0003d1, "nabs.", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, + {0x7c0007d0, "nabso", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, + {0x7c0007d1, "nabso.", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, + + {0x1c000000, "mulli", {{21, 5, GREG}, {16, 5, GREG}, {0, 16, SI}}}, + + {0x7c0000d6, "mul", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c0000d7, "mul.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c0004d6, "mulo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c0004d7, + "mulo.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c000296, "div", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000297, "div.", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000696, "divo", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000697, + "divo.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c0002d6, "divs", {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c0002d7, + "divs.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + CPU601}, + {0x7c0006d6, + "divso", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + CPU601}, + {0x7c0006d7, + "divso.", + {{21, 5, GREG}, {16, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x58000000, + "rlmi", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {6, 5, MBE}, {1, 5, MBE}}, + CPU601}, + {0x58000001, + "rlmi.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}, {6, 5, MBE}, {1, 5, MBE}}, + CPU601}, + + {0x7c000432, "rrib", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000433, + "rrib.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c00003a, + "maskg", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + {0x7c00003b, + "maskg.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c00043a, + "maskir", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + {0x7c00043b, + "maskir.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c000130, "slq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000131, "slq.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + + {0x7c000530, "srq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000531, "srq.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + + {0x7c000170, "sliq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, + {0x7c000171, "sliq.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, + + {0x7c000570, "sriq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, + {0x7c000571, "sriq.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, + + {0x7c0001f0, "slliq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, + {0x7c0001f1, + "slliq.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, + CPU601}, + + {0x7c0005f0, "srliq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, + {0x7c0005f1, + "srliq.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, + CPU601}, + + {0x7c0001b0, "sllq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c0001b1, + "sllq.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c0005b0, "srlq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c0005b1, + "srlq.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c000132, "sle", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000133, "sle.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + + {0x7c000532, "sre", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000533, "sre.", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + + {0x7c0001b2, "sleq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c0001b3, + "sleq.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c0005b2, "sreq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c0005b3, + "sreq.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c000770, "sraiq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, CPU601}, + {0x7c000771, + "sraiq.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, NUM}}, + CPU601}, + + {0x7c000730, "sraq", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000731, + "sraq.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + {0x7c000732, "srea", {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, CPU601}, + {0x7c000733, + "srea.", + {{16, 5, GREG}, {21, 5, GREG}, {11, 5, GREG}}, + CPU601}, + + /* Added from the POWER 601 book */ + {0x7c000426, "clcs", {{21, 5, GREG}, {16, 5, GREG}}, CPU601}, + + /* Added from the POWER 603 book. * These are really 603 specific instructions but we mark them as OPTIONAL * so that the -force_cpusubtype_ALL flag as to be used. This makes it so * only 601 instructions will cause the cputype to be set to other an ALL. */ - {0x7c0007a4, "tlbld", {{11, 5, GREG}}, OPTIONAL}, - {0x7c0007e4, "tlbli", {{11, 5, GREG}}, OPTIONAL}, - - /* VMX Instructions */ - {0x7c00000e, "lvebx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - {0x7c00004e, "lvehx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - {0x7c00008e, "lvewx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - {0x7c0000ce, "lvx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - {0x7c0002ce, "lvxl", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - - {0x7c00010e, "stvebx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - {0x7c00014e, "stvehx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - {0x7c00018e, "stvewx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - {0x7c0001ce, "stvx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - {0x7c0003ce, "stvxl", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - - {0x7c00000c, "lvsl", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - {0x7c00004c, "lvsr", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, - - {0x10000644, "mtvscr", {{11, 5, VREG}}, VMX}, - {0x10000604, "mfvscr", {{21, 5, VREG}}, VMX}, - - {0x7c0002ac, "dst", {{16, 5, GREG}, {11, 5, GREG}, {21, 2, NUM}}, VMX}, - {0x7e0002ac, "dstt", {{16, 5, GREG}, {11, 5, GREG}, {21, 2, NUM}}, VMX}, - {0x7c0002ec, "dstst", {{16, 5, GREG}, {11, 5, GREG}, {21, 2, NUM}}, VMX}, - {0x7e0002ec, "dststt", {{16, 5, GREG}, {11, 5, GREG}, {21, 2, NUM}}, VMX}, - {0x7c00066c, "dss", {{21, 2, NUM}}, VMX}, - {0x7e00066c, "dssall", {{0}}, VMX}, - - {0x10000000, "vaddubm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000200, "vaddubs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000300, "vaddsbs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000040, "vadduhm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000240, "vadduhs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000340, "vaddshs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000080, "vadduwm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000280, "vadduws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000380, "vaddsws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000000a, "vaddfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000180, "vaddcuw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000400, "vsububm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000600, "vsububs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000700, "vsubsbs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000440, "vsubuhm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000640, "vsubuhs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000740, "vsubshs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000480, "vsubuwm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000680, "vsubuws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000780, "vsubsws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000004a, "vsubfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000580, "vsubcuw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000008, "vmuloub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000108, "vmulosb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000048, "vmulouh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000148, "vmulosh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000208, "vmuleub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000308, "vmulesb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000248, "vmuleuh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000348, "vmulesh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000020, - "vmhaddshs", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - {0x10000021, - "vmhraddshs", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - {0x10000022, - "vmladduhm", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - {0x1000002e, - "vmaddfp", - {{21, 5, VREG}, {16, 5, VREG}, {6, 5, VREG}, {11, 5, VREG}}, - VMX}, - - {0x10000024, - "vmsumubm", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - {0x10000025, - "vmsummbm", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - {0x10000026, - "vmsumuhm", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - {0x10000027, - "vmsumuhs", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - {0x10000028, - "vmsumshm", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - {0x10000029, - "vmsumshs", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - - {0x10000788, "vsumsws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000688, - "vsum2sws", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - - {0x10000608, - "vsum4ubs", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000708, - "vsum4sbs", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000648, - "vsum4shs", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - - {0x10000402, "vavgub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000442, "vavguh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000482, "vavguw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000502, "vavgsb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000542, "vavgsh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000582, "vavgsw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000404, "vand", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000484, "vor", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100004c4, "vxor", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000444, "vandc", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000504, "vnor", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000004, "vrlb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000044, "vrlh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000084, "vrlw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000104, "vslb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000144, "vslh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000184, "vslw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100001c4, "vsl", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000204, "vsrb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000304, "vsrab", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000244, "vsrh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000344, "vsrah", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000284, "vsrw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000384, "vsraw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100002c4, "vsr", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000206, - "vcmpgtub", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000606, - "vcmpgtub.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000306, - "vcmpgtsb", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000706, - "vcmpgtsb.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000246, - "vcmpgtuh", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000646, - "vcmpgtuh.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000346, - "vcmpgtsh", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000746, - "vcmpgtsh.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000286, - "vcmpgtuw", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000686, - "vcmpgtuw.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000386, - "vcmpgtsw", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000786, - "vcmpgtsw.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x100002c6, - "vcmpgtfp", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x100006c6, - "vcmpgtfp.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - - {0x10000006, - "vcmpequb", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000406, - "vcmpequb.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000046, - "vcmpequh", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000446, - "vcmpequh.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000086, - "vcmpequw", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x10000486, - "vcmpequw.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x100000c6, - "vcmpeqfp", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x100004c6, - "vcmpeqfp.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - - {0x100001c6, - "vcmpgefp", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - {0x100005c6, - "vcmpgefp.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - - {0x100003c6, "vcmpbfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100007c6, - "vcmpbfp.", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, - VMX}, - - {0x1000002a, - "vsel", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - - {0x1000000e, "vpkuhum", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000008e, "vpkuhus", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000010e, "vpkshus", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000018e, "vpkshss", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000004e, "vpkuwum", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100000ce, "vpkuwus", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000014e, "vpkswus", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100001ce, "vpkswss", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000030e, "vpkpx", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x1000020e, "vupkhsb", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000024e, "vupkhsh", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000034e, "vupkhpx", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x1000028e, "vupklsb", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100002ce, "vupklsh", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100003ce, "vupklpx", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x1000000c, "vmrghb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000004c, "vmrghh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000008c, "vmrghw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x1000010c, "vmrglb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000014c, "vmrglh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000018c, "vmrglw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x1000020c, "vspltb", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, - {0x1000024c, "vsplth", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, - {0x1000028c, "vspltw", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, - - {0x1000030c, "vspltisb", {{21, 5, VREG}, {16, 5, SNUM}}, VMX}, - {0x1000034c, "vspltish", {{21, 5, VREG}, {16, 5, SNUM}}, VMX}, - {0x1000038c, "vspltisw", {{21, 5, VREG}, {16, 5, SNUM}}, VMX}, - - {0x1000002b, - "vperm", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, - VMX}, - - {0x1000002c, - "vsldoi", - {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 4, NUM}}, - VMX}, - - {0x1000040c, "vslo", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000044c, "vsro", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000002, "vmaxub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000102, "vmaxsb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000042, "vmaxuh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000142, "vmaxsh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000082, "vmaxuw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000182, "vmaxsw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000040a, "vmaxfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x10000202, "vminub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000302, "vminsb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000242, "vminuh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000342, "vminsh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000282, "vminuw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x10000382, "vminsw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000044a, "vminfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x1000010a, "vrefp", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000014a, "vrsqrtefp", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100001ca, "vlogefp", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000018a, "vexptefp", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x1000002f, - "vnmsubfp", - {{21, 5, VREG}, {16, 5, VREG}, {6, 5, VREG}, {11, 5, VREG}}, - VMX}, - - {0x1000020a, "vrfin", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000024a, "vrfiz", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x1000028a, "vrfip", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - {0x100002ca, "vrfim", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, - - {0x1000038a, "vctuxs", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, - {0x100003ca, "vctsxs", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, - - {0x1000030a, "vcfux", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, - {0x1000034a, "vcfsx", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, - - {0, ""} /* end of table marker */ + {0x7c0007a4, "tlbld", {{11, 5, GREG}}, OPTIONAL}, + {0x7c0007e4, "tlbli", {{11, 5, GREG}}, OPTIONAL}, + + /* VMX Instructions */ + {0x7c00000e, "lvebx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + {0x7c00004e, "lvehx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + {0x7c00008e, "lvewx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + {0x7c0000ce, "lvx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + {0x7c0002ce, "lvxl", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + + {0x7c00010e, "stvebx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + {0x7c00014e, "stvehx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + {0x7c00018e, "stvewx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + {0x7c0001ce, "stvx", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + {0x7c0003ce, "stvxl", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + + {0x7c00000c, "lvsl", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + {0x7c00004c, "lvsr", {{21, 5, VREG}, {16, 5, G0REG}, {11, 5, GREG}}, VMX}, + + {0x10000644, "mtvscr", {{11, 5, VREG}}, VMX}, + {0x10000604, "mfvscr", {{21, 5, VREG}}, VMX}, + + {0x7c0002ac, "dst", {{16, 5, GREG}, {11, 5, GREG}, {21, 2, NUM}}, VMX}, + {0x7e0002ac, "dstt", {{16, 5, GREG}, {11, 5, GREG}, {21, 2, NUM}}, VMX}, + {0x7c0002ec, "dstst", {{16, 5, GREG}, {11, 5, GREG}, {21, 2, NUM}}, VMX}, + {0x7e0002ec, "dststt", {{16, 5, GREG}, {11, 5, GREG}, {21, 2, NUM}}, VMX}, + {0x7c00066c, "dss", {{21, 2, NUM}}, VMX}, + {0x7e00066c, "dssall", {{0}}, VMX}, + + {0x10000000, "vaddubm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000200, "vaddubs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000300, "vaddsbs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000040, "vadduhm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000240, "vadduhs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000340, "vaddshs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000080, "vadduwm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000280, "vadduws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000380, "vaddsws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000000a, "vaddfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000180, "vaddcuw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000400, "vsububm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000600, "vsububs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000700, "vsubsbs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000440, "vsubuhm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000640, "vsubuhs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000740, "vsubshs", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000480, "vsubuwm", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000680, "vsubuws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000780, "vsubsws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000004a, "vsubfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000580, "vsubcuw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000008, "vmuloub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000108, "vmulosb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000048, "vmulouh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000148, "vmulosh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000208, "vmuleub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000308, "vmulesb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000248, "vmuleuh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000348, "vmulesh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000020, + "vmhaddshs", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + {0x10000021, + "vmhraddshs", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + {0x10000022, + "vmladduhm", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + {0x1000002e, + "vmaddfp", + {{21, 5, VREG}, {16, 5, VREG}, {6, 5, VREG}, {11, 5, VREG}}, + VMX}, + + {0x10000024, + "vmsumubm", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + {0x10000025, + "vmsummbm", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + {0x10000026, + "vmsumuhm", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + {0x10000027, + "vmsumuhs", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + {0x10000028, + "vmsumshm", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + {0x10000029, + "vmsumshs", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + + {0x10000788, "vsumsws", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000688, + "vsum2sws", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + + {0x10000608, + "vsum4ubs", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000708, + "vsum4sbs", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000648, + "vsum4shs", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + + {0x10000402, "vavgub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000442, "vavguh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000482, "vavguw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000502, "vavgsb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000542, "vavgsh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000582, "vavgsw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000404, "vand", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000484, "vor", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100004c4, "vxor", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000444, "vandc", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000504, "vnor", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000004, "vrlb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000044, "vrlh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000084, "vrlw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000104, "vslb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000144, "vslh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000184, "vslw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100001c4, "vsl", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000204, "vsrb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000304, "vsrab", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000244, "vsrh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000344, "vsrah", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000284, "vsrw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000384, "vsraw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100002c4, "vsr", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000206, + "vcmpgtub", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000606, + "vcmpgtub.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000306, + "vcmpgtsb", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000706, + "vcmpgtsb.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000246, + "vcmpgtuh", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000646, + "vcmpgtuh.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000346, + "vcmpgtsh", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000746, + "vcmpgtsh.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000286, + "vcmpgtuw", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000686, + "vcmpgtuw.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000386, + "vcmpgtsw", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000786, + "vcmpgtsw.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x100002c6, + "vcmpgtfp", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x100006c6, + "vcmpgtfp.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + + {0x10000006, + "vcmpequb", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000406, + "vcmpequb.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000046, + "vcmpequh", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000446, + "vcmpequh.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000086, + "vcmpequw", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x10000486, + "vcmpequw.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x100000c6, + "vcmpeqfp", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x100004c6, + "vcmpeqfp.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + + {0x100001c6, + "vcmpgefp", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + {0x100005c6, + "vcmpgefp.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + + {0x100003c6, "vcmpbfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100007c6, + "vcmpbfp.", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, + VMX}, + + {0x1000002a, + "vsel", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + + {0x1000000e, "vpkuhum", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000008e, "vpkuhus", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000010e, "vpkshus", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000018e, "vpkshss", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000004e, "vpkuwum", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100000ce, "vpkuwus", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000014e, "vpkswus", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100001ce, "vpkswss", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000030e, "vpkpx", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x1000020e, "vupkhsb", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000024e, "vupkhsh", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000034e, "vupkhpx", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x1000028e, "vupklsb", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100002ce, "vupklsh", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100003ce, "vupklpx", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x1000000c, "vmrghb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000004c, "vmrghh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000008c, "vmrghw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x1000010c, "vmrglb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000014c, "vmrglh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000018c, "vmrglw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x1000020c, "vspltb", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, + {0x1000024c, "vsplth", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, + {0x1000028c, "vspltw", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, + + {0x1000030c, "vspltisb", {{21, 5, VREG}, {16, 5, SNUM}}, VMX}, + {0x1000034c, "vspltish", {{21, 5, VREG}, {16, 5, SNUM}}, VMX}, + {0x1000038c, "vspltisw", {{21, 5, VREG}, {16, 5, SNUM}}, VMX}, + + {0x1000002b, + "vperm", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 5, VREG}}, + VMX}, + + {0x1000002c, + "vsldoi", + {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}, {6, 4, NUM}}, + VMX}, + + {0x1000040c, "vslo", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000044c, "vsro", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000002, "vmaxub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000102, "vmaxsb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000042, "vmaxuh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000142, "vmaxsh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000082, "vmaxuw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000182, "vmaxsw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000040a, "vmaxfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x10000202, "vminub", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000302, "vminsb", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000242, "vminuh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000342, "vminsh", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000282, "vminuw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x10000382, "vminsw", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000044a, "vminfp", {{21, 5, VREG}, {16, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x1000010a, "vrefp", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000014a, "vrsqrtefp", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100001ca, "vlogefp", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000018a, "vexptefp", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x1000002f, + "vnmsubfp", + {{21, 5, VREG}, {16, 5, VREG}, {6, 5, VREG}, {11, 5, VREG}}, + VMX}, + + {0x1000020a, "vrfin", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000024a, "vrfiz", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x1000028a, "vrfip", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + {0x100002ca, "vrfim", {{21, 5, VREG}, {11, 5, VREG}}, VMX}, + + {0x1000038a, "vctuxs", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, + {0x100003ca, "vctsxs", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, + + {0x1000030a, "vcfux", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, + {0x1000034a, "vcfsx", {{21, 5, VREG}, {11, 5, VREG}, {16, 5, NUM}}, VMX}, + + {0, ""} /* end of table marker */ }; #define kAsmFloatZeroRegister 0 -#define kAsmZeroRegister 0 +#define kAsmZeroRegister 0 #define kAsmRegisterPrefix "r" -#define kAsmRegisterLimit 31 -#define kAsmPcRegister 17 -#define kAsmCrRegister 18 -#define kAsmSpRegister 5 +#define kAsmRegisterLimit 31 +#define kAsmPcRegister 17 +#define kAsmCrRegister 18 +#define kAsmSpRegister 5 /* return address register */ #define kAsmRetRegister 19 diff --git a/Headers/CompilerKit.hpp b/Headers/CompilerKit.hpp index 447aae8..9e37666 100644 --- a/Headers/CompilerKit.hpp +++ b/Headers/CompilerKit.hpp @@ -9,27 +9,25 @@ #ifndef _CK_CL_HPP #define _CK_CL_HPP -#define MPCC_COPY_DELETE(KLASS) \ - KLASS &operator=(const KLASS &) = delete; \ - KLASS(const KLASS &) = delete; +#define MPCC_COPY_DELETE(KLASS) \ + KLASS& operator=(const KLASS&) = delete; \ + KLASS(const KLASS&) = delete; -#define MPCC_COPY_DEFAULT(KLASS) \ - KLASS &operator=(const KLASS &) = default; \ - KLASS(const KLASS &) = default; - -#define MPCC_MOVE_DELETE(KLASS) \ - KLASS &operator=(KLASS &&) = delete; \ - KLASS(KLASS &&) = delete; - -#define MPCC_MOVE_DEFAULT(KLASS) \ - KLASS &operator=(KLASS &&) = default; \ - KLASS(KLASS &&) = default; +#define MPCC_COPY_DEFAULT(KLASS) \ + KLASS& operator=(const KLASS&) = default; \ + KLASS(const KLASS&) = default; +#define MPCC_MOVE_DELETE(KLASS) \ + KLASS& operator=(KLASS&&) = delete; \ + KLASS(KLASS&&) = delete; +#define MPCC_MOVE_DEFAULT(KLASS) \ + KLASS& operator=(KLASS&&) = default; \ + KLASS(KLASS&&) = default; /// @note xxxx is the error placeholder, in hexadecimal. #define MPCC_ERROR_PREFIX_CXX "CXXxxxx" -#define MPCC_ERROR_PREFIX_CL "CLxxxx" +#define MPCC_ERROR_PREFIX_CL "CLxxxx" #define MPCC_ERROR_PREFIX_ASM "ASMxxxx" #endif /* ifndef _CK_CL_HPP */ diff --git a/Headers/Defines.hpp b/Headers/Defines.hpp index a84e2ba..01230e6 100644 --- a/Headers/Defines.hpp +++ b/Headers/Defines.hpp @@ -9,37 +9,37 @@ #ifndef Yes #define Yes true -#endif // ifndef Yes +#endif // ifndef Yes #ifndef No #define No false -#endif // ifndef No +#endif // ifndef No #include <cstdint> #define SizeType size_t -#define VoidPtr void * +#define VoidPtr void* #define voidPtr VoidPtr #define UIntPtr uintptr_t -#define Int64 int64_t +#define Int64 int64_t #define UInt64 uint64_t -#define Int32 int +#define Int32 int #define UInt32 unsigned #define Bool bool -#define Int16 int16_t +#define Int16 int16_t #define UInt16 uint16_t -#define Int8 int8_t +#define Int8 int8_t #define UInt8 uint8_t #define CharType char -#define Boolean bool +#define Boolean bool #include <cassert> #include <cstring> @@ -61,63 +61,68 @@ #define rt_copy_memory(dst, src, len) memcpy(dst, src, len) #endif -#define MPCC_COPY_DELETE(KLASS) \ - KLASS &operator=(const KLASS &) = delete; \ - KLASS(const KLASS &) = delete; +#define MPCC_COPY_DELETE(KLASS) \ + KLASS& operator=(const KLASS&) = delete; \ + KLASS(const KLASS&) = delete; -#define MPCC_COPY_DEFAULT(KLASS) \ - KLASS &operator=(const KLASS &) = default; \ - KLASS(const KLASS &) = default; +#define MPCC_COPY_DEFAULT(KLASS) \ + KLASS& operator=(const KLASS&) = default; \ + KLASS(const KLASS&) = default; -#define MPCC_MOVE_DELETE(KLASS) \ - KLASS &operator=(KLASS &&) = delete; \ - KLASS(KLASS &&) = delete; +#define MPCC_MOVE_DELETE(KLASS) \ + KLASS& operator=(KLASS&&) = delete; \ + KLASS(KLASS&&) = delete; -#define MPCC_MOVE_DEFAULT(KLASS) \ - KLASS &operator=(KLASS &&) = default; \ - KLASS(KLASS &&) = default; +#define MPCC_MOVE_DEFAULT(KLASS) \ + KLASS& operator=(KLASS&&) = default; \ + KLASS(KLASS&&) = default; #include <ctime> #include <fstream> #include <string> #include <vector> -namespace CompilerKit { -inline constexpr int BASE_YEAR = 1900; +namespace CompilerKit +{ + inline constexpr int BASE_YEAR = 1900; -inline std::string current_date() noexcept { - auto time_data = time(nullptr); - auto time_struct = gmtime(&time_data); + inline std::string current_date() noexcept + { + auto time_data = time(nullptr); + auto time_struct = gmtime(&time_data); - std::string fmt = std::to_string(BASE_YEAR + time_struct->tm_year); - fmt += "-"; - fmt += std::to_string(time_struct->tm_mon + 1); - fmt += "-"; - fmt += std::to_string(time_struct->tm_mday); + std::string fmt = std::to_string(BASE_YEAR + time_struct->tm_year); + fmt += "-"; + fmt += std::to_string(time_struct->tm_mon + 1); + fmt += "-"; + fmt += std::to_string(time_struct->tm_mday); - return fmt; -} + return fmt; + } -inline bool to_str(CharType *str, Int32 limit, Int32 base) noexcept { - if (limit == 0) return false; + inline bool to_str(CharType* str, Int32 limit, Int32 base) noexcept + { + if (limit == 0) + return false; - Int32 copy_limit = limit; - Int32 cnt = 0; - Int32 ret = base; + Int32 copy_limit = limit; + Int32 cnt = 0; + Int32 ret = base; - while (limit != 1) { - ret = ret % 10; - str[cnt] = ret; + while (limit != 1) + { + ret = ret % 10; + str[cnt] = ret; - ++cnt; - --limit; - --ret; - } + ++cnt; + --limit; + --ret; + } - str[copy_limit] = '\0'; - return true; -} -} // namespace CompilerKit + str[copy_limit] = '\0'; + return true; + } +} // namespace CompilerKit #define PACKED __attribute__((packed)) @@ -126,13 +131,15 @@ typedef char char_type; #define kObjectFileExt ".obj" #define kBinaryFileExt ".bin" -#define kAsmFileExts \ - { ".64x", ".32x", ".masm", ".s", ".S", ".asm" } +#define kAsmFileExts \ + { \ + ".64x", ".32x", ".masm", ".s", ".S", ".asm" \ + } #ifdef __MODULE_NEED__ -#define MPCC_MODULE(name) int name(int argc, char **argv) +#define MPCC_MODULE(name) int name(int argc, char** argv) #else -#define MPCC_MODULE(name) int main(int argc, char **argv) +#define MPCC_MODULE(name) int main(int argc, char** argv) #endif /* ifdef __MODULE_NEED__ */ #pragma scalar_storage_order big - endian diff --git a/Headers/ParserKit.hpp b/Headers/ParserKit.hpp index b7768e7..e4277c6 100644 --- a/Headers/ParserKit.hpp +++ b/Headers/ParserKit.hpp @@ -9,111 +9,135 @@ #include <Headers/AsmKit/AsmKit.hpp> #include <vector> -namespace ParserKit { -using namespace CompilerKit; - -/// @brief Compiler backend, implements a frontend, such as C, C++... -/// See Toolchain, for some examples. -class CompilerBackend { - public: - explicit CompilerBackend() = default; - virtual ~CompilerBackend() = default; - - MPCC_COPY_DEFAULT(CompilerBackend); - - // NOTE: cast this to your user defined ast. - typedef void* AstType; - - //! @brief Compile a syntax tree ouf of the text. - //! Also takes the source file name for metadata. - - virtual bool Compile(const std::string& text, const char* file) = 0; - - //! @brief What language are we dealing with? - virtual const char* Language() { return "Invalid Language"; } -}; - -struct SyntaxLeafList; -struct SyntaxLeafList; -struct CompilerKeyword; - -/// we want to do that because to separate keywords. -enum { - eKeywordKindAccess, - eKeywordKindObject, - eKeywordKindDataType, - eKeywordKindCompilerAttribute, - eKeywordKindKeyword, -}; - -/// \brief Compiler keyword information struct. -struct CompilerKeyword { - std::string keyword_name; - int32_t keyword_kind = eKeywordKindKeyword; -}; -struct SyntaxLeafList final { - struct SyntaxLeaf final { - Int32 fUserType; +namespace ParserKit +{ + using namespace CompilerKit; + + /// @brief Compiler backend, implements a frontend, such as C, C++... + /// See Toolchain, for some examples. + class CompilerBackend + { + public: + explicit CompilerBackend() = default; + virtual ~CompilerBackend() = default; + + MPCC_COPY_DEFAULT(CompilerBackend); + + // NOTE: cast this to your user defined ast. + typedef void* AstType; + + //! @brief Compile a syntax tree ouf of the text. + //! Also takes the source file name for metadata. + + virtual bool Compile(const std::string& text, const char* file) = 0; + + //! @brief What language are we dealing with? + virtual const char* Language() + { + return "Invalid Language"; + } + }; + + struct SyntaxLeafList; + struct SyntaxLeafList; + struct CompilerKeyword; + + /// we want to do that because to separate keywords. + enum + { + eKeywordKindAccess, + eKeywordKindObject, + eKeywordKindDataType, + eKeywordKindCompilerAttribute, + eKeywordKindKeyword, + }; + + /// \brief Compiler keyword information struct. + struct CompilerKeyword + { + std::string keyword_name; + int32_t keyword_kind = eKeywordKindKeyword; + }; + struct SyntaxLeafList final + { + struct SyntaxLeaf final + { + Int32 fUserType; #ifdef __PK_USE_STRUCT_INSTEAD__ - CompilerKeyword fUserData; - CompilerKeyword fUserValue; + CompilerKeyword fUserData; + CompilerKeyword fUserValue; #else - std::string fUserData; - std::string fUserValue; + std::string fUserData; + std::string fUserValue; #endif - struct SyntaxLeaf* fNext; - }; - - std::vector<SyntaxLeaf> fLeafList; - SizeType fNumLeafs; - - size_t SizeOf() { return fNumLeafs; } - std::vector<SyntaxLeaf>& Get() { return fLeafList; } - SyntaxLeaf& At(size_t index) { return fLeafList[index]; } -}; - -/// find the perfect matching word in a haystack. -/// \param haystack base string -/// \param needle the string we search for. -/// \return if we found it or not. -inline bool find_word(const std::string& haystack, - const std::string& needle) noexcept { - auto index = haystack.find(needle); - - // check for needle validity. - if (index == std::string::npos) return false; - - // declare lambda - auto not_part_of_word = [&](int index) { - if (std::isspace(haystack[index]) || std::ispunct(haystack[index])) - return true; - - if (index < 0 || index >= haystack.size()) return true; - - return false; - }; - - return not_part_of_word(index - 1) && not_part_of_word(index + needle.size()); -} - -/// find a word within strict conditions and returns a range of it. -/// \param haystack -/// \param needle -/// \return position of needle. -inline std::size_t find_word_range(const std::string& haystack, - const std::string& needle) noexcept { - auto index = haystack.find(needle); - - // check for needle validity. - if (index == std::string::npos) return false; - - if (!isalnum((haystack[index + needle.size() + 1])) && - !isdigit(haystack[index + needle.size() + 1]) && - !isalnum((haystack[index - needle.size() - 1])) && - !isdigit(haystack[index - needle.size() - 1])) { - return index; - } - - return false; -} -} // namespace ParserKit + struct SyntaxLeaf* fNext; + }; + + std::vector<SyntaxLeaf> fLeafList; + SizeType fNumLeafs; + + size_t SizeOf() + { + return fNumLeafs; + } + std::vector<SyntaxLeaf>& Get() + { + return fLeafList; + } + SyntaxLeaf& At(size_t index) + { + return fLeafList[index]; + } + }; + + /// find the perfect matching word in a haystack. + /// \param haystack base string + /// \param needle the string we search for. + /// \return if we found it or not. + inline bool find_word(const std::string& haystack, + const std::string& needle) noexcept + { + auto index = haystack.find(needle); + + // check for needle validity. + if (index == std::string::npos) + return false; + + // declare lambda + auto not_part_of_word = [&](int index) { + if (std::isspace(haystack[index]) || std::ispunct(haystack[index])) + return true; + + if (index < 0 || index >= haystack.size()) + return true; + + return false; + }; + + return not_part_of_word(index - 1) && not_part_of_word(index + needle.size()); + } + + /// find a word within strict conditions and returns a range of it. + /// \param haystack + /// \param needle + /// \return position of needle. + inline std::size_t find_word_range(const std::string& haystack, + const std::string& needle) noexcept + { + auto index = haystack.find(needle); + + // check for needle validity. + if (index == std::string::npos) + return false; + + if (!isalnum((haystack[index + needle.size() + 1])) && + !isdigit(haystack[index + needle.size() + 1]) && + !isalnum((haystack[index - needle.size() - 1])) && + !isdigit(haystack[index - needle.size() - 1])) + { + return index; + } + + return false; + } +} // namespace ParserKit diff --git a/Headers/StdKit/AE.hpp b/Headers/StdKit/AE.hpp index 39069c9..ca54671 100644 --- a/Headers/StdKit/AE.hpp +++ b/Headers/StdKit/AE.hpp @@ -14,9 +14,9 @@ #define kAEMag0 'A' #define kAEMag1 'E' -#define kAESymbolLen 64 -#define kAEPad 8 -#define kAEMagLen 2 +#define kAESymbolLen 64 +#define kAEPad 8 +#define kAEMagLen 2 #define kAEInvalidOpcode 0x00 // Advanced Executable File Format for MetroLink. @@ -24,96 +24,108 @@ // You can also relocate at runtime but that's up to the operating system // loader. -namespace CompilerKit { -// @brief Advanced Executable Header -// One thing to keep in mind. -// This object format, is reloctable. -typedef struct AEHeader final { - CharType fMagic[kAEMagLen]; - CharType fArch; - CharType fSubArch; - SizeType fCount; - CharType fSize; - SizeType fStartCode; - SizeType fCodeSize; - CharType fPad[kAEPad]; -} PACKED AEHeader, *AEHeaderPtr; - -// @brief Advanced Executable Record. -// Could be data, code or bss. -// fKind must be filled with PEF fields. - -typedef struct AERecordHeader final { - CharType fName[kAESymbolLen]; - SizeType fKind; - SizeType fSize; - SizeType fFlags; - UIntPtr fOffset; - CharType fPad[kAEPad]; -} PACKED AERecordHeader, *AERecordHeaderPtr; - -enum { - kKindRelocationByOffset = 0x23f, - kKindRelocationAtRuntime = 0x34f, -}; -} // namespace CompilerKit +namespace CompilerKit +{ + // @brief Advanced Executable Header + // One thing to keep in mind. + // This object format, is reloctable. + typedef struct AEHeader final + { + CharType fMagic[kAEMagLen]; + CharType fArch; + CharType fSubArch; + SizeType fCount; + CharType fSize; + SizeType fStartCode; + SizeType fCodeSize; + CharType fPad[kAEPad]; + } PACKED AEHeader, *AEHeaderPtr; + + // @brief Advanced Executable Record. + // Could be data, code or bss. + // fKind must be filled with PEF fields. + + typedef struct AERecordHeader final + { + CharType fName[kAESymbolLen]; + SizeType fKind; + SizeType fSize; + SizeType fFlags; + UIntPtr fOffset; + CharType fPad[kAEPad]; + } PACKED AERecordHeader, *AERecordHeaderPtr; + + enum + { + kKindRelocationByOffset = 0x23f, + kKindRelocationAtRuntime = 0x34f, + }; +} // namespace CompilerKit // provide operator<< for AE -std::ofstream &operator<<(std::ofstream &fp, CompilerKit::AEHeader &container) { - fp.write((char *)&container, sizeof(CompilerKit::AEHeader)); +std::ofstream& operator<<(std::ofstream& fp, CompilerKit::AEHeader& container) +{ + fp.write((char*)&container, sizeof(CompilerKit::AEHeader)); - return fp; + return fp; } -std::ofstream &operator<<(std::ofstream &fp, - CompilerKit::AERecordHeader &container) { - fp.write((char *)&container, sizeof(CompilerKit::AERecordHeader)); +std::ofstream& operator<<(std::ofstream& fp, + CompilerKit::AERecordHeader& container) +{ + fp.write((char*)&container, sizeof(CompilerKit::AERecordHeader)); - return fp; + return fp; } -std::ifstream &operator>>(std::ifstream &fp, CompilerKit::AEHeader &container) { - fp.read((char *)&container, sizeof(CompilerKit::AEHeader)); - return fp; +std::ifstream& operator>>(std::ifstream& fp, CompilerKit::AEHeader& container) +{ + fp.read((char*)&container, sizeof(CompilerKit::AEHeader)); + return fp; } -std::ifstream &operator>>(std::ifstream &fp, - CompilerKit::AERecordHeader &container) { - fp.read((char *)&container, sizeof(CompilerKit::AERecordHeader)); - return fp; +std::ifstream& operator>>(std::ifstream& fp, + CompilerKit::AERecordHeader& container) +{ + fp.read((char*)&container, sizeof(CompilerKit::AERecordHeader)); + return fp; } -namespace CompilerKit::Utils { -/** +namespace CompilerKit::Utils +{ + /** * @brief AE Reader protocol * */ -class AEReadableProtocol final { - public: - std::ifstream FP; + class AEReadableProtocol final + { + public: + std::ifstream FP; - public: - explicit AEReadableProtocol() = default; - ~AEReadableProtocol() = default; + public: + explicit AEReadableProtocol() = default; + ~AEReadableProtocol() = default; - MPCC_COPY_DELETE(AEReadableProtocol); + MPCC_COPY_DELETE(AEReadableProtocol); - /** + /** * @brief Read AE record * * @param raw the containing buffer * @param sz it's size (without sizeof(AERecordHeader) added to it.) * @return AERecordHeaderPtr */ - AERecordHeaderPtr Read(char *raw, std::size_t sz) { - if (!raw) return nullptr; + AERecordHeaderPtr Read(char* raw, std::size_t sz) + { + if (!raw) + return nullptr; - return this->_Read<AERecordHeader>(raw, sz * sizeof(AERecordHeader)); - } + return this->_Read<AERecordHeader>(raw, sz * sizeof(AERecordHeader)); + } - private: - /** + private: + /** * @brief Implementation of Read for raw classes. * * @tparam TypeClass The class to read. @@ -121,10 +133,11 @@ class AEReadableProtocol final { * @param sz the size * @return TypeClass* the returning class. */ - template <typename TypeClass> - TypeClass *_Read(char *raw, std::size_t sz) { - FP.read(raw, std::streamsize(sz)); - return reinterpret_cast<TypeClass *>(raw); - } -}; -} // namespace CompilerKit::Utils + template <typename TypeClass> + TypeClass* _Read(char* raw, std::size_t sz) + { + FP.read(raw, std::streamsize(sz)); + return reinterpret_cast<TypeClass*>(raw); + } + }; +} // namespace CompilerKit::Utils diff --git a/Headers/StdKit/ELF.hpp b/Headers/StdKit/ELF.hpp index 134c823..4f0d0ae 100644 --- a/Headers/StdKit/ELF.hpp +++ b/Headers/StdKit/ELF.hpp @@ -16,207 +16,217 @@ struct file; typedef uint32_t Elf32_Addr; typedef uint16_t Elf32_Half; typedef uint32_t Elf32_Off; -typedef int32_t Elf32_Sword; +typedef int32_t Elf32_Sword; typedef uint32_t Elf32_Word; /* 64-bit ELF base types. */ typedef uintptr_t Elf64_Addr; -typedef uint16_t Elf64_Half; -typedef int16_t Elf64_SHalf; -typedef uint64_t Elf64_Off; -typedef int32_t Elf64_Sword; -typedef uint32_t Elf64_Word; -typedef uint64_t Elf64_Xword; -typedef int64_t Elf64_Sxword; +typedef uint16_t Elf64_Half; +typedef int16_t Elf64_SHalf; +typedef uint64_t Elf64_Off; +typedef int32_t Elf64_Sword; +typedef uint32_t Elf64_Word; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; /* These constants are for the segment types stored in the image headers */ -#define PT_NULL 0 -#define PT_LOAD 1 -#define PT_DYNAMIC 2 -#define PT_INTERP 3 -#define PT_NOTE 4 -#define PT_SHLIB 5 -#define PT_PHDR 6 -#define PT_TLS 7 /* Thread local storage segment */ -#define PT_LOOS 0x60000000 /* OS-specific */ -#define PT_HIOS 0x6fffffff /* OS-specific */ -#define PT_LOPROC 0x70000000 -#define PT_HIPROC 0x7fffffff +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_TLS 7 /* Thread local storage segment */ +#define PT_LOOS 0x60000000 /* OS-specific */ +#define PT_HIOS 0x6fffffff /* OS-specific */ +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff #define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* These constants define the different elf file types */ -#define ET_NONE 0 -#define ET_REL 1 -#define ET_EXEC 2 -#define ET_DYN 3 -#define ET_CORE 4 +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 #define ET_LOPROC 0xff00 #define ET_HIPROC 0xffff /* This is the info that is needed to parse the dynamic section of the file */ -#define DT_NULL 0 -#define DT_NEEDED 1 -#define DT_PLTRELSZ 2 -#define DT_PLTGOT 3 -#define DT_HASH 4 -#define DT_STRTAB 5 -#define DT_SYMTAB 6 -#define DT_RELA 7 -#define DT_RELASZ 8 -#define DT_RELAENT 9 -#define DT_STRSZ 10 -#define DT_SYMENT 11 -#define DT_INIT 12 -#define DT_FINI 13 -#define DT_SONAME 14 -#define DT_RPATH 15 -#define DT_SYMBOLIC 16 -#define DT_REL 17 -#define DT_RELSZ 18 -#define DT_RELENT 19 -#define DT_PLTREL 20 -#define DT_DEBUG 21 -#define DT_TEXTREL 22 -#define DT_JMPREL 23 -#define DT_ENCODING 32 -#define OLD_DT_LOOS 0x60000000 -#define DT_LOOS 0x6000000d -#define DT_HIOS 0x6ffff000 -#define DT_VALRNGLO 0x6ffffd00 -#define DT_VALRNGHI 0x6ffffdff -#define DT_ADDRRNGLO 0x6ffffe00 -#define DT_ADDRRNGHI 0x6ffffeff -#define DT_VERSYM 0x6ffffff0 -#define DT_RELACOUNT 0x6ffffff9 -#define DT_RELCOUNT 0x6ffffffa -#define DT_FLAGS_1 0x6ffffffb -#define DT_VERDEF 0x6ffffffc -#define DT_VERDEFNUM 0x6ffffffd -#define DT_VERNEED 0x6ffffffe +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_ENCODING 32 +#define OLD_DT_LOOS 0x60000000 +#define DT_LOOS 0x6000000d +#define DT_HIOS 0x6ffff000 +#define DT_VALRNGLO 0x6ffffd00 +#define DT_VALRNGHI 0x6ffffdff +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_VERSYM 0x6ffffff0 +#define DT_RELACOUNT 0x6ffffff9 +#define DT_RELCOUNT 0x6ffffffa +#define DT_FLAGS_1 0x6ffffffb +#define DT_VERDEF 0x6ffffffc +#define DT_VERDEFNUM 0x6ffffffd +#define DT_VERNEED 0x6ffffffe #define DT_VERNEEDNUM 0x6fffffff -#define OLD_DT_HIOS 0x6fffffff -#define DT_LOPROC 0x70000000 -#define DT_HIPROC 0x7fffffff +#define OLD_DT_HIOS 0x6fffffff +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff /* This info is needed when parsing the symbol table */ -#define STB_LOCAL 0 +#define STB_LOCAL 0 #define STB_GLOBAL 1 -#define STB_WEAK 2 +#define STB_WEAK 2 -#define STT_NOTYPE 0 -#define STT_OBJECT 1 -#define STT_FUNC 2 +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 #define STT_SECTION 3 -#define STT_FILE 4 -#define STT_COMMON 5 -#define STT_TLS 6 +#define STT_FILE 4 +#define STT_COMMON 5 +#define STT_TLS 6 -#define ELF_ST_BIND(x) ((x) >> 4) -#define ELF_ST_TYPE(x) (((unsigned int)x) & 0xf) +#define ELF_ST_BIND(x) ((x) >> 4) +#define ELF_ST_TYPE(x) (((unsigned int)x) & 0xf) #define ELF32_ST_BIND(x) ELF_ST_BIND(x) #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) #define ELF64_ST_BIND(x) ELF_ST_BIND(x) #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) -typedef struct dynamic { - Elf32_Sword d_tag; - union { - Elf32_Sword d_val; - Elf32_Addr d_ptr; - } d_un; +typedef struct dynamic +{ + Elf32_Sword d_tag; + union { + Elf32_Sword d_val; + Elf32_Addr d_ptr; + } d_un; } Elf32_Dyn; -typedef struct { - Elf64_Sxword d_tag; /* entry tag value */ - union { - Elf64_Xword d_val; - Elf64_Addr d_ptr; - } d_un; +typedef struct +{ + Elf64_Sxword d_tag; /* entry tag value */ + union { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; } Elf64_Dyn; /* The following are used with relocations */ -#define ELF32_R_SYM(x) ((x) >> 8) -#define ELF32_R_TYPE(x) ((x) & 0xff) +#define ELF32_R_SYM(x) ((x) >> 8) +#define ELF32_R_TYPE(x) ((x)&0xff) -#define ELF64_R_SYM(i) ((i) >> 32) -#define ELF64_R_TYPE(i) ((i) & 0xffffffff) +#define ELF64_R_SYM(i) ((i) >> 32) +#define ELF64_R_TYPE(i) ((i)&0xffffffff) -typedef struct elf32_rel { - Elf32_Addr r_offset; - Elf32_Word r_info; +typedef struct elf32_rel +{ + Elf32_Addr r_offset; + Elf32_Word r_info; } Elf32_Rel; -typedef struct elf64_rel { - Elf64_Addr r_offset; /* Location at which to apply the action */ - Elf64_Xword r_info; /* index and type of relocation */ +typedef struct elf64_rel +{ + Elf64_Addr r_offset; /* Location at which to apply the action */ + Elf64_Xword r_info; /* index and type of relocation */ } Elf64_Rel; -typedef struct elf32_rela { - Elf32_Addr r_offset; - Elf32_Word r_info; - Elf32_Sword r_addend; +typedef struct elf32_rela +{ + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; } Elf32_Rela; -typedef struct elf64_rela { - Elf64_Addr r_offset; /* Location at which to apply the action */ - Elf64_Xword r_info; /* index and type of relocation */ - Elf64_Sxword r_addend; /* Constant addend used to compute value */ +typedef struct elf64_rela +{ + Elf64_Addr r_offset; /* Location at which to apply the action */ + Elf64_Xword r_info; /* index and type of relocation */ + Elf64_Sxword r_addend; /* Constant addend used to compute value */ } Elf64_Rela; -typedef struct elf32_sym { - Elf32_Word st_name; - Elf32_Addr st_value; - Elf32_Word st_size; - unsigned char st_info; - unsigned char st_other; - Elf32_Half st_shndx; +typedef struct elf32_sym +{ + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; } Elf32_Sym; -typedef struct elf64_sym { - Elf64_Word st_name; /* Symbol name, index in string tbl */ - unsigned char st_info; /* Type and binding attributes */ - unsigned char st_other; /* No defined meaning, 0 */ - Elf64_Half st_shndx; /* Associated section index */ - Elf64_Addr st_value; /* Value of the symbol */ - Elf64_Xword st_size; /* Associated symbol size */ +typedef struct elf64_sym +{ + Elf64_Word st_name; /* Symbol name, index in string tbl */ + unsigned char st_info; /* Type and binding attributes */ + unsigned char st_other; /* No defined meaning, 0 */ + Elf64_Half st_shndx; /* Associated section index */ + Elf64_Addr st_value; /* Value of the symbol */ + Elf64_Xword st_size; /* Associated symbol size */ } Elf64_Sym; #define EI_NIDENT 16 -typedef struct elf32_hdr { - unsigned char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; /* Entry point */ - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; +typedef struct elf32_hdr +{ + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; /* Entry point */ + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; } Elf32_Ehdr; -typedef struct elf64_hdr { - unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ - Elf64_Half e_type; - Elf64_Half e_machine; - Elf64_Word e_version; - Elf64_Addr e_entry; /* Entry point virtual address */ - Elf64_Off e_phoff; /* Program header table file offset */ - Elf64_Off e_shoff; /* Section header table file offset */ - Elf64_Word e_flags; - Elf64_Half e_ehsize; - Elf64_Half e_phentsize; - Elf64_Half e_phnum; - Elf64_Half e_shentsize; - Elf64_Half e_shnum; - Elf64_Half e_shstrndx; +typedef struct elf64_hdr +{ + unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; /* Entry point virtual address */ + Elf64_Off e_phoff; /* Program header table file offset */ + Elf64_Off e_shoff; /* Section header table file offset */ + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; } Elf64_Ehdr; /* These constants define the permissions on sections in the program @@ -225,119 +235,123 @@ typedef struct elf64_hdr { #define PF_W 0x2 #define PF_X 0x1 -typedef struct elf32_phdr { - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; +typedef struct elf32_phdr +{ + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; } Elf32_Phdr; -typedef struct elf64_phdr { - Elf64_Word p_type; - Elf64_Word p_flags; - Elf64_Off p_offset; /* Segment file offset */ - Elf64_Addr p_vaddr; /* Segment virtual address */ - Elf64_Addr p_paddr; /* Segment physical address */ - Elf64_Xword p_filesz; /* Segment size in file */ - Elf64_Xword p_memsz; /* Segment size in memory */ - Elf64_Xword p_align; /* Segment alignment, file & memory */ +typedef struct elf64_phdr +{ + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; /* Segment file offset */ + Elf64_Addr p_vaddr; /* Segment virtual address */ + Elf64_Addr p_paddr; /* Segment physical address */ + Elf64_Xword p_filesz; /* Segment size in file */ + Elf64_Xword p_memsz; /* Segment size in memory */ + Elf64_Xword p_align; /* Segment alignment, file & memory */ } Elf64_Phdr; /* sh_type */ -#define SHT_NULL 0 +#define SHT_NULL 0 #define SHT_PROGBITS 1 -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_RELA 4 -#define SHT_HASH 5 -#define SHT_DYNAMIC 6 -#define SHT_NOTE 7 -#define SHT_NOBITS 8 -#define SHT_REL 9 -#define SHT_SHLIB 10 -#define SHT_DYNSYM 11 -#define SHT_NUM 12 -#define SHT_LOPROC 0x70000000 -#define SHT_HIPROC 0x7fffffff -#define SHT_LOUSER 0x80000000 -#define SHT_HIUSER 0xffffffff +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_NUM 12 +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0xffffffff /* sh_flags */ -#define SHF_WRITE 0x1 -#define SHF_ALLOC 0x2 +#define SHF_WRITE 0x1 +#define SHF_ALLOC 0x2 #define SHF_EXECINSTR 0x4 -#define SHF_MASKPROC 0xf0000000 +#define SHF_MASKPROC 0xf0000000 /* special section indexes */ -#define SHN_UNDEF 0 +#define SHN_UNDEF 0 #define SHN_LORESERVE 0xff00 -#define SHN_LOPROC 0xff00 -#define SHN_HIPROC 0xff1f -#define SHN_ABS 0xfff1 -#define SHN_COMMON 0xfff2 +#define SHN_LOPROC 0xff00 +#define SHN_HIPROC 0xff1f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 #define SHN_HIRESERVE 0xffff -typedef struct { - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; +typedef struct +{ + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; } Elf32_Shdr; -typedef struct elf64_shdr { - Elf64_Word sh_name; /* Section name, index in string tbl */ - Elf64_Word sh_type; /* Type of section */ - Elf64_Xword sh_flags; /* Miscellaneous section attributes */ - Elf64_Addr sh_addr; /* Section virtual addr at execution */ - Elf64_Off sh_offset; /* Section file offset */ - Elf64_Xword sh_size; /* Size of section in bytes */ - Elf64_Word sh_link; /* Index of another section */ - Elf64_Word sh_info; /* Additional section information */ - Elf64_Xword sh_addralign; /* Section alignment */ - Elf64_Xword sh_entsize; /* Entry size if section holds table */ +typedef struct elf64_shdr +{ + Elf64_Word sh_name; /* Section name, index in string tbl */ + Elf64_Word sh_type; /* Type of section */ + Elf64_Xword sh_flags; /* Miscellaneous section attributes */ + Elf64_Addr sh_addr; /* Section virtual addr at execution */ + Elf64_Off sh_offset; /* Section file offset */ + Elf64_Xword sh_size; /* Size of section in bytes */ + Elf64_Word sh_link; /* Index of another section */ + Elf64_Word sh_info; /* Additional section information */ + Elf64_Xword sh_addralign; /* Section alignment */ + Elf64_Xword sh_entsize; /* Entry size if section holds table */ } Elf64_Shdr; -#define EI_MAG0 0 /* e_ident[] indexes */ -#define EI_MAG1 1 -#define EI_MAG2 2 -#define EI_MAG3 3 -#define EI_CLASS 4 -#define EI_DATA 5 +#define EI_MAG0 0 /* e_ident[] indexes */ +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 +#define EI_CLASS 4 +#define EI_DATA 5 #define EI_VERSION 6 -#define EI_OSABI 7 -#define EI_PAD 8 +#define EI_OSABI 7 +#define EI_PAD 8 #define ELFMAG0 0x7f /* EI_MAG */ #define ELFMAG1 'E' #define ELFMAG2 'L' #define ELFMAG3 'F' -#define ELFMAG "\177ELF" +#define ELFMAG "\177ELF" #define SELFMAG 4 #define ELFCLASSNONE 0 /* EI_CLASS */ -#define ELFCLASS32 1 -#define ELFCLASS64 2 -#define ELFCLASSNUM 3 +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 #define ELFDATANONE 0 /* e_ident[EI_DATA] */ #define ELFDATA2LSB 1 #define ELFDATA2MSB 2 -#define EV_NONE 0 /* e_version, EI_VERSION */ +#define EV_NONE 0 /* e_version, EI_VERSION */ #define EV_CURRENT 1 -#define EV_NUM 2 +#define EV_NUM 2 -#define ELFOSABI_NONE 0 +#define ELFOSABI_NONE 0 #define ELFOSABI_LINUX 3 #ifndef ELF_OSABI @@ -345,29 +359,31 @@ typedef struct elf64_shdr { #endif /* Notes used in ET_CORE */ -#define NT_PRSTATUS 1 -#define NT_PRFPREG 2 -#define NT_PRPSINFO 3 +#define NT_PRSTATUS 1 +#define NT_PRFPREG 2 +#define NT_PRPSINFO 3 #define NT_TASKSTRUCT 4 -#define NT_AUXV 6 -#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ -#define NT_PPC_VMX 0x100 /* POWER Altivec/VMX registers */ -#define NT_PPC_SPE 0x101 /* POWER SPE/EVR registers */ -#define NT_PPC_VSX 0x102 /* POWER VSX registers */ -#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ -#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ -#define NT_PRXSTATUS 0x300 /* s390 upper register halves */ +#define NT_AUXV 6 +#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ +#define NT_PPC_VMX 0x100 /* POWER Altivec/VMX registers */ +#define NT_PPC_SPE 0x101 /* POWER SPE/EVR registers */ +#define NT_PPC_VSX 0x102 /* POWER VSX registers */ +#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ +#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ +#define NT_PRXSTATUS 0x300 /* s390 upper register halves */ /* Note header in a PT_NOTE section */ -typedef struct elf32_note { - Elf32_Word n_namesz; /* Name size */ - Elf32_Word n_descsz; /* Content size */ - Elf32_Word n_type; /* Content type */ +typedef struct elf32_note +{ + Elf32_Word n_namesz; /* Name size */ + Elf32_Word n_descsz; /* Content size */ + Elf32_Word n_type; /* Content type */ } Elf32_Nhdr; /* Note header in a PT_NOTE section */ -typedef struct elf64_note { - Elf64_Word n_namesz; /* Name size */ - Elf64_Word n_descsz; /* Content size */ - Elf64_Word n_type; /* Content type */ +typedef struct elf64_note +{ + Elf64_Word n_namesz; /* Name size */ + Elf64_Word n_descsz; /* Content size */ + Elf64_Word n_type; /* Content type */ } Elf64_Nhdr; diff --git a/Headers/StdKit/ErrorID.hpp b/Headers/StdKit/ErrorID.hpp index ae27c12..363f4d5 100644 --- a/Headers/StdKit/ErrorID.hpp +++ b/Headers/StdKit/ErrorID.hpp @@ -12,11 +12,11 @@ #include <Headers/Defines.hpp> #include <Headers/StdKit/ErrorOr.hpp> -#define MPCC_EXEC_ERROR -30 +#define MPCC_EXEC_ERROR -30 #define MPCC_FILE_NOT_FOUND -31 -#define MPCC_DIR_NOT_FOUND -32 -#define MPCC_FILE_EXISTS -33 -#define MPCC_TOO_LONG -34 -#define MPCC_INVALID_DATA -35 -#define MPCC_UNIMPLEMENTED -36 -#define MPCC_FAT_ERROR -37 +#define MPCC_DIR_NOT_FOUND -32 +#define MPCC_FILE_EXISTS -33 +#define MPCC_TOO_LONG -34 +#define MPCC_INVALID_DATA -35 +#define MPCC_UNIMPLEMENTED -36 +#define MPCC_FAT_ERROR -37 diff --git a/Headers/StdKit/ErrorOr.hpp b/Headers/StdKit/ErrorOr.hpp index 8ca9845..dbd83ce 100644 --- a/Headers/StdKit/ErrorOr.hpp +++ b/Headers/StdKit/ErrorOr.hpp @@ -12,34 +12,50 @@ #include <Headers/Defines.hpp> #include <Headers/StdKit/Ref.hpp> -namespace CompilerKit { -using ErrorT = UInt32; - -template <typename T> -class ErrorOr final { - public: - ErrorOr() = default; - ~ErrorOr() = default; - - public: - explicit ErrorOr(Int32 err) : mId(err) {} - - explicit ErrorOr(nullPtr Null) {} - - explicit ErrorOr(T Class) : mRef(Class) {} - - ErrorOr &operator=(const ErrorOr &) = default; - ErrorOr(const ErrorOr &) = default; - - Ref<T> Leak() { return mRef; } - - operator bool() { return mRef; } - - private: - Ref<T> mRef; - Int32 mId{0}; -}; - -using ErrorOrAny = ErrorOr<voidPtr>; - -} // namespace CompilerKit +namespace CompilerKit +{ + using ErrorT = UInt32; + + template <typename T> + class ErrorOr final + { + public: + ErrorOr() = default; + ~ErrorOr() = default; + + public: + explicit ErrorOr(Int32 err) + : mId(err) + { + } + + explicit ErrorOr(nullPtr Null) + { + } + + explicit ErrorOr(T Class) + : mRef(Class) + { + } + + ErrorOr& operator=(const ErrorOr&) = default; + ErrorOr(const ErrorOr&) = default; + + Ref<T> Leak() + { + return mRef; + } + + operator bool() + { + return mRef; + } + + private: + Ref<T> mRef; + Int32 mId{0}; + }; + + using ErrorOrAny = ErrorOr<voidPtr>; + +} // namespace CompilerKit diff --git a/Headers/StdKit/PEF.hpp b/Headers/StdKit/PEF.hpp index 3e646a7..6f0602c 100644 --- a/Headers/StdKit/PEF.hpp +++ b/Headers/StdKit/PEF.hpp @@ -11,14 +11,14 @@ // @file PEF.hpp // @brief Preferred Executable Format -#define kPefMagic "Joy!" +#define kPefMagic "Joy!" #define kPefMagicFat "yoJ!" -#define kPefExt ".exec" -#define kPefDylibExt ".lib" -#define kPefLibExt ".slib" +#define kPefExt ".exec" +#define kPefDylibExt ".lib" +#define kPefLibExt ".slib" #define kPefObjectExt ".obj" -#define kPefDebugExt ".dbg" +#define kPefDebugExt ".dbg" #define kPefMagicLen 5 @@ -29,93 +29,104 @@ #define kPefStart "__ImageStart" -namespace CompilerKit { -enum { - kPefArchIntel86S = 100, - kPefArchAMD64, - kPefArchRISCV, - kPefArch64000, /* 64x0 RISC architecture. */ - kPefArch32000, - kPefArchPowerPC, /* 64-bit POWER architecture. */ - kPefArchCount = (kPefArchPowerPC - kPefArchIntel86S) + 1, - kPefArchInvalid = 0xFF, -}; - -enum { - kPefSubArchAMD, - kPefSubArchIntel, - kPefSubArchARM, - kPefSubArchIBM, -}; - -enum { - kPefKindExec = 1, /* .exe */ - kPefKindSharedObject = 2, /* .lib */ - kPefKindObject = 4, /* .obj */ - kPefKindDebug = 5, /* .dbg */ - kPefKindDriver = 6, - kPefKindCount, -}; - -/* PEF container */ -typedef struct PEFContainer final { - CharType Magic[kPefMagicLen]; - UInt32 Linker; - UInt32 Version; - UInt32 Kind; - UInt32 Abi; - UInt32 Cpu; - UInt32 SubCpu; /* Cpu specific information */ - UIntPtr Start; /* Origin of code */ - SizeType HdrSz; /* Size of header */ - SizeType Count; /* container header count */ -} PACKED PEFContainer; - -/* First PEFCommandHeader starts after PEFContainer */ -/* Last container is __exec_end */ - -/* PEF executable section and commands. */ - -typedef struct PEFCommandHeader final { - CharType Name[kPefNameLen]; /* container name */ - UInt32 Cpu; /* container cpu */ - UInt32 SubCpu; /* container sub-cpu */ - UInt32 Flags; /* container flags */ - UInt16 Kind; /* container kind */ - UIntPtr Offset; /* file offset */ - SizeType Size; /* file size */ -} PACKED PEFCommandHeader; - -enum { - kPefCode = 0xC, - kPefData = 0xD, - kPefZero = 0xE, - kPefLinkerID = 0x1, - kPefCount = 4, - kPefInvalid = 0xFF, -}; -} // namespace CompilerKit - -inline std::ofstream& operator<<(std::ofstream& fp, - CompilerKit::PEFContainer& container) { - fp.write((char*)&container, sizeof(CompilerKit::PEFContainer)); - return fp; +namespace CompilerKit +{ + enum + { + kPefArchIntel86S = 100, + kPefArchAMD64, + kPefArchRISCV, + kPefArch64000, /* 64x0 RISC architecture. */ + kPefArch32000, + kPefArchPowerPC, /* 64-bit POWER architecture. */ + kPefArchCount = (kPefArchPowerPC - kPefArchIntel86S) + 1, + kPefArchInvalid = 0xFF, + }; + + enum + { + kPefSubArchAMD, + kPefSubArchIntel, + kPefSubArchARM, + kPefSubArchIBM, + }; + + enum + { + kPefKindExec = 1, /* .exe */ + kPefKindSharedObject = 2, /* .lib */ + kPefKindObject = 4, /* .obj */ + kPefKindDebug = 5, /* .dbg */ + kPefKindDriver = 6, + kPefKindCount, + }; + + /* PEF container */ + typedef struct PEFContainer final + { + CharType Magic[kPefMagicLen]; + UInt32 Linker; + UInt32 Version; + UInt32 Kind; + UInt32 Abi; + UInt32 Cpu; + UInt32 SubCpu; /* Cpu specific information */ + UIntPtr Start; /* Origin of code */ + SizeType HdrSz; /* Size of header */ + SizeType Count; /* container header count */ + } PACKED PEFContainer; + + /* First PEFCommandHeader starts after PEFContainer */ + /* Last container is __exec_end */ + + /* PEF executable section and commands. */ + + typedef struct PEFCommandHeader final + { + CharType Name[kPefNameLen]; /* container name */ + UInt32 Cpu; /* container cpu */ + UInt32 SubCpu; /* container sub-cpu */ + UInt32 Flags; /* container flags */ + UInt16 Kind; /* container kind */ + UIntPtr Offset; /* file offset */ + SizeType Size; /* file size */ + } PACKED PEFCommandHeader; + + enum + { + kPefCode = 0xC, + kPefData = 0xD, + kPefZero = 0xE, + kPefLinkerID = 0x1, + kPefCount = 4, + kPefInvalid = 0xFF, + }; +} // namespace CompilerKit + +inline std::ofstream& operator<<(std::ofstream& fp, + CompilerKit::PEFContainer& container) +{ + fp.write((char*)&container, sizeof(CompilerKit::PEFContainer)); + return fp; } -inline std::ofstream& operator<<(std::ofstream& fp, - CompilerKit::PEFCommandHeader& container) { - fp.write((char*)&container, sizeof(CompilerKit::PEFCommandHeader)); - return fp; +inline std::ofstream& operator<<(std::ofstream& fp, + CompilerKit::PEFCommandHeader& container) +{ + fp.write((char*)&container, sizeof(CompilerKit::PEFCommandHeader)); + return fp; } -std::ifstream& operator>>(std::ifstream& fp, - CompilerKit::PEFContainer& container) { - fp.read((char*)&container, sizeof(CompilerKit::PEFContainer)); - return fp; +std::ifstream& operator>>(std::ifstream& fp, + CompilerKit::PEFContainer& container) +{ + fp.read((char*)&container, sizeof(CompilerKit::PEFContainer)); + return fp; } -std::ifstream& operator>>(std::ifstream& fp, - CompilerKit::PEFCommandHeader& container) { - fp.read((char*)&container, sizeof(CompilerKit::PEFCommandHeader)); - return fp; +std::ifstream& operator>>(std::ifstream& fp, + CompilerKit::PEFCommandHeader& container) +{ + fp.read((char*)&container, sizeof(CompilerKit::PEFCommandHeader)); + return fp; } diff --git a/Headers/StdKit/Ref.hpp b/Headers/StdKit/Ref.hpp index 69c8a21..c4aa2d3 100644 --- a/Headers/StdKit/Ref.hpp +++ b/Headers/StdKit/Ref.hpp @@ -10,57 +10,82 @@ #pragma once -namespace CompilerKit { -// @author Amlal EL Mahrouss -// @brief Reference class, refers to a pointer of data in static memory. -template <typename T> -class Ref final { - public: - explicit Ref() = default; - ~Ref() = default; - - public: - explicit Ref(T cls, const bool &strong = false) - : m_Class(cls), m_Strong(strong) {} - - Ref &operator=(T ref) { - m_Class = ref; - return *this; - } - - public: - T operator->() const { return m_Class; } - - T &Leak() { return m_Class; } - - T operator*() { return m_Class; } - - bool IsStrong() const { return m_Strong; } - - operator bool() { return m_Class; } - - private: - T m_Class; - bool m_Strong{false}; -}; - -template <typename T> -class NonNullRef final { - public: - NonNullRef() = delete; - NonNullRef(nullPtr) = delete; - - explicit NonNullRef(T *ref) : m_Ref(ref, true) {} - - Ref<T> &operator->() { - MUST_PASS(m_Ref); - return m_Ref; - } - - NonNullRef &operator=(const NonNullRef<T> &ref) = delete; - NonNullRef(const NonNullRef<T> &ref) = default; - - private: - Ref<T> m_Ref{nullptr}; -}; -} // namespace CompilerKit +namespace CompilerKit +{ + // @author Amlal EL Mahrouss + // @brief Reference class, refers to a pointer of data in static memory. + template <typename T> + class Ref final + { + public: + explicit Ref() = default; + ~Ref() = default; + + public: + explicit Ref(T cls, const bool& strong = false) + : m_Class(cls), m_Strong(strong) + { + } + + Ref& operator=(T ref) + { + m_Class = ref; + return *this; + } + + public: + T operator->() const + { + return m_Class; + } + + T& Leak() + { + return m_Class; + } + + T operator*() + { + return m_Class; + } + + bool IsStrong() const + { + return m_Strong; + } + + operator bool() + { + return m_Class; + } + + private: + T m_Class; + bool m_Strong{false}; + }; + + template <typename T> + class NonNullRef final + { + public: + NonNullRef() = delete; + NonNullRef(nullPtr) = delete; + + explicit NonNullRef(T* ref) + : m_Ref(ref, true) + { + } + + Ref<T>& operator->() + { + MUST_PASS(m_Ref); + return m_Ref; + } + + NonNullRef& operator=(const NonNullRef<T>& ref) = delete; + NonNullRef(const NonNullRef<T>& ref) = default; + + private: + Ref<T> m_Ref{nullptr}; + }; +} // namespace CompilerKit diff --git a/Headers/StdKit/String.hpp b/Headers/StdKit/String.hpp index 6cc8ac4..adc6a9d 100644 --- a/Headers/StdKit/String.hpp +++ b/Headers/StdKit/String.hpp @@ -12,66 +12,79 @@ #include <Headers/Defines.hpp> #include <Headers/StdKit/ErrorOr.hpp> -namespace CompilerKit { -/** +namespace CompilerKit +{ + /** * @brief StringView class, contains a C string and manages it. * @note No need to manage it it's getting deleted by default. */ -class StringView final { - public: - explicit StringView() = delete; + class StringView final + { + public: + explicit StringView() = delete; - explicit StringView(SizeType Sz) noexcept : m_Sz(Sz) { - m_Data = new char[Sz]; - assert(m_Data); - } + explicit StringView(SizeType Sz) noexcept + : m_Sz(Sz) + { + m_Data = new char[Sz]; + assert(m_Data); + } - ~StringView() noexcept { - if (m_Data) { - memset(m_Data, 0, m_Sz); - delete[] m_Data; + ~StringView() noexcept + { + if (m_Data) + { + memset(m_Data, 0, m_Sz); + delete[] m_Data; - m_Data = nullptr; - } - } + m_Data = nullptr; + } + } - MPCC_COPY_DEFAULT(StringView); + MPCC_COPY_DEFAULT(StringView); - CharType *Data(); - const CharType *CData() const; - SizeType Length() const; + CharType* Data(); + const CharType* CData() const; + SizeType Length() const; - bool operator==(const CharType *rhs) const; - bool operator!=(const CharType *rhs) const; + bool operator==(const CharType* rhs) const; + bool operator!=(const CharType* rhs) const; - bool operator==(const StringView &rhs) const; - bool operator!=(const StringView &rhs) const; + bool operator==(const StringView& rhs) const; + bool operator!=(const StringView& rhs) const; - StringView &operator+=(const CharType *rhs); - StringView &operator+=(const StringView &rhs); + StringView& operator+=(const CharType* rhs); + StringView& operator+=(const StringView& rhs); - operator bool() { return m_Data && m_Data[0] != 0; } + operator bool() + { + return m_Data && m_Data[0] != 0; + } - bool operator!() { return !m_Data || m_Data[0] == 0; } + bool operator!() + { + return !m_Data || m_Data[0] == 0; + } - private: - char *m_Data{nullptr}; - SizeType m_Sz{0}; - SizeType m_Cur{0}; + private: + char* m_Data{nullptr}; + SizeType m_Sz{0}; + SizeType m_Cur{0}; - friend class StringBuilder; -}; + friend class StringBuilder; + }; -/** + /** * @brief StringBuilder class * @note These results shall call delete[] after they're used. */ -struct StringBuilder final { - static StringView Construct(const CharType *data); - static const char *FromInt(const char *fmt, int n); - static const char *FromBool(const char *fmt, bool n); - static const char *Format(const char *fmt, const char *from); - static bool Equals(const char *lhs, const char *rhs); -}; -} // namespace CompilerKit + struct StringBuilder final + { + static StringView Construct(const CharType* data); + static const char* FromInt(const char* fmt, int n); + static const char* FromBool(const char* fmt, bool n); + static const char* Format(const char* fmt, const char* from); + static bool Equals(const char* lhs, const char* rhs); + }; +} // namespace CompilerKit diff --git a/Headers/StdKit/XCOFF.hxx b/Headers/StdKit/XCOFF.hxx index cb37c55..e21a380 100644 --- a/Headers/StdKit/XCOFF.hxx +++ b/Headers/StdKit/XCOFF.hxx @@ -18,22 +18,24 @@ #define kXCOFF64Magic 0x01F7 -#define kXCOFFRelFlg 0x0001 +#define kXCOFFRelFlg 0x0001 #define kXCOFFExecutable 0x0002 -#define kXCOFFLnno 0x0004 -#define kXCOFFLSyms 0x0008 - -namespace CompilerKit { -/// @brief XCoff identification header. -typedef struct XCoffFileHeader { - UInt16 fMagic; - UInt16 fTarget; - UInt16 fNumSecs; - UInt32 fTimeDat; - UIntPtr fSymPtr; - UInt32 fNumSyms; - UInt16 fOptHdr; // ?: Number of bytes in optional header -} XCoffFileHeader; -} // namespace CompilerKit - -#endif // ifndef __XCOFF__
\ No newline at end of file +#define kXCOFFLnno 0x0004 +#define kXCOFFLSyms 0x0008 + +namespace CompilerKit +{ + /// @brief XCoff identification header. + typedef struct XCoffFileHeader + { + UInt16 fMagic; + UInt16 fTarget; + UInt16 fNumSecs; + UInt32 fTimeDat; + UIntPtr fSymPtr; + UInt32 fNumSyms; + UInt16 fOptHdr; // ?: Number of bytes in optional header + } XCoffFileHeader; +} // namespace CompilerKit + +#endif // ifndef __XCOFF__
\ No newline at end of file diff --git a/Headers/UUID.hpp b/Headers/UUID.hpp index e283571..00b153b 100644 --- a/Headers/UUID.hpp +++ b/Headers/UUID.hpp @@ -63,803 +63,921 @@ #endif -namespace uuids { +namespace uuids +{ #ifdef __cpp_lib_span -template <class ElementType, std::size_t Extent> -using span = std::span<ElementType, Extent>; + template <class ElementType, std::size_t Extent> + using span = std::span<ElementType, Extent>; #else -template <class ElementType, std::ptrdiff_t Extent> -using span = gsl::span<ElementType, Extent>; + template <class ElementType, std::ptrdiff_t Extent> + using span = gsl::span<ElementType, Extent>; #endif -namespace detail { -template <typename TChar> -[[nodiscard]] constexpr inline unsigned char hex2char(TChar const ch) noexcept { - if (ch >= static_cast<TChar>('0') && ch <= static_cast<TChar>('9')) - return static_cast<unsigned char>(ch - static_cast<TChar>('0')); - if (ch >= static_cast<TChar>('a') && ch <= static_cast<TChar>('f')) - return static_cast<unsigned char>(10 + ch - static_cast<TChar>('a')); - if (ch >= static_cast<TChar>('A') && ch <= static_cast<TChar>('F')) - return static_cast<unsigned char>(10 + ch - static_cast<TChar>('A')); - return 0; -} - -template <typename TChar> -[[nodiscard]] constexpr inline bool is_hex(TChar const ch) noexcept { - return (ch >= static_cast<TChar>('0') && ch <= static_cast<TChar>('9')) || - (ch >= static_cast<TChar>('a') && ch <= static_cast<TChar>('f')) || - (ch >= static_cast<TChar>('A') && ch <= static_cast<TChar>('F')); -} - -template <typename TChar> -[[nodiscard]] constexpr std::basic_string_view<TChar> to_string_view( - TChar const* str) noexcept { - if (str) return str; - return {}; -} - -template <typename StringType> -[[nodiscard]] constexpr std::basic_string_view<typename StringType::value_type, - typename StringType::traits_type> -to_string_view(StringType const& str) noexcept { - return str; -} - -class sha1 { - public: - using digest32_t = uint32_t[5]; - using digest8_t = uint8_t[20]; - - static constexpr unsigned int block_bytes = 64; - - [[nodiscard]] inline static uint32_t left_rotate( - uint32_t value, size_t const count) noexcept { - return (value << count) ^ (value >> (32 - count)); - } - - sha1() { reset(); } - - void reset() noexcept { - m_digest[0] = 0x67452301; - m_digest[1] = 0xEFCDAB89; - m_digest[2] = 0x98BADCFE; - m_digest[3] = 0x10325476; - m_digest[4] = 0xC3D2E1F0; - m_blockByteIndex = 0; - m_byteCount = 0; - } - - void process_byte(uint8_t octet) { - this->m_block[this->m_blockByteIndex++] = octet; - ++this->m_byteCount; - if (m_blockByteIndex == block_bytes) { - this->m_blockByteIndex = 0; - process_block(); - } - } - - void process_block(void const* const start, void const* const end) { - const uint8_t* begin = static_cast<const uint8_t*>(start); - const uint8_t* finish = static_cast<const uint8_t*>(end); - while (begin != finish) { - process_byte(*begin); - begin++; - } - } - - void process_bytes(void const* const data, size_t const len) { - const uint8_t* block = static_cast<const uint8_t*>(data); - process_block(block, block + len); - } - - uint32_t const* get_digest(digest32_t digest) { - size_t const bitCount = this->m_byteCount * 8; - process_byte(0x80); - if (this->m_blockByteIndex > 56) { - while (m_blockByteIndex != 0) { - process_byte(0); - } - while (m_blockByteIndex < 56) { - process_byte(0); - } - } else { - while (m_blockByteIndex < 56) { - process_byte(0); - } - } - process_byte(0); - process_byte(0); - process_byte(0); - process_byte(0); - process_byte(static_cast<unsigned char>((bitCount >> 24) & 0xFF)); - process_byte(static_cast<unsigned char>((bitCount >> 16) & 0xFF)); - process_byte(static_cast<unsigned char>((bitCount >> 8) & 0xFF)); - process_byte(static_cast<unsigned char>((bitCount) & 0xFF)); - - memcpy(digest, m_digest, 5 * sizeof(uint32_t)); - return digest; - } - - uint8_t const* get_digest_bytes(digest8_t digest) { - digest32_t d32; - get_digest(d32); - size_t di = 0; - digest[di++] = static_cast<uint8_t>(d32[0] >> 24); - digest[di++] = static_cast<uint8_t>(d32[0] >> 16); - digest[di++] = static_cast<uint8_t>(d32[0] >> 8); - digest[di++] = static_cast<uint8_t>(d32[0] >> 0); - - digest[di++] = static_cast<uint8_t>(d32[1] >> 24); - digest[di++] = static_cast<uint8_t>(d32[1] >> 16); - digest[di++] = static_cast<uint8_t>(d32[1] >> 8); - digest[di++] = static_cast<uint8_t>(d32[1] >> 0); - - digest[di++] = static_cast<uint8_t>(d32[2] >> 24); - digest[di++] = static_cast<uint8_t>(d32[2] >> 16); - digest[di++] = static_cast<uint8_t>(d32[2] >> 8); - digest[di++] = static_cast<uint8_t>(d32[2] >> 0); - - digest[di++] = static_cast<uint8_t>(d32[3] >> 24); - digest[di++] = static_cast<uint8_t>(d32[3] >> 16); - digest[di++] = static_cast<uint8_t>(d32[3] >> 8); - digest[di++] = static_cast<uint8_t>(d32[3] >> 0); - - digest[di++] = static_cast<uint8_t>(d32[4] >> 24); - digest[di++] = static_cast<uint8_t>(d32[4] >> 16); - digest[di++] = static_cast<uint8_t>(d32[4] >> 8); - digest[di++] = static_cast<uint8_t>(d32[4] >> 0); - - return digest; - } - - private: - void process_block() { - uint32_t w[80]; - for (size_t i = 0; i < 16; i++) { - w[i] = static_cast<uint32_t>(m_block[i * 4 + 0] << 24); - w[i] |= static_cast<uint32_t>(m_block[i * 4 + 1] << 16); - w[i] |= static_cast<uint32_t>(m_block[i * 4 + 2] << 8); - w[i] |= static_cast<uint32_t>(m_block[i * 4 + 3]); - } - for (size_t i = 16; i < 80; i++) { - w[i] = left_rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]), 1); - } - - uint32_t a = m_digest[0]; - uint32_t b = m_digest[1]; - uint32_t c = m_digest[2]; - uint32_t d = m_digest[3]; - uint32_t e = m_digest[4]; - - for (std::size_t i = 0; i < 80; ++i) { - uint32_t f = 0; - uint32_t k = 0; - - if (i < 20) { - f = (b & c) | (~b & d); - k = 0x5A827999; - } else if (i < 40) { - f = b ^ c ^ d; - k = 0x6ED9EBA1; - } else if (i < 60) { - f = (b & c) | (b & d) | (c & d); - k = 0x8F1BBCDC; - } else { - f = b ^ c ^ d; - k = 0xCA62C1D6; - } - uint32_t temp = left_rotate(a, 5) + f + e + k + w[i]; - e = d; - d = c; - c = left_rotate(b, 30); - b = a; - a = temp; - } - - m_digest[0] += a; - m_digest[1] += b; - m_digest[2] += c; - m_digest[3] += d; - m_digest[4] += e; - } - - private: - digest32_t m_digest; - uint8_t m_block[64]; - size_t m_blockByteIndex; - size_t m_byteCount; -}; - -template <typename CharT> -inline constexpr CharT empty_guid[37] = "00000000-0000-0000-0000-000000000000"; - -template <> -inline constexpr wchar_t empty_guid<wchar_t>[37] = - L"00000000-0000-0000-0000-000000000000"; - -template <typename CharT> -inline constexpr CharT guid_encoder[17] = "0123456789abcdef"; - -template <> -inline constexpr wchar_t guid_encoder<wchar_t>[17] = L"0123456789abcdef"; -} // namespace detail - -// -------------------------------------------------------------------------------------------------------------------------- -// UUID format https://tools.ietf.org/html/rfc4122 -// -------------------------------------------------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------------------------------------------------- -// Field NDR Data Type Octet # Note -// -------------------------------------------------------------------------------------------------------------------------- -// time_low unsigned long 0 - 3 The low field -// of the timestamp. time_mid unsigned short 4 - 5 -// The middle field of the timestamp. time_hi_and_version unsigned -// short 6 - 7 The high field of the timestamp multiplexed -// with the version number. clock_seq_hi_and_reserved unsigned small 8 -// The high field of the clock sequence multiplexed with the variant. -// clock_seq_low unsigned small 9 The low -// field of the clock sequence. node character 10 -// - 15 The spatially unique node identifier. -// -------------------------------------------------------------------------------------------------------------------------- -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | time_low | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | time_mid | time_hi_and_version | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// |clk_seq_hi_res | clk_seq_low | node (0-1) | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | node (2-5) | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -// -------------------------------------------------------------------------------------------------------------------------- -// enumerations -// -------------------------------------------------------------------------------------------------------------------------- - -// indicated by a bit pattern in octet 8, marked with N in -// xxxxxxxx-xxxx-xxxx-Nxxx-xxxxxxxxxxxx -enum class uuid_variant { - // NCS backward compatibility (with the obsolete Apollo Network Computing - // System 1.5 UUID format) N bit pattern: 0xxx > the first 6 octets of the - // UUID are a 48-bit timestamp (the number of 4 microsecond units of time - // since 1 Jan 1980 UTC); > the next 2 octets are reserved; > the next octet - // is the "address family"; > the final 7 octets are a 56-bit host ID in the - // form specified by the address family - ncs, - - // RFC 4122/DCE 1.1 - // N bit pattern: 10xx - // > big-endian byte order - rfc, - - // Microsoft Corporation backward compatibility - // N bit pattern: 110x - // > little endian byte order - // > formely used in the Component Object Model (COM) library - microsoft, - - // reserved for possible future definition - // N bit pattern: 111x - reserved -}; - -// indicated by a bit pattern in octet 6, marked with M in -// xxxxxxxx-xxxx-Mxxx-xxxx-xxxxxxxxxxxx -enum class uuid_version { - none = 0, // only possible for nil or invalid uuids - time_based = 1, // The time-based version specified in RFC 4122 - dce_security = 2, // DCE Security version, with embedded POSIX UIDs. - name_based_md5 = - 3, // The name-based version specified in RFS 4122 with MD5 hashing - random_number_based = 4, // The randomly or pseudo-randomly generated version - // specified in RFS 4122 - name_based_sha1 = - 5 // The name-based version specified in RFS 4122 with SHA1 hashing -}; - -// Forward declare uuid & to_string so that we can declare to_string as a friend -// later. -class uuid; -template <class CharT = char, class Traits = std::char_traits<CharT>, - class Allocator = std::allocator<CharT>> -std::basic_string<CharT, Traits, Allocator> to_string(uuid const& id); - -// -------------------------------------------------------------------------------------------------------------------------- -// uuid class -// -------------------------------------------------------------------------------------------------------------------------- -class uuid { - public: - using value_type = uint8_t; - - constexpr uuid() noexcept = default; - - uuid(value_type (&arr)[16]) noexcept { - std::copy(std::cbegin(arr), std::cend(arr), std::begin(data)); - } - - constexpr uuid(std::array<value_type, 16> const& arr) noexcept : data{arr} {} - - explicit uuid(span<value_type, 16> bytes) { - std::copy(std::cbegin(bytes), std::cend(bytes), std::begin(data)); - } - - template <typename ForwardIterator> - explicit uuid(ForwardIterator first, ForwardIterator last) { - if (std::distance(first, last) == 16) - std::copy(first, last, std::begin(data)); - } - - [[nodiscard]] constexpr uuid_variant variant() const noexcept { - if ((data[8] & 0x80) == 0x00) - return uuid_variant::ncs; - else if ((data[8] & 0xC0) == 0x80) - return uuid_variant::rfc; - else if ((data[8] & 0xE0) == 0xC0) - return uuid_variant::microsoft; - else - return uuid_variant::reserved; - } - - [[nodiscard]] constexpr uuid_version version() const noexcept { - if ((data[6] & 0xF0) == 0x10) - return uuid_version::time_based; - else if ((data[6] & 0xF0) == 0x20) - return uuid_version::dce_security; - else if ((data[6] & 0xF0) == 0x30) - return uuid_version::name_based_md5; - else if ((data[6] & 0xF0) == 0x40) - return uuid_version::random_number_based; - else if ((data[6] & 0xF0) == 0x50) - return uuid_version::name_based_sha1; - else - return uuid_version::none; - } - - [[nodiscard]] constexpr bool is_nil() const noexcept { - for (size_t i = 0; i < data.size(); ++i) - if (data[i] != 0) return false; - return true; - } - - void swap(uuid& other) noexcept { data.swap(other.data); } - - [[nodiscard]] inline span<std::byte const, 16> as_bytes() const { - return span<std::byte const, 16>( - reinterpret_cast<std::byte const*>(data.data()), 16); - } - - template <typename StringType> - [[nodiscard]] constexpr static bool is_valid_uuid( - StringType const& in_str) noexcept { - auto str = detail::to_string_view(in_str); - bool firstDigit = true; - size_t hasBraces = 0; - size_t index = 0; - - if (str.empty()) return false; - - if (str.front() == '{') hasBraces = 1; - if (hasBraces && str.back() != '}') return false; - - for (size_t i = hasBraces; i < str.size() - hasBraces; ++i) { - if (str[i] == '-') continue; - - if (index >= 16 || !detail::is_hex(str[i])) { - return false; - } - - if (firstDigit) { - firstDigit = false; - } else { - index++; - firstDigit = true; - } - } - - if (index < 16) { - return false; - } - - return true; - } - - template <typename StringType> - [[nodiscard]] constexpr static std::optional<uuid> from_string( - StringType const& in_str) noexcept { - auto str = detail::to_string_view(in_str); - bool firstDigit = true; - size_t hasBraces = 0; - size_t index = 0; - - std::array<uint8_t, 16> data{{0}}; - - if (str.empty()) return {}; - - if (str.front() == '{') hasBraces = 1; - if (hasBraces && str.back() != '}') return {}; - - for (size_t i = hasBraces; i < str.size() - hasBraces; ++i) { - if (str[i] == '-') continue; - - if (index >= 16 || !detail::is_hex(str[i])) { - return {}; - } - - if (firstDigit) { - data[index] = static_cast<uint8_t>(detail::hex2char(str[i]) << 4); - firstDigit = false; - } else { - data[index] = - static_cast<uint8_t>(data[index] | detail::hex2char(str[i])); - index++; - firstDigit = true; - } - } - - if (index < 16) { - return {}; - } - - return uuid{data}; - } - - private: - std::array<value_type, 16> data{{0}}; - - friend bool operator==(uuid const& lhs, uuid const& rhs) noexcept; - friend bool operator<(uuid const& lhs, uuid const& rhs) noexcept; - - template <class Elem, class Traits> - friend std::basic_ostream<Elem, Traits>& operator<<( - std::basic_ostream<Elem, Traits>& s, uuid const& id); - - template <class CharT, class Traits, class Allocator> - friend std::basic_string<CharT, Traits, Allocator> to_string(uuid const& id); - - friend std::hash<uuid>; -}; - -// -------------------------------------------------------------------------------------------------------------------------- -// operators and non-member functions -// -------------------------------------------------------------------------------------------------------------------------- - -[[nodiscard]] inline bool operator==(uuid const& lhs, - uuid const& rhs) noexcept { - return lhs.data == rhs.data; -} - -[[nodiscard]] inline bool operator!=(uuid const& lhs, - uuid const& rhs) noexcept { - return !(lhs == rhs); -} - -[[nodiscard]] inline bool operator<(uuid const& lhs, uuid const& rhs) noexcept { - return lhs.data < rhs.data; -} - -template <class CharT, class Traits, class Allocator> -[[nodiscard]] inline std::basic_string<CharT, Traits, Allocator> to_string( - uuid const& id) { - std::basic_string<CharT, Traits, Allocator> uustr{detail::empty_guid<CharT>}; - - for (size_t i = 0, index = 0; i < 36; ++i) { - if (i == 8 || i == 13 || i == 18 || i == 23) { - continue; - } - uustr[i] = detail::guid_encoder<CharT>[id.data[index] >> 4 & 0x0f]; - uustr[++i] = detail::guid_encoder<CharT>[id.data[index] & 0x0f]; - index++; - } - - return uustr; -} - -template <class Elem, class Traits> -std::basic_ostream<Elem, Traits>& operator<<( - std::basic_ostream<Elem, Traits>& s, uuid const& id) { - s << to_string(id); - return s; -} - -inline void swap(uuids::uuid& lhs, uuids::uuid& rhs) noexcept { lhs.swap(rhs); } - -// -------------------------------------------------------------------------------------------------------------------------- -// namespace IDs that could be used for generating name-based uuids -// -------------------------------------------------------------------------------------------------------------------------- - -// Name string is a fully-qualified domain name -static uuid uuid_namespace_dns{{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, - 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, - 0xc8}}; - -// Name string is a URL -static uuid uuid_namespace_url{{0x6b, 0xa7, 0xb8, 0x11, 0x9d, 0xad, 0x11, 0xd1, - 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, - 0xc8}}; - -// Name string is an ISO OID (See https://oidref.com/, -// https://en.wikipedia.org/wiki/Object_identifier) -static uuid uuid_namespace_oid{{0x6b, 0xa7, 0xb8, 0x12, 0x9d, 0xad, 0x11, 0xd1, - 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, - 0xc8}}; - -// Name string is an X.500 DN, in DER or a text output format (See -// https://en.wikipedia.org/wiki/X.500, -// https://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One) -static uuid uuid_namespace_x500{{0x6b, 0xa7, 0xb8, 0x14, 0x9d, 0xad, 0x11, 0xd1, - 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, - 0xc8}}; - -// -------------------------------------------------------------------------------------------------------------------------- -// uuid generators -// -------------------------------------------------------------------------------------------------------------------------- + namespace detail + { + template <typename TChar> + [[nodiscard]] constexpr inline unsigned char hex2char(TChar const ch) noexcept + { + if (ch >= static_cast<TChar>('0') && ch <= static_cast<TChar>('9')) + return static_cast<unsigned char>(ch - static_cast<TChar>('0')); + if (ch >= static_cast<TChar>('a') && ch <= static_cast<TChar>('f')) + return static_cast<unsigned char>(10 + ch - static_cast<TChar>('a')); + if (ch >= static_cast<TChar>('A') && ch <= static_cast<TChar>('F')) + return static_cast<unsigned char>(10 + ch - static_cast<TChar>('A')); + return 0; + } + + template <typename TChar> + [[nodiscard]] constexpr inline bool is_hex(TChar const ch) noexcept + { + return (ch >= static_cast<TChar>('0') && ch <= static_cast<TChar>('9')) || + (ch >= static_cast<TChar>('a') && ch <= static_cast<TChar>('f')) || + (ch >= static_cast<TChar>('A') && ch <= static_cast<TChar>('F')); + } + + template <typename TChar> + [[nodiscard]] constexpr std::basic_string_view<TChar> to_string_view( + TChar const* str) noexcept + { + if (str) + return str; + return {}; + } + + template <typename StringType> + [[nodiscard]] constexpr std::basic_string_view<typename StringType::value_type, + typename StringType::traits_type> + to_string_view(StringType const& str) noexcept + { + return str; + } + + class sha1 + { + public: + using digest32_t = uint32_t[5]; + using digest8_t = uint8_t[20]; + + static constexpr unsigned int block_bytes = 64; + + [[nodiscard]] inline static uint32_t left_rotate( + uint32_t value, size_t const count) noexcept + { + return (value << count) ^ (value >> (32 - count)); + } + + sha1() + { + reset(); + } + + void reset() noexcept + { + m_digest[0] = 0x67452301; + m_digest[1] = 0xEFCDAB89; + m_digest[2] = 0x98BADCFE; + m_digest[3] = 0x10325476; + m_digest[4] = 0xC3D2E1F0; + m_blockByteIndex = 0; + m_byteCount = 0; + } + + void process_byte(uint8_t octet) + { + this->m_block[this->m_blockByteIndex++] = octet; + ++this->m_byteCount; + if (m_blockByteIndex == block_bytes) + { + this->m_blockByteIndex = 0; + process_block(); + } + } + + void process_block(void const* const start, void const* const end) + { + const uint8_t* begin = static_cast<const uint8_t*>(start); + const uint8_t* finish = static_cast<const uint8_t*>(end); + while (begin != finish) + { + process_byte(*begin); + begin++; + } + } + + void process_bytes(void const* const data, size_t const len) + { + const uint8_t* block = static_cast<const uint8_t*>(data); + process_block(block, block + len); + } + + uint32_t const* get_digest(digest32_t digest) + { + size_t const bitCount = this->m_byteCount * 8; + process_byte(0x80); + if (this->m_blockByteIndex > 56) + { + while (m_blockByteIndex != 0) + { + process_byte(0); + } + while (m_blockByteIndex < 56) + { + process_byte(0); + } + } + else + { + while (m_blockByteIndex < 56) + { + process_byte(0); + } + } + process_byte(0); + process_byte(0); + process_byte(0); + process_byte(0); + process_byte(static_cast<unsigned char>((bitCount >> 24) & 0xFF)); + process_byte(static_cast<unsigned char>((bitCount >> 16) & 0xFF)); + process_byte(static_cast<unsigned char>((bitCount >> 8) & 0xFF)); + process_byte(static_cast<unsigned char>((bitCount)&0xFF)); + + memcpy(digest, m_digest, 5 * sizeof(uint32_t)); + return digest; + } + + uint8_t const* get_digest_bytes(digest8_t digest) + { + digest32_t d32; + get_digest(d32); + size_t di = 0; + digest[di++] = static_cast<uint8_t>(d32[0] >> 24); + digest[di++] = static_cast<uint8_t>(d32[0] >> 16); + digest[di++] = static_cast<uint8_t>(d32[0] >> 8); + digest[di++] = static_cast<uint8_t>(d32[0] >> 0); + + digest[di++] = static_cast<uint8_t>(d32[1] >> 24); + digest[di++] = static_cast<uint8_t>(d32[1] >> 16); + digest[di++] = static_cast<uint8_t>(d32[1] >> 8); + digest[di++] = static_cast<uint8_t>(d32[1] >> 0); + + digest[di++] = static_cast<uint8_t>(d32[2] >> 24); + digest[di++] = static_cast<uint8_t>(d32[2] >> 16); + digest[di++] = static_cast<uint8_t>(d32[2] >> 8); + digest[di++] = static_cast<uint8_t>(d32[2] >> 0); + + digest[di++] = static_cast<uint8_t>(d32[3] >> 24); + digest[di++] = static_cast<uint8_t>(d32[3] >> 16); + digest[di++] = static_cast<uint8_t>(d32[3] >> 8); + digest[di++] = static_cast<uint8_t>(d32[3] >> 0); + + digest[di++] = static_cast<uint8_t>(d32[4] >> 24); + digest[di++] = static_cast<uint8_t>(d32[4] >> 16); + digest[di++] = static_cast<uint8_t>(d32[4] >> 8); + digest[di++] = static_cast<uint8_t>(d32[4] >> 0); + + return digest; + } + + private: + void process_block() + { + uint32_t w[80]; + for (size_t i = 0; i < 16; i++) + { + w[i] = static_cast<uint32_t>(m_block[i * 4 + 0] << 24); + w[i] |= static_cast<uint32_t>(m_block[i * 4 + 1] << 16); + w[i] |= static_cast<uint32_t>(m_block[i * 4 + 2] << 8); + w[i] |= static_cast<uint32_t>(m_block[i * 4 + 3]); + } + for (size_t i = 16; i < 80; i++) + { + w[i] = left_rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]), 1); + } + + uint32_t a = m_digest[0]; + uint32_t b = m_digest[1]; + uint32_t c = m_digest[2]; + uint32_t d = m_digest[3]; + uint32_t e = m_digest[4]; + + for (std::size_t i = 0; i < 80; ++i) + { + uint32_t f = 0; + uint32_t k = 0; + + if (i < 20) + { + f = (b & c) | (~b & d); + k = 0x5A827999; + } + else if (i < 40) + { + f = b ^ c ^ d; + k = 0x6ED9EBA1; + } + else if (i < 60) + { + f = (b & c) | (b & d) | (c & d); + k = 0x8F1BBCDC; + } + else + { + f = b ^ c ^ d; + k = 0xCA62C1D6; + } + uint32_t temp = left_rotate(a, 5) + f + e + k + w[i]; + e = d; + d = c; + c = left_rotate(b, 30); + b = a; + a = temp; + } + + m_digest[0] += a; + m_digest[1] += b; + m_digest[2] += c; + m_digest[3] += d; + m_digest[4] += e; + } + + private: + digest32_t m_digest; + uint8_t m_block[64]; + size_t m_blockByteIndex; + size_t m_byteCount; + }; + + template <typename CharT> + inline constexpr CharT empty_guid[37] = "00000000-0000-0000-0000-000000000000"; + + template <> + inline constexpr wchar_t empty_guid<wchar_t>[37] = + L"00000000-0000-0000-0000-000000000000"; + + template <typename CharT> + inline constexpr CharT guid_encoder[17] = "0123456789abcdef"; + + template <> + inline constexpr wchar_t guid_encoder<wchar_t>[17] = L"0123456789abcdef"; + } // namespace detail + + // -------------------------------------------------------------------------------------------------------------------------- + // UUID format https://tools.ietf.org/html/rfc4122 + // -------------------------------------------------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------------------------------------------------- + // Field NDR Data Type Octet # Note + // -------------------------------------------------------------------------------------------------------------------------- + // time_low unsigned long 0 - 3 The low field + // of the timestamp. time_mid unsigned short 4 - 5 + // The middle field of the timestamp. time_hi_and_version unsigned + // short 6 - 7 The high field of the timestamp multiplexed + // with the version number. clock_seq_hi_and_reserved unsigned small 8 + // The high field of the clock sequence multiplexed with the variant. + // clock_seq_low unsigned small 9 The low + // field of the clock sequence. node character 10 + // - 15 The spatially unique node identifier. + // -------------------------------------------------------------------------------------------------------------------------- + // 0 1 2 3 + // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + // | time_low | + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + // | time_mid | time_hi_and_version | + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + // |clk_seq_hi_res | clk_seq_low | node (0-1) | + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + // | node (2-5) | + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + // -------------------------------------------------------------------------------------------------------------------------- + // enumerations + // -------------------------------------------------------------------------------------------------------------------------- + + // indicated by a bit pattern in octet 8, marked with N in + // xxxxxxxx-xxxx-xxxx-Nxxx-xxxxxxxxxxxx + enum class uuid_variant + { + // NCS backward compatibility (with the obsolete Apollo Network Computing + // System 1.5 UUID format) N bit pattern: 0xxx > the first 6 octets of the + // UUID are a 48-bit timestamp (the number of 4 microsecond units of time + // since 1 Jan 1980 UTC); > the next 2 octets are reserved; > the next octet + // is the "address family"; > the final 7 octets are a 56-bit host ID in the + // form specified by the address family + ncs, + + // RFC 4122/DCE 1.1 + // N bit pattern: 10xx + // > big-endian byte order + rfc, + + // Microsoft Corporation backward compatibility + // N bit pattern: 110x + // > little endian byte order + // > formely used in the Component Object Model (COM) library + microsoft, + + // reserved for possible future definition + // N bit pattern: 111x + reserved + }; + + // indicated by a bit pattern in octet 6, marked with M in + // xxxxxxxx-xxxx-Mxxx-xxxx-xxxxxxxxxxxx + enum class uuid_version + { + none = 0, // only possible for nil or invalid uuids + time_based = 1, // The time-based version specified in RFC 4122 + dce_security = 2, // DCE Security version, with embedded POSIX UIDs. + name_based_md5 = + 3, // The name-based version specified in RFS 4122 with MD5 hashing + random_number_based = 4, // The randomly or pseudo-randomly generated version + // specified in RFS 4122 + name_based_sha1 = + 5 // The name-based version specified in RFS 4122 with SHA1 hashing + }; + + // Forward declare uuid & to_string so that we can declare to_string as a friend + // later. + class uuid; + template <class CharT = char, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT>> + std::basic_string<CharT, Traits, Allocator> to_string(uuid const& id); + + // -------------------------------------------------------------------------------------------------------------------------- + // uuid class + // -------------------------------------------------------------------------------------------------------------------------- + class uuid + { + public: + using value_type = uint8_t; + + constexpr uuid() noexcept = default; + + uuid(value_type (&arr)[16]) noexcept + { + std::copy(std::cbegin(arr), std::cend(arr), std::begin(data)); + } + + constexpr uuid(std::array<value_type, 16> const& arr) noexcept + : data{arr} + { + } + + explicit uuid(span<value_type, 16> bytes) + { + std::copy(std::cbegin(bytes), std::cend(bytes), std::begin(data)); + } + + template <typename ForwardIterator> + explicit uuid(ForwardIterator first, ForwardIterator last) + { + if (std::distance(first, last) == 16) + std::copy(first, last, std::begin(data)); + } + + [[nodiscard]] constexpr uuid_variant variant() const noexcept + { + if ((data[8] & 0x80) == 0x00) + return uuid_variant::ncs; + else if ((data[8] & 0xC0) == 0x80) + return uuid_variant::rfc; + else if ((data[8] & 0xE0) == 0xC0) + return uuid_variant::microsoft; + else + return uuid_variant::reserved; + } + + [[nodiscard]] constexpr uuid_version version() const noexcept + { + if ((data[6] & 0xF0) == 0x10) + return uuid_version::time_based; + else if ((data[6] & 0xF0) == 0x20) + return uuid_version::dce_security; + else if ((data[6] & 0xF0) == 0x30) + return uuid_version::name_based_md5; + else if ((data[6] & 0xF0) == 0x40) + return uuid_version::random_number_based; + else if ((data[6] & 0xF0) == 0x50) + return uuid_version::name_based_sha1; + else + return uuid_version::none; + } + + [[nodiscard]] constexpr bool is_nil() const noexcept + { + for (size_t i = 0; i < data.size(); ++i) + if (data[i] != 0) + return false; + return true; + } + + void swap(uuid& other) noexcept + { + data.swap(other.data); + } + + [[nodiscard]] inline span<std::byte const, 16> as_bytes() const + { + return span<std::byte const, 16>( + reinterpret_cast<std::byte const*>(data.data()), 16); + } + + template <typename StringType> + [[nodiscard]] constexpr static bool is_valid_uuid( + StringType const& in_str) noexcept + { + auto str = detail::to_string_view(in_str); + bool firstDigit = true; + size_t hasBraces = 0; + size_t index = 0; + + if (str.empty()) + return false; + + if (str.front() == '{') + hasBraces = 1; + if (hasBraces && str.back() != '}') + return false; + + for (size_t i = hasBraces; i < str.size() - hasBraces; ++i) + { + if (str[i] == '-') + continue; + + if (index >= 16 || !detail::is_hex(str[i])) + { + return false; + } + + if (firstDigit) + { + firstDigit = false; + } + else + { + index++; + firstDigit = true; + } + } + + if (index < 16) + { + return false; + } + + return true; + } + + template <typename StringType> + [[nodiscard]] constexpr static std::optional<uuid> from_string( + StringType const& in_str) noexcept + { + auto str = detail::to_string_view(in_str); + bool firstDigit = true; + size_t hasBraces = 0; + size_t index = 0; + + std::array<uint8_t, 16> data{{0}}; + + if (str.empty()) + return {}; + + if (str.front() == '{') + hasBraces = 1; + if (hasBraces && str.back() != '}') + return {}; + + for (size_t i = hasBraces; i < str.size() - hasBraces; ++i) + { + if (str[i] == '-') + continue; + + if (index >= 16 || !detail::is_hex(str[i])) + { + return {}; + } + + if (firstDigit) + { + data[index] = static_cast<uint8_t>(detail::hex2char(str[i]) << 4); + firstDigit = false; + } + else + { + data[index] = + static_cast<uint8_t>(data[index] | detail::hex2char(str[i])); + index++; + firstDigit = true; + } + } + + if (index < 16) + { + return {}; + } + + return uuid{data}; + } + + private: + std::array<value_type, 16> data{{0}}; + + friend bool operator==(uuid const& lhs, uuid const& rhs) noexcept; + friend bool operator<(uuid const& lhs, uuid const& rhs) noexcept; + + template <class Elem, class Traits> + friend std::basic_ostream<Elem, Traits>& operator<<( + std::basic_ostream<Elem, Traits>& s, uuid const& id); + + template <class CharT, class Traits, class Allocator> + friend std::basic_string<CharT, Traits, Allocator> to_string(uuid const& id); + + friend std::hash<uuid>; + }; + + // -------------------------------------------------------------------------------------------------------------------------- + // operators and non-member functions + // -------------------------------------------------------------------------------------------------------------------------- + + [[nodiscard]] inline bool operator==(uuid const& lhs, + uuid const& rhs) noexcept + { + return lhs.data == rhs.data; + } + + [[nodiscard]] inline bool operator!=(uuid const& lhs, + uuid const& rhs) noexcept + { + return !(lhs == rhs); + } + + [[nodiscard]] inline bool operator<(uuid const& lhs, uuid const& rhs) noexcept + { + return lhs.data < rhs.data; + } + + template <class CharT, class Traits, class Allocator> + [[nodiscard]] inline std::basic_string<CharT, Traits, Allocator> to_string( + uuid const& id) + { + std::basic_string<CharT, Traits, Allocator> uustr{detail::empty_guid<CharT>}; + + for (size_t i = 0, index = 0; i < 36; ++i) + { + if (i == 8 || i == 13 || i == 18 || i == 23) + { + continue; + } + uustr[i] = detail::guid_encoder<CharT>[id.data[index] >> 4 & 0x0f]; + uustr[++i] = detail::guid_encoder<CharT>[id.data[index] & 0x0f]; + index++; + } + + return uustr; + } + + template <class Elem, class Traits> + std::basic_ostream<Elem, Traits>& operator<<( + std::basic_ostream<Elem, Traits>& s, uuid const& id) + { + s << to_string(id); + return s; + } + + inline void swap(uuids::uuid& lhs, uuids::uuid& rhs) noexcept + { + lhs.swap(rhs); + } + + // -------------------------------------------------------------------------------------------------------------------------- + // namespace IDs that could be used for generating name-based uuids + // -------------------------------------------------------------------------------------------------------------------------- + + // Name string is a fully-qualified domain name + static uuid uuid_namespace_dns{{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, + 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, + 0xc8}}; + + // Name string is a URL + static uuid uuid_namespace_url{{0x6b, 0xa7, 0xb8, 0x11, 0x9d, 0xad, 0x11, 0xd1, + 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, + 0xc8}}; + + // Name string is an ISO OID (See https://oidref.com/, + // https://en.wikipedia.org/wiki/Object_identifier) + static uuid uuid_namespace_oid{{0x6b, 0xa7, 0xb8, 0x12, 0x9d, 0xad, 0x11, 0xd1, + 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, + 0xc8}}; + + // Name string is an X.500 DN, in DER or a text output format (See + // https://en.wikipedia.org/wiki/X.500, + // https://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One) + static uuid uuid_namespace_x500{{0x6b, 0xa7, 0xb8, 0x14, 0x9d, 0xad, 0x11, 0xd1, + 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, + 0xc8}}; + + // -------------------------------------------------------------------------------------------------------------------------- + // uuid generators + // -------------------------------------------------------------------------------------------------------------------------- #ifdef UUID_SYSTEM_GENERATOR -class uuid_system_generator { - public: - using result_type = uuid; + class uuid_system_generator + { + public: + using result_type = uuid; - uuid operator()() { + uuid operator()() + { #ifdef _WIN32 - GUID newId; - HRESULT hr = ::CoCreateGuid(&newId); + GUID newId; + HRESULT hr = ::CoCreateGuid(&newId); - if (FAILED(hr)) { - throw std::system_error(hr, std::system_category(), - "CoCreateGuid failed"); - } + if (FAILED(hr)) + { + throw std::system_error(hr, std::system_category(), + "CoCreateGuid failed"); + } - std::array<uint8_t, 16> bytes = { - {static_cast<unsigned char>((newId.Data1 >> 24) & 0xFF), - static_cast<unsigned char>((newId.Data1 >> 16) & 0xFF), - static_cast<unsigned char>((newId.Data1 >> 8) & 0xFF), - static_cast<unsigned char>((newId.Data1) & 0xFF), + std::array<uint8_t, 16> bytes = { + {static_cast<unsigned char>((newId.Data1 >> 24) & 0xFF), + static_cast<unsigned char>((newId.Data1 >> 16) & 0xFF), + static_cast<unsigned char>((newId.Data1 >> 8) & 0xFF), + static_cast<unsigned char>((newId.Data1) & 0xFF), - (unsigned char)((newId.Data2 >> 8) & 0xFF), - (unsigned char)((newId.Data2) & 0xFF), + (unsigned char)((newId.Data2 >> 8) & 0xFF), + (unsigned char)((newId.Data2) & 0xFF), - (unsigned char)((newId.Data3 >> 8) & 0xFF), - (unsigned char)((newId.Data3) & 0xFF), + (unsigned char)((newId.Data3 >> 8) & 0xFF), + (unsigned char)((newId.Data3) & 0xFF), - newId.Data4[0], newId.Data4[1], newId.Data4[2], newId.Data4[3], - newId.Data4[4], newId.Data4[5], newId.Data4[6], newId.Data4[7]}}; + newId.Data4[0], newId.Data4[1], newId.Data4[2], newId.Data4[3], + newId.Data4[4], newId.Data4[5], newId.Data4[6], newId.Data4[7]}}; - return uuid{std::begin(bytes), std::end(bytes)}; + return uuid{std::begin(bytes), std::end(bytes)}; #elif defined(__linux__) || defined(__unix__) - uuid_t id; - uuid_generate(id); + uuid_t id; + uuid_generate(id); - std::array<uint8_t, 16> bytes = {{id[0], id[1], id[2], id[3], id[4], id[5], - id[6], id[7], id[8], id[9], id[10], - id[11], id[12], id[13], id[14], id[15]}}; + std::array<uint8_t, 16> bytes = {{id[0], id[1], id[2], id[3], id[4], id[5], + id[6], id[7], id[8], id[9], id[10], + id[11], id[12], id[13], id[14], id[15]}}; - return uuid{std::begin(bytes), std::end(bytes)}; + return uuid{std::begin(bytes), std::end(bytes)}; #elif defined(__APPLE__) - auto newId = CFUUIDCreate(NULL); - auto bytes = CFUUIDGetUUIDBytes(newId); - CFRelease(newId); - - std::array<uint8_t, 16> arrbytes = { - {bytes.byte0, bytes.byte1, bytes.byte2, bytes.byte3, bytes.byte4, - bytes.byte5, bytes.byte6, bytes.byte7, bytes.byte8, bytes.byte9, - bytes.byte10, bytes.byte11, bytes.byte12, bytes.byte13, bytes.byte14, - bytes.byte15}}; - return uuid{std::begin(arrbytes), std::end(arrbytes)}; + auto newId = CFUUIDCreate(NULL); + auto bytes = CFUUIDGetUUIDBytes(newId); + CFRelease(newId); + + std::array<uint8_t, 16> arrbytes = { + {bytes.byte0, bytes.byte1, bytes.byte2, bytes.byte3, bytes.byte4, + bytes.byte5, bytes.byte6, bytes.byte7, bytes.byte8, bytes.byte9, + bytes.byte10, bytes.byte11, bytes.byte12, bytes.byte13, bytes.byte14, + bytes.byte15}}; + return uuid{std::begin(arrbytes), std::end(arrbytes)}; #else - return uuid{}; + return uuid{}; #endif - } -}; + } + }; #endif -template <typename UniformRandomNumberGenerator> -class basic_uuid_random_generator { - public: - using engine_type = UniformRandomNumberGenerator; - - explicit basic_uuid_random_generator(engine_type& gen) - : generator(&gen, [](auto) {}) {} - explicit basic_uuid_random_generator(engine_type* gen) - : generator(gen, [](auto) {}) {} - - [[nodiscard]] uuid operator()() { - alignas(uint32_t) uint8_t bytes[16]; - for (int i = 0; i < 16; i += 4) - *reinterpret_cast<uint32_t*>(bytes + i) = distribution(*generator); - - // variant must be 10xxxxxx - bytes[8] &= 0xBF; - bytes[8] |= 0x80; - - // version must be 0100xxxx - bytes[6] &= 0x4F; - bytes[6] |= 0x40; - - return uuid{std::begin(bytes), std::end(bytes)}; - } - - private: - std::uniform_int_distribution<uint32_t> distribution; - std::shared_ptr<UniformRandomNumberGenerator> generator; -}; - -using uuid_random_generator = basic_uuid_random_generator<std::mt19937>; - -class uuid_name_generator { - public: - explicit uuid_name_generator(uuid const& namespace_uuid) noexcept - : nsuuid(namespace_uuid) {} - - template <typename StringType> - [[nodiscard]] uuid operator()(StringType const& name) { - reset(); - process_characters(detail::to_string_view(name)); - return make_uuid(); - } - - private: - void reset() { - hasher.reset(); - std::byte bytes[16]; - auto nsbytes = nsuuid.as_bytes(); - std::copy(std::cbegin(nsbytes), std::cend(nsbytes), bytes); - hasher.process_bytes(bytes, 16); - } - - template <typename CharT, typename Traits> - void process_characters(std::basic_string_view<CharT, Traits> const str) { - for (uint32_t c : str) { - hasher.process_byte(static_cast<uint8_t>(c & 0xFF)); - if constexpr (!std::is_same_v<CharT, char>) { - hasher.process_byte(static_cast<uint8_t>((c >> 8) & 0xFF)); - hasher.process_byte(static_cast<uint8_t>((c >> 16) & 0xFF)); - hasher.process_byte(static_cast<uint8_t>((c >> 24) & 0xFF)); - } - } - } - - [[nodiscard]] uuid make_uuid() { - detail::sha1::digest8_t digest; - hasher.get_digest_bytes(digest); - - // variant must be 0b10xxxxxx - digest[8] &= 0xBF; - digest[8] |= 0x80; - - // version must be 0b0101xxxx - digest[6] &= 0x5F; - digest[6] |= 0x50; - - return uuid{digest, digest + 16}; - } - - private: - uuid nsuuid; - detail::sha1 hasher; -}; + template <typename UniformRandomNumberGenerator> + class basic_uuid_random_generator + { + public: + using engine_type = UniformRandomNumberGenerator; + + explicit basic_uuid_random_generator(engine_type& gen) + : generator(&gen, [](auto) {}) + { + } + explicit basic_uuid_random_generator(engine_type* gen) + : generator(gen, [](auto) {}) + { + } + + [[nodiscard]] uuid operator()() + { + alignas(uint32_t) uint8_t bytes[16]; + for (int i = 0; i < 16; i += 4) + *reinterpret_cast<uint32_t*>(bytes + i) = distribution(*generator); + + // variant must be 10xxxxxx + bytes[8] &= 0xBF; + bytes[8] |= 0x80; + + // version must be 0100xxxx + bytes[6] &= 0x4F; + bytes[6] |= 0x40; + + return uuid{std::begin(bytes), std::end(bytes)}; + } + + private: + std::uniform_int_distribution<uint32_t> distribution; + std::shared_ptr<UniformRandomNumberGenerator> generator; + }; + + using uuid_random_generator = basic_uuid_random_generator<std::mt19937>; + + class uuid_name_generator + { + public: + explicit uuid_name_generator(uuid const& namespace_uuid) noexcept + : nsuuid(namespace_uuid) + { + } + + template <typename StringType> + [[nodiscard]] uuid operator()(StringType const& name) + { + reset(); + process_characters(detail::to_string_view(name)); + return make_uuid(); + } + + private: + void reset() + { + hasher.reset(); + std::byte bytes[16]; + auto nsbytes = nsuuid.as_bytes(); + std::copy(std::cbegin(nsbytes), std::cend(nsbytes), bytes); + hasher.process_bytes(bytes, 16); + } + + template <typename CharT, typename Traits> + void process_characters(std::basic_string_view<CharT, Traits> const str) + { + for (uint32_t c : str) + { + hasher.process_byte(static_cast<uint8_t>(c & 0xFF)); + if constexpr (!std::is_same_v<CharT, char>) + { + hasher.process_byte(static_cast<uint8_t>((c >> 8) & 0xFF)); + hasher.process_byte(static_cast<uint8_t>((c >> 16) & 0xFF)); + hasher.process_byte(static_cast<uint8_t>((c >> 24) & 0xFF)); + } + } + } + + [[nodiscard]] uuid make_uuid() + { + detail::sha1::digest8_t digest; + hasher.get_digest_bytes(digest); + + // variant must be 0b10xxxxxx + digest[8] &= 0xBF; + digest[8] |= 0x80; + + // version must be 0b0101xxxx + digest[6] &= 0x5F; + digest[6] |= 0x50; + + return uuid{digest, digest + 16}; + } + + private: + uuid nsuuid; + detail::sha1 hasher; + }; #ifdef UUID_TIME_GENERATOR -// !!! DO NOT USE THIS IN PRODUCTION -// this implementation is unreliable for good uuids -class uuid_time_generator { - using mac_address = std::array<unsigned char, 6>; + // !!! DO NOT USE THIS IN PRODUCTION + // this implementation is unreliable for good uuids + class uuid_time_generator + { + using mac_address = std::array<unsigned char, 6>; - std::optional<mac_address> device_address; + std::optional<mac_address> device_address; - [[nodiscard]] bool get_mac_address() { - if (device_address.has_value()) { - return true; - } + [[nodiscard]] bool get_mac_address() + { + if (device_address.has_value()) + { + return true; + } #ifdef _WIN32 - DWORD len = 0; - auto ret = GetAdaptersInfo(nullptr, &len); - if (ret != ERROR_BUFFER_OVERFLOW) return false; - std::vector<unsigned char> buf(len); - auto pips = reinterpret_cast<PIP_ADAPTER_INFO>(&buf.front()); - ret = GetAdaptersInfo(pips, &len); - if (ret != ERROR_SUCCESS) return false; - mac_address addr; - std::copy(pips->Address, pips->Address + 6, std::begin(addr)); - device_address = addr; + DWORD len = 0; + auto ret = GetAdaptersInfo(nullptr, &len); + if (ret != ERROR_BUFFER_OVERFLOW) + return false; + std::vector<unsigned char> buf(len); + auto pips = reinterpret_cast<PIP_ADAPTER_INFO>(&buf.front()); + ret = GetAdaptersInfo(pips, &len); + if (ret != ERROR_SUCCESS) + return false; + mac_address addr; + std::copy(pips->Address, pips->Address + 6, std::begin(addr)); + device_address = addr; #endif - return device_address.has_value(); - } + return device_address.has_value(); + } - [[nodiscard]] long long get_time_intervals() { - auto start = std::chrono::system_clock::from_time_t(time_t(-12219292800)); - auto diff = std::chrono::system_clock::now() - start; - auto ns = - std::chrono::duration_cast<std::chrono::nanoseconds>(diff).count(); - return ns / 100; - } + [[nodiscard]] long long get_time_intervals() + { + auto start = std::chrono::system_clock::from_time_t(time_t(-12219292800)); + auto diff = std::chrono::system_clock::now() - start; + auto ns = + std::chrono::duration_cast<std::chrono::nanoseconds>(diff).count(); + return ns / 100; + } - [[nodiscard]] static unsigned short get_clock_sequence() { - static std::mt19937 clock_gen(std::random_device{}()); - static std::uniform_int_distribution<unsigned short> clock_dis; - static std::atomic_ushort clock_sequence = clock_dis(clock_gen); - return clock_sequence++; - } + [[nodiscard]] static unsigned short get_clock_sequence() + { + static std::mt19937 clock_gen(std::random_device{}()); + static std::uniform_int_distribution<unsigned short> clock_dis; + static std::atomic_ushort clock_sequence = clock_dis(clock_gen); + return clock_sequence++; + } - public: - [[nodiscard]] uuid operator()() { - if (get_mac_address()) { - std::array<uuids::uuid::value_type, 16> data; + public: + [[nodiscard]] uuid operator()() + { + if (get_mac_address()) + { + std::array<uuids::uuid::value_type, 16> data; - auto tm = get_time_intervals(); + auto tm = get_time_intervals(); - auto clock_seq = get_clock_sequence(); + auto clock_seq = get_clock_sequence(); - auto ptm = reinterpret_cast<uuids::uuid::value_type*>(&tm); + auto ptm = reinterpret_cast<uuids::uuid::value_type*>(&tm); - memcpy(&data[0], ptm + 4, 4); - memcpy(&data[4], ptm + 2, 2); - memcpy(&data[6], ptm, 2); + memcpy(&data[0], ptm + 4, 4); + memcpy(&data[4], ptm + 2, 2); + memcpy(&data[6], ptm, 2); - memcpy(&data[8], &clock_seq, 2); + memcpy(&data[8], &clock_seq, 2); - // variant must be 0b10xxxxxx - data[8] &= 0xBF; - data[8] |= 0x80; + // variant must be 0b10xxxxxx + data[8] &= 0xBF; + data[8] |= 0x80; - // version must be 0b0001xxxx - data[6] &= 0x1F; - data[6] |= 0x10; + // version must be 0b0001xxxx + data[6] &= 0x1F; + data[6] |= 0x10; - memcpy(&data[10], &device_address.value()[0], 6); + memcpy(&data[10], &device_address.value()[0], 6); - return uuids::uuid{std::cbegin(data), std::cend(data)}; - } + return uuids::uuid{std::cbegin(data), std::cend(data)}; + } - return {}; - } -}; + return {}; + } + }; #endif -} // namespace uuids - -namespace std { -template <> -struct hash<uuids::uuid> { - using argument_type = uuids::uuid; - using result_type = std::size_t; - - [[nodiscard]] result_type operator()(argument_type const& uuid) const { +} // namespace uuids + +namespace std +{ + template <> + struct hash<uuids::uuid> + { + using argument_type = uuids::uuid; + using result_type = std::size_t; + + [[nodiscard]] result_type operator()(argument_type const& uuid) const + { #ifdef UUID_HASH_STRING_BASED - std::hash<std::string> hasher; - return static_cast<result_type>(hasher(uuids::to_string(uuid))); + std::hash<std::string> hasher; + return static_cast<result_type>(hasher(uuids::to_string(uuid))); #else - uint64_t l = static_cast<uint64_t>(uuid.data[0]) << 56 | - static_cast<uint64_t>(uuid.data[1]) << 48 | - static_cast<uint64_t>(uuid.data[2]) << 40 | - static_cast<uint64_t>(uuid.data[3]) << 32 | - static_cast<uint64_t>(uuid.data[4]) << 24 | - static_cast<uint64_t>(uuid.data[5]) << 16 | - static_cast<uint64_t>(uuid.data[6]) << 8 | - static_cast<uint64_t>(uuid.data[7]); - uint64_t h = static_cast<uint64_t>(uuid.data[8]) << 56 | - static_cast<uint64_t>(uuid.data[9]) << 48 | - static_cast<uint64_t>(uuid.data[10]) << 40 | - static_cast<uint64_t>(uuid.data[11]) << 32 | - static_cast<uint64_t>(uuid.data[12]) << 24 | - static_cast<uint64_t>(uuid.data[13]) << 16 | - static_cast<uint64_t>(uuid.data[14]) << 8 | - static_cast<uint64_t>(uuid.data[15]); - - if constexpr (sizeof(result_type) > 4) { - return result_type(l ^ h); - } else { - uint64_t hash64 = l ^ h; - return result_type(uint32_t(hash64 >> 32) ^ uint32_t(hash64)); - } + uint64_t l = static_cast<uint64_t>(uuid.data[0]) << 56 | + static_cast<uint64_t>(uuid.data[1]) << 48 | + static_cast<uint64_t>(uuid.data[2]) << 40 | + static_cast<uint64_t>(uuid.data[3]) << 32 | + static_cast<uint64_t>(uuid.data[4]) << 24 | + static_cast<uint64_t>(uuid.data[5]) << 16 | + static_cast<uint64_t>(uuid.data[6]) << 8 | + static_cast<uint64_t>(uuid.data[7]); + uint64_t h = static_cast<uint64_t>(uuid.data[8]) << 56 | + static_cast<uint64_t>(uuid.data[9]) << 48 | + static_cast<uint64_t>(uuid.data[10]) << 40 | + static_cast<uint64_t>(uuid.data[11]) << 32 | + static_cast<uint64_t>(uuid.data[12]) << 24 | + static_cast<uint64_t>(uuid.data[13]) << 16 | + static_cast<uint64_t>(uuid.data[14]) << 8 | + static_cast<uint64_t>(uuid.data[15]); + + if constexpr (sizeof(result_type) > 4) + { + return result_type(l ^ h); + } + else + { + uint64_t hash64 = l ^ h; + return result_type(uint32_t(hash64 >> 32) ^ uint32_t(hash64)); + } #endif - } -}; -} // namespace std + } + }; +} // namespace std #endif /* STDUUID_H */
\ No newline at end of file diff --git a/SDK/__mpcc_defines.hxx b/SDK/__mpcc_defines.hxx index d14efae..c87f570 100644 --- a/SDK/__mpcc_defines.hxx +++ b/SDK/__mpcc_defines.hxx @@ -19,9 +19,9 @@ typedef int ssize_t; typedef size_t ptrdiff_t; typedef size_t uintptr_t; -typedef void *voidptr_t; -typedef void *any_t; -typedef char *caddr_t; +typedef void* voidptr_t; +typedef void* any_t; +typedef char* caddr_t; #ifndef NULL #define NULL ((voidptr_t)0) @@ -38,12 +38,12 @@ typedef char *caddr_t; #define __deref(ptr) (*(ptr)) #ifdef __cplusplus -#define __init_decl() \ - extern "C" \ - { -#define __fini_decl() \ - } \ - ; +#define __init_decl() \ + extern "C" \ + { +#define __fini_decl() \ + } \ + ; #else #define __init_decl() #define __fini_decl() @@ -56,32 +56,34 @@ typedef char *caddr_t; #endif #define __alloca alloca #else -#warning alloca not detected +#warning alloca not detected (MPCC) #endif -typedef long long off_t; +typedef long long off_t; typedef unsigned long long uoff_t; -typedef union float_cast { - struct - { - unsigned int mantissa : 23; - unsigned int exponent : 8; - unsigned int sign : 1; - }; +typedef union float_cast +{ + struct + { + unsigned int mantissa : 23; + unsigned int exponent : 8; + unsigned int sign : 1; + }; - float f; + float f; } __attribute__((packed)) float_cast_t; -typedef union double_cast { - struct - { - unsigned long long int mantissa : 52; - unsigned int exponent : 11; - unsigned int sign : 1; - }; +typedef union double_cast +{ + struct + { + unsigned long long int mantissa : 52; + unsigned int exponent : 11; + unsigned int sign : 1; + }; - double f; + double f; } __attribute__((packed)) double_cast_t; #endif // ifndef __GNUC__ diff --git a/Sources/Detail/asmutils.h b/Sources/Detail/asmutils.h index 5440fc5..2408998 100644 --- a/Sources/Detail/asmutils.h +++ b/Sources/Detail/asmutils.h @@ -15,81 +15,97 @@ using namespace CompilerKit; /// @param lineBuffer the lineBuffer to fetch from. /// @param numberKey where to seek that number. /// @return -static NumberCast32 GetNumber32(std::string lineBuffer, std::string numberKey) { - auto pos = lineBuffer.find(numberKey) + numberKey.size(); - - if (lineBuffer.find(",") != std::string::npos) lineBuffer.erase(lineBuffer.find(","), 1); - - while (lineBuffer[pos] == ' ') ++pos; - - switch (lineBuffer[pos + 1]) { - case 'x': { - if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 16); !res) { - if (errno != 0) { - detail::print_error("invalid hex number: " + lineBuffer, "ppcasm"); - throw std::runtime_error("invalid_hex"); - } - } - - NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 16)); - - if (kVerbose) { - kStdOut << "ppcasm: found a base 16 number here: " << lineBuffer.substr(pos) - << "\n"; - } - - return numOffset; - } - case 'b': { - if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 2); !res) { - if (errno != 0) { - detail::print_error("invalid binary number:" + lineBuffer, "ppcasm"); - throw std::runtime_error("invalid_bin"); - } - } - - NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 2)); - - if (kVerbose) { - kStdOut << "ppcasm: found a base 2 number here:" << lineBuffer.substr(pos) - << "\n"; - } - - return numOffset; - } - case 'o': { - if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 7); !res) { - if (errno != 0) { - detail::print_error("invalid octal number: " + lineBuffer, "ppcasm"); - throw std::runtime_error("invalid_octal"); - } - } - - NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 7)); - - if (kVerbose) { - kStdOut << "ppcasm: found a base 8 number here:" << lineBuffer.substr(pos) - << "\n"; - } - - return numOffset; - } - default: { - if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 10); !res) { - if (errno != 0) { - detail::print_error("invalid hex number: " + lineBuffer, "ppcasm"); - throw std::runtime_error("invalid_hex"); - } - } - - NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 10)); - - if (kVerbose) { - kStdOut << "ppcasm: found a base 10 number here:" << lineBuffer.substr(pos) - << "\n"; - } - - return numOffset; - } - } +static NumberCast32 GetNumber32(std::string lineBuffer, std::string numberKey) +{ + auto pos = lineBuffer.find(numberKey) + numberKey.size(); + + if (lineBuffer.find(",") != std::string::npos) + lineBuffer.erase(lineBuffer.find(","), 1); + + while (lineBuffer[pos] == ' ') + ++pos; + + switch (lineBuffer[pos + 1]) + { + case 'x': { + if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 16); !res) + { + if (errno != 0) + { + detail::print_error("invalid hex number: " + lineBuffer, "ppcasm"); + throw std::runtime_error("invalid_hex"); + } + } + + NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 16)); + + if (kVerbose) + { + kStdOut << "ppcasm: found a base 16 number here: " << lineBuffer.substr(pos) + << "\n"; + } + + return numOffset; + } + case 'b': { + if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 2); !res) + { + if (errno != 0) + { + detail::print_error("invalid binary number:" + lineBuffer, "ppcasm"); + throw std::runtime_error("invalid_bin"); + } + } + + NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 2)); + + if (kVerbose) + { + kStdOut << "ppcasm: found a base 2 number here:" << lineBuffer.substr(pos) + << "\n"; + } + + return numOffset; + } + case 'o': { + if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 7); !res) + { + if (errno != 0) + { + detail::print_error("invalid octal number: " + lineBuffer, "ppcasm"); + throw std::runtime_error("invalid_octal"); + } + } + + NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 7)); + + if (kVerbose) + { + kStdOut << "ppcasm: found a base 8 number here:" << lineBuffer.substr(pos) + << "\n"; + } + + return numOffset; + } + default: { + if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 10); !res) + { + if (errno != 0) + { + detail::print_error("invalid hex number: " + lineBuffer, "ppcasm"); + throw std::runtime_error("invalid_hex"); + } + } + + NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 10)); + + if (kVerbose) + { + kStdOut << "ppcasm: found a base 10 number here:" << lineBuffer.substr(pos) + << "\n"; + } + + return numOffset; + } + } } diff --git a/run_format.sh b/run_format.sh new file mode 100755 index 0000000..3ee63fc --- /dev/null +++ b/run_format.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +THIS_PATH="$(realpath "$0")" +THIS_DIR="$(dirname "$THIS_PATH")" + +# Find all files in THIS_DIR which end in .ino, .cpp, etc., as specified +# in the regular expression just below +FILE_LIST="$(find "$THIS_DIR" | grep -E ".*(\.ino|\.cpp|\.c|\.h|\.hpp|\.hxx|\.cxx|\.hh)$")" + +echo -e "Files found to format = \n\"\"\"\n$FILE_LIST\n\"\"\"" + +# Format each file. +# - NB: do NOT put quotes around `$FILE_LIST` below or else the `clang-format` command will +# mistakenly see the entire blob of newline-separated file names as a SINGLE file name instead +# of as a new-line separated list of *many* file names! +clang-format --verbose -i --style=file $FILE_LIST |
