From 86dc27e426b3ce9d85443f4792d40cbb807738f1 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 17 Apr 2011 13:40:58 +0000 Subject: [PATCH] Added the "div" instruction (with differentiation where required) --- src/arch/i386.ins | 10 ++++++++++ test/i386.S | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/src/arch/i386.ins b/src/arch/i386.ins index 18680f5..ae7b303 100644 --- a/src/arch/i386.ins +++ b/src/arch/i386.ins @@ -297,5 +297,15 @@ /* CDQ 0x99 1 */ { "cdq", 0x99, OP1F, AOT_NONE, AOT_NONE, AOT_NONE }, #endif +/* DIV 0xf6 /6 1 r/m8 */ +{ "divb", 0xf6, OP1F, OP_RM8_D0+6,AOT_NONE, AOT_NONE }, +{ "divb", 0xf6, OP1F, OP_RM8_D8+6,AOT_NONE, AOT_NONE }, +{ "divb", 0xf6, OP1F, OP_RM8_DW+6,AOT_NONE, AOT_NONE }, +{ "div", 0xf6, OP1F, OP_RM8_R8+6,AOT_NONE, AOT_NONE }, +/* DIV 0xf7 /6 1 r/mW */ +{ "div", 0xf7, OP1F, OP_RMW_D0+6,AOT_NONE, AOT_NONE }, +{ "div", 0xf7, OP1F, OP_RMW_D8+6,AOT_NONE, AOT_NONE }, +{ "div", 0xf7, OP1F, OP_RMW_DW+6,AOT_NONE, AOT_NONE }, +{ "div", 0xf7, OP1F, OP_RMW_RW+6,AOT_NONE, AOT_NONE }, /* NOP */ { "nop", 0x90, OP1F, AOT_NONE, AOT_NONE, AOT_NONE }, diff --git a/test/i386.S b/test/i386.S index f04339d..b88263d 100644 --- a/test/i386.S +++ b/test/i386.S @@ -82,4 +82,13 @@ cmc /* f5 */ cpuid /* 0f a2 */ cdq /* 0x99 */ + /* DIV */ + divb [%ecx] /* f6 31 */ + divb [%eax + $0x02] /* f6 70 02 */ + divb [%ebx + $0x4012] /* f6 b3 12 40 00 00 */ + div %dl /* f6 f2 */ + div [%ecx] /* f7 31 */ + div [%eax + $0x02] /* f7 70 02 */ + div [%ebx + $0x4012] /* f7 b3 12 40 00 00 */ + div %edx /* f7 f2 */ nop /* 0x90 */