Skip to content

Commit

Permalink
Implement jcxz
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed May 25, 2018
1 parent 65d65a8 commit 2593132
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions emu/gadgets-x86/control.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
.gadget jmp
movl (%_ip), %_eip
jmp jit_ret
.gadget jcxz
cmpl $0, %ecx
jne 1f
movl (%_ip), %_eip
jmp jit_ret
1:
movl 8(%_ip), %_eip
jmp jit_ret

#define COND_LIST o,c,z,cz,s,p,sxo,sxoz
#define IMPLEMENTED_CONDS c,z,cz,s,p,sxo,sxoz
Expand Down
2 changes: 1 addition & 1 deletion emu/gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static inline void gen_op(struct gen_state *state, gadget_t *gadgets, enum arg a

#define JMP(loc) load(loc, OP_SIZE); g(jmp_indir)
#define JMP_REL(off) gg(jmp, state->ip + off)
#define JCXZ_REL(off) UNDEFINED
#define JCXZ_REL(off) ggg(jcxz, state->ip + off, state->ip)
#define J_REL(cc, off) gagg(jmp, cond_##cc, state->ip + off, state->ip)
#define JN_REL(cc, off) gagg(jmp, cond_##cc, state->ip, state->ip + off)
#define CALL(loc) load(loc, OP_SIZE); ggg(call_indir, saved_ip, state->ip)
Expand Down

0 comments on commit 2593132

Please sign in to comment.