/*------------------------------------------------------------*/
/*--- Helper bits and pieces for deconstructing the ---*/
-/*--- x86 insn stream. ---*/
+/*--- ppc32 insn stream. ---*/
/*------------------------------------------------------------*/
/* Add a statement to the list held by "irbb". */
return (UInt)((((Int)x) << 8) >> 8);
}
+/* Do a big-endian load of a 32-bit word, regardless of the endianness
+ of the underlying host. */
+static UInt getUIntBigendianly ( HChar* hp )
+{
+ UChar* p = (UChar*)hp;
+ UInt w = 0;
+ w = (w << 8) | p[0];
+ w = (w << 8) | p[1];
+ w = (w << 8) | p[2];
+ w = (w << 8) | p[3];
+ return w;
+}
+
/*------------------------------------------------------------*/
/*--- Helpers for constructing IR. ---*/
decode. */
*size = 0;
- theInstr = *(UInt*)(&guest_code[delta]);
+ theInstr = getUIntBigendianly( (HChar*)(&guest_code[delta]) );
// vex_printf("START: 0x%x, %,b\n", theInstr, theInstr );