From 5c8b417cf21f0a4ac5d3ea627a21efb2ff3d13c4 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 20 Feb 2015 19:39:38 +0100 Subject: [PATCH] Add mul/div opcodes for x86.nz assembler and fix osx build --- libr/asm/p/asm_x86_nz.c | 22 +++++++++++++++++++++- libr/debug/p/debug_native.c | 1 - 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/libr/asm/p/asm_x86_nz.c b/libr/asm/p/asm_x86_nz.c index 5a7f0d879a..83c6ea0e8d 100644 --- a/libr/asm/p/asm_x86_nz.c +++ b/libr/asm/p/asm_x86_nz.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2014 - pancake */ +/* Copyright (C) 2008-2015 - pancake */ #include #include @@ -661,6 +661,26 @@ SETNP/SETPO - Set if No Parity / Set if Parity Odd (386+) data[l++] = ptr[2]; data[l++] = ptr[3]; return 5; + } else if (!strcmp (op, "div")) { + int pfx = 0xf0; + int arg0 = getreg (arg); + if (arg0 == 0xff) + return -1; + if (*arg == 'r') + data[l++] = 0x48; + data[l++] = 0xf7; + data[l++] = arg0 | pfx; + return l; + } else if (!strcmp (op, "mul")) { + int pfx = 0xe0; + int arg0 = getreg (arg); + if (arg0 == 0xff) + return -1; + if (*arg == 'r') + data[l++] = 0x48; + data[l++] = 0xf7; + data[l++] = arg0 | pfx; + return l; } else if (!strcmp (op, "pop")) { char *delta; ut64 dst; diff --git a/libr/debug/p/debug_native.c b/libr/debug/p/debug_native.c index c4df47071f..2050e16fdc 100644 --- a/libr/debug/p/debug_native.c +++ b/libr/debug/p/debug_native.c @@ -949,7 +949,6 @@ eprintf ("++ EFL = 0x%08x %d\n", ctx.EFlags, r_offsetof (CONTEXT, EFlags)); return R_FALSE; } - int tid = dbg->tid; if (tid <0 || tid>=inferior_thread_count) { dbg->tid = tid = dbg->pid; }