*/
/*
- * Copyright (C) 2013, 2014 Eric Biggers
+ * Copyright (C) 2013-2016 Eric Biggers
*
* This file is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
#ifdef __x86_64__
-static inline u8 *
+static forceinline u8 *
find_next_opcode_sse4_2(u8 *p)
{
const __v16qi potential_opcodes = (__v16qi) {0x48, 0x4C, 0xE8, 0xE9, 0xF0, 0xFF};
" pcmpestri $0x0, (%[p]), %[potential_opcodes] \n"
" jnc 1b \n"
"2: \n"
+ #ifdef __ILP32__ /* x32 ABI (x86_64 with 32-bit pointers) */
+ " add %%ecx, %[p] \n"
+ #else
" add %%rcx, %[p] \n"
+ #endif
: [p] "+r" (p)
: [potential_opcodes] "x" (potential_opcodes), "a" (6), "d" (16)
: "rcx", "cc"
}
#endif /* __x86_64__ */
-static inline u8 *
+static forceinline u8 *
find_next_opcode_default(u8 *p)
{
/*
return p;
}
-static inline u8 *
+static forceinline u8 *
translate_if_needed(u8 *data, u8 *p, s32 *last_x86_pos,
s32 last_target_usages[], bool undo)
{
p += opcode_nbytes;
if (undo) {
if (i - *last_x86_pos <= max_trans_offset) {
- u32 n = get_unaligned_u32_le(p);
- put_unaligned_u32_le(n - i, p);
+ u32 n = get_unaligned_le32(p);
+ put_unaligned_le32(n - i, p);
}
- target16 = i + get_unaligned_u16_le(p);
+ target16 = i + get_unaligned_le16(p);
} else {
- target16 = i + get_unaligned_u16_le(p);
+ target16 = i + get_unaligned_le16(p);
if (i - *last_x86_pos <= max_trans_offset) {
- u32 n = get_unaligned_u32_le(p);
- put_unaligned_u32_le(n + i, p);
+ u32 n = get_unaligned_le32(p);
+ put_unaligned_le32(n + i, p);
}
}