|
KittyMemoryEx 1.0.0
Dedicated library for runtime code patching, memory scanning, tracing, injection and some more useful memory utilities. works for both Android and Linux
|
Namespace containing utility functions for ARM32 instructions. More...
Functions | |
| int32_t | signExtend (uint32_t val, int bits) |
| Sign-extends a 32-bit unsigned integer to a 32-bit signed integer. | |
| std::string | regName (unsigned r) |
| Returns the name of an ARM32 general-purpose register. | |
| int | regIndex (const std::string &name) |
| Inverse of regName(): maps a decoded register name back to its index. | |
| std::string | branchCondName (uint32_t cond) |
| Returns the name of a conditional execution flag. | |
| std::string | typeToString (EKittyInsnTypeArm32 t) |
| Converts an EKittyInsnTypeArm32 to a string representation. | |
| uint8_t | loadStoreWidth (EKittyInsnTypeArm32 t) |
| Load/Store access width in bytes for an ARM32 instruction type. | |
| bool | isLoad (EKittyInsnTypeArm32 t) |
| True when t is one of the load instruction types. | |
| bool | isStore (EKittyInsnTypeArm32 t) |
| True when t is one of the store instruction types. | |
| EKittyInsnTypeArm32 | decodeInsnType (uint32_t instr) |
| Decodes type of an ARM32 instruction. | |
| KittyInsnArm32 | decodeInsn (uint32_t instr, uint32_t address=0) |
| Decodes an ARM32 instruction. | |
Variables | |
| constexpr uint32_t | kInstructionStride = 4 |
| constexpr uint32_t | kPcBias = 8 |
| constexpr int | kLinkRegister = 14 |
| constexpr int | kNumGPRegisters = 15 |
Namespace containing utility functions for ARM32 instructions.
This namespace provides utility functions for decoding ARM32 instructions,
|
inline |
Returns the name of a conditional execution flag.
| cond | The conditional execution flag value (0-15). |
| KittyInsnArm32 KittyArm32::decodeInsn | ( | uint32_t | instr, |
| uint32_t | address = 0 ) |
Decodes an ARM32 instruction.
| instr | The 32-bit instruction value. |
| address | The address of the instruction (optional). |
| EKittyInsnTypeArm32 KittyArm32::decodeInsnType | ( | uint32_t | instr | ) |
Decodes type of an ARM32 instruction.
| instr | The 32-bit instruction value. |
| bool KittyArm32::isLoad | ( | EKittyInsnTypeArm32 | t | ) |
True when t is one of the load instruction types.
| t | The instruction type to query. |
| bool KittyArm32::isStore | ( | EKittyInsnTypeArm32 | t | ) |
True when t is one of the store instruction types.
| t | The instruction type to query. |
| uint8_t KittyArm32::loadStoreWidth | ( | EKittyInsnTypeArm32 | t | ) |
Load/Store access width in bytes for an ARM32 instruction type.
| t | The instruction type to query. |
| int KittyArm32::regIndex | ( | const std::string & | name | ) |
Inverse of regName(): maps a decoded register name back to its index.
| name | Register name as produced by regName() - "sp"/"lr"/"pc" for 13/14/15, "r0".."r15" otherwise. |
|
inline |
Returns the name of an ARM32 general-purpose register.
| r | The register number (0-15). |
|
inline |
Sign-extends a 32-bit unsigned integer to a 32-bit signed integer.
| val | The input 32-bit unsigned integer. |
| bits | The number of bits to sign-extend. |
| std::string KittyArm32::typeToString | ( | EKittyInsnTypeArm32 | t | ) |
Converts an EKittyInsnTypeArm32 to a string representation.
| t | The instruction type to convert. |
|
constexpr |
A32 instruction size. Fixed at 4 bytes, which is what makes a linear sweep possible at all - and is exactly the assumption that does not hold for Thumb/Thumb-2, whose mixed 16/32-bit encoding this decoder does not handle. The one source of truth for anything stepping through A32 code.
|
constexpr |
R14, the link register: BX LR is how an A32 function returns, so a consumer looking for returns has to name this register.
|
constexpr |
ARM32 general-purpose register count: R0-R14. R15 (PC) is deliberately excluded - every consumer of this constant tracks live register state, and PC's value changes every instruction rather than being something register-tracking can hold, so it is never a valid array index here. The one source of truth for register-array sizing and regIndex's bound check.
|
constexpr |
What A32 reads the PC as: the instruction's own address plus 8, an artefact of the original three-stage pipeline that the architecture keeps for compatibility. Every PC-relative form here is biased by it, so the number lives in one place rather than as a literal 8 at each use.