summaryrefslogtreecommitdiff
path: root/arch/powerpc/util.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/util.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/util.h')
-rw-r--r--arch/powerpc/util.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/powerpc/util.h b/arch/powerpc/util.h
index fe2b7fda..0eb14651 100644
--- a/arch/powerpc/util.h
+++ b/arch/powerpc/util.h
@@ -6,6 +6,30 @@
#define FALL_THROUGH
#endif
+#define ADDRMASK(addressSize, target) \
+ if (addressSize == 4) \
+ { \
+ target &= 0xffffffff; \
+ }
+
+#define EXTOPT(rawInsn, addressSize, extend, TYPE) \
+ { \
+ int L_tmp = ((rawInsn >> 10) & 1); \
+ if ((L_tmp == 1) && (addressSize == 8)) \
+ { \
+ extend = OTI_ ## TYPE ## EXT64_IMMS; \
+ } \
+ else \
+ { \
+ extend = OTI_ ## TYPE ## EXT32_IMMS; \
+ } \
+ }
+
+#define EXTOPTZ(data, addressSize, extend) EXTOPT(data, addressSize, extend, Z)
+#define EXTOPTS(data, addressSize, extend) EXTOPT(data, addressSize, extend, S)
+
+#define ADDRNEG1(addressSize) (addressSize == 4) ? ((uint32_t)-1) : ((uint64_t)-1)
+
inline uint32_t bswap32(uint32_t x)
{
return ((x&0xFF)<<24) |
@@ -16,3 +40,4 @@ inline uint32_t bswap32(uint32_t x)
void printOperandVerbose(decomp_result *res, cs_ppc_op *opers);
void printInstructionVerbose(decomp_result *res);
+uint64_t sign_extend(size_t addressSize_local, uint64_t target, int signBit); \ No newline at end of file