Skip to content

Commit

Permalink
Don’t try to use nonexistent atomic gadgets on arm
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Nov 10, 2018
1 parent 5777b4f commit a724fb2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions jit/gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ static inline bool gen_op(struct gen_state *state, gadget_t *gadgets, enum arg a
#define CPUID() g(cpuid)

// atomic
// TODO the gadgets currently don't exist on arm
#if defined(__x86_64__)
#define atomic_op(type, src, dst,z) load(src, z); op(atomic_##type, dst, z)
#define ATOMIC_ADD(src, dst,z) atomic_op(add, src, dst, z)
#define ATOMIC_OR(src, dst,z) atomic_op(or, src, dst, z)
Expand All @@ -331,6 +333,20 @@ static inline bool gen_op(struct gen_state *state, gadget_t *gadgets, enum arg a
#define ATOMIC_CMPXCHG(src, dst,z) atomic_op(cmpxchg, src, dst, z)
#define ATOMIC_XADD(src, dst,z) load(src, z); op(atomic_xadd, dst, z); store(src, z)

#else
#define ATOMIC_ADD ADD
#define ATOMIC_OR OR
#define ATOMIC_ADC ADC
#define ATOMIC_SBB SBB
#define ATOMIC_AND AND
#define ATOMIC_SUB SUB
#define ATOMIC_XOR XOR
#define ATOMIC_INC INC
#define ATOMIC_DEC DEC
#define ATOMIC_CMPXCHG CMPXCHG
#define ATOMIC_XADD XADD
#endif

// sse
#define XORP(src, dst) UNDEFINED
#define PSRLQ(src, dst) UNDEFINED
Expand Down

0 comments on commit a724fb2

Please sign in to comment.