Skip to content

Commit

Permalink
Fix a few bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed May 26, 2018
1 parent 3182a42 commit 77ec43d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
DECLARE_LOCALS;

byte_t insn;
uint64_t imm;
uint64_t imm = 0;
struct modrm modrm;
#define READIMM_(name, size) _READIMM(name, size); TRACE("imm %llx ", (long long) name)
#define READINSN _READIMM(insn, 8); TRACE("%02x ", insn)
Expand Down
4 changes: 3 additions & 1 deletion emu/gadgets-x86/bits.S
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
jz 1f
\type\()l %cl, %_tmp
setf_oc
setf_zsp %_tmp, l
.ifin(\type, shl,shr,sar)
setf_zsp %_tmp, l
.endifin
clearf_a
1:
.ifc \arg,imm
Expand Down
2 changes: 1 addition & 1 deletion emu/gadgets-x86/control.S
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

.gadget ret
movl %_esp, %_addr
addl $4, %_esp
addl 8(%_ip), %_esp
read_prep
movl (%_addrq), %_eip
jmp jit_ret
Expand Down
2 changes: 1 addition & 1 deletion emu/gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static inline void gen_op(struct gen_state *state, gadget_t *gadgets, enum arg a
#define SHLD(count, extra, dst,z) UNDEFINED
#define SHRD(count, extra, dst,z) load(dst,z); \
if (arg_##count == arg_reg_c) op(shrd_cl, extra,z); \
else op(shrd_imm, extra,z); store(dst,z)
else { op(shrd_imm, extra,z); GEN(imm); } store(dst,z)

#define BT(bit, val,z) lo(bt, bit, val, z)
#define BTC(bit, val,z) UNDEFINED
Expand Down
2 changes: 2 additions & 0 deletions tools/ptraceomatic.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ int main(int argc, char *const argv[]) {
struct tlb *tlb = tlb_new(cpu->mem);
int undefined_flags = 2;
struct cpu_state old_cpu = *cpu;
int i = 0;
while (true) {
if (compare_cpus(cpu, tlb, pid, undefined_flags) < 0) {
println("failure: resetting cpu");
Expand All @@ -469,6 +470,7 @@ int main(int argc, char *const argv[]) {
undefined_flags = undefined_flags_mask(pid, cpu);
old_cpu = *cpu;
step_tracing(cpu, tlb, pid, sender, receiver);
i++;
}
}

Expand Down

0 comments on commit 77ec43d

Please sign in to comment.