summaryrefslogtreecommitdiff
path: root/arch/powerpc/disassembler.h
diff options
context:
space:
mode:
authorGalen Williamson <galen@vector35.com>2024-12-16 13:40:25 -0500
committerGalen Williamson <galen@vector35.com>2024-12-16 13:40:25 -0500
commit8ea98cab89afb0c14073141f30203486d1333b07 (patch)
treea749ae52d4c590c06876b0e02656ad811883b082 /arch/powerpc/disassembler.h
parentb34ddd03f71c8637a80a264a3ea757b8295d482b (diff)
[ppc] merges PR Vector35/binaryninja-api#5176 (adds support for "psq" Quantized Floating Point instructions, fixes/completes 64-bit instruction/register support)
Diffstat (limited to 'arch/powerpc/disassembler.h')
-rw-r--r--arch/powerpc/disassembler.h37
1 files changed, 33 insertions, 4 deletions
diff --git a/arch/powerpc/disassembler.h b/arch/powerpc/disassembler.h
index d586a517..d4679ae0 100644
--- a/arch/powerpc/disassembler.h
+++ b/arch/powerpc/disassembler.h
@@ -23,8 +23,17 @@ Then some helpers if you need them:
/* capstone stuff /usr/local/include/capstone */
#include "capstone/capstone.h"
+#include "capstone/cs_priv.h"
#include "capstone/ppc.h"
+#define PPC_CRX_REG_MASK 0x1ff
+#define PPC_CRX_FLOAT_MASK 0x200
+
+// TODO this is some sorta capstone baddy, where xori is showing as xnop's
+// opcode. Maybe pulling capstone will fix, need for xori to correctly
+// lift. Capstone is posting that XORI is 1452, though that is XNOP
+#define PPC_BN_INS_XORI PPC_INS_XNOP
+
//*****************************************************************************
// structs and types
//*****************************************************************************
@@ -32,6 +41,23 @@ enum ppc_status_t {
STATUS_ERROR_UNSPEC=-1, STATUS_SUCCESS=0, STATUS_UNDEF_INSTR
};
+typedef enum ppc_insn_bn {
+ PPC_INS_BN_FCMPO = PPC_INS_ENDING+1,
+ PPC_INS_BN_XXPERMR,
+ PPC_INS_BN_ENDING
+} ppc_insn_bn;
+
+typedef enum ppc_reg_bn {
+ PPC_REG_BN_GQR0 = PPC_REG_ENDING+1,
+ PPC_REG_BN_GQR1,
+ PPC_REG_BN_GQR2,
+ PPC_REG_BN_GQR3,
+ PPC_REG_BN_GQR4,
+ PPC_REG_BN_GQR5,
+ PPC_REG_BN_GQR6,
+ PPC_REG_BN_GQR7,
+ PPC_REG_BN_ENDING
+} ppc_reg_bn;
/* operand type */
enum operand_type_t { REG, VAL, LABEL };
@@ -59,11 +85,14 @@ struct decomp_result
//*****************************************************************************
// function prototypes
//*****************************************************************************
-extern "C" int powerpc_init(void);
+int DoesQualifyForLocalDisassembly(const uint8_t *data, bool bigendian);
+bool PerformLocalDisassembly(const uint8_t *data, uint64_t addr, size_t &len, decomp_result* res, bool bigendian);
+
+extern "C" int powerpc_init(int);
extern "C" void powerpc_release(void);
-extern "C" int powerpc_decompose(const uint8_t *data, int size, uint32_t addr,
- bool lil_end, struct decomp_result *result, bool is_64bit);
+extern "C" int powerpc_decompose(const uint8_t *data, int size, uint64_t addr,
+ bool lil_end, struct decomp_result *result, bool is_64bit, int cs_mode);
extern "C" int powerpc_disassemble(struct decomp_result *, char *buf, size_t len);
-extern "C" const char *powerpc_reg_to_str(uint32_t rid);
+extern "C" const char *powerpc_reg_to_str(uint32_t rid, int cs_mode_arg);
extern "C" const uint32_t powerpc_crx_to_reg(uint32_t rid);