1.1 --- a/src/cpu/ppc/vm/assembler_ppc.hpp Mon Mar 31 13:08:03 2014 -0700 1.2 +++ b/src/cpu/ppc/vm/assembler_ppc.hpp Wed Apr 02 11:24:44 2014 -0700 1.3 @@ -1025,15 +1025,14 @@ 1.4 } 1.5 1.6 static void set_imm(int* instr, short s) { 1.7 - short* p = ((short *)instr) + 1; 1.8 - *p = s; 1.9 + // imm is always in the lower 16 bits of the instruction, 1.10 + // so this is endian-neutral. Same for the get_imm below. 1.11 + uint32_t w = *(uint32_t *)instr; 1.12 + *instr = (int)((w & ~0x0000FFFF) | (s & 0x0000FFFF)); 1.13 } 1.14 1.15 static int get_imm(address a, int instruction_number) { 1.16 - short imm; 1.17 - short *p =((short *)a)+2*instruction_number+1; 1.18 - imm = *p; 1.19 - return (int)imm; 1.20 + return (short)((int *)a)[instruction_number]; 1.21 } 1.22 1.23 static inline int hi16_signed( int x) { return (int)(int16_t)(x >> 16); }