summaryrefslogtreecommitdiff
path: root/arch/powerpc/util.h
diff options
context:
space:
mode:
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