Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C6bot-0006Zc-27 for qemu-devel@nongnu.org; Sun, 12 Sep 2004 17:23:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C6bos-0006ZJ-A9 for qemu-devel@nongnu.org; Sun, 12 Sep 2004 17:23:34 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6bos-0006ZG-6g for qemu-devel@nongnu.org; Sun, 12 Sep 2004 17:23:34 -0400 Received: from [144.254.224.140] (helo=ams-iport-1.cisco.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C6bjM-0001Hi-Ag for qemu-devel@nongnu.org; Sun, 12 Sep 2004 17:17:52 -0400 Received: from cisco.com (edinburgh.cisco.com [144.254.112.76]) by ams-core-1.cisco.com (8.12.10/8.12.6) with ESMTP id i8CLHl2P021467 for ; Sun, 12 Sep 2004 23:17:47 +0200 (MEST) Received: (from dfawcus@localhost) by cisco.com (8.8.8/2.6/Cisco List Logging/8.8.8) id WAA08753 for qemu-devel@nongnu.org; Sun, 12 Sep 2004 22:17:47 +0100 (BST) Date: Sun, 12 Sep 2004 22:17:47 +0100 From: Derek Fawcus Message-ID: <20040912221747.F23092@edinburgh.cisco.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="k+w/mQv8wyuph6w0" Subject: [Qemu-devel] Patch: Bugfix in monitor, tidy in translate Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Attached are a couple of patches, i386 target only. The first fixes a bug in monitor.c which prevented one from utilising edi, and also adds the ability to utilise the ss segment register, The second simply tidies up the code in target-i386/translate.c so that all assignments of '3' to is_jmp get replaced with DISAS_TB_JUMP, since I guess the latter was a late addition to the code. (I was adding a fake instruction, and this just made it easier for me to read the code) DF --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=dd-monitor diff -rup -U 5 ../qemu-snap/monitor.c ./monitor.c --- ../qemu-snap/monitor.c 2004-08-26 19:53:10.000000000 +0100 +++ ./monitor.c 2004-09-07 02:38:05.000000000 +0100 @@ -780,16 +780,17 @@ static MonitorDef monitor_defs[] = { { "edx", offsetof(CPUState, regs[2]) }, { "ebx", offsetof(CPUState, regs[3]) }, { "esp|sp", offsetof(CPUState, regs[4]) }, { "ebp|fp", offsetof(CPUState, regs[5]) }, { "esi", offsetof(CPUState, regs[6]) }, - { "esi", offsetof(CPUState, regs[7]) }, + { "edi", offsetof(CPUState, regs[7]) }, { "eflags", offsetof(CPUState, eflags) }, { "eip", offsetof(CPUState, eip) }, SEG("cs", R_CS) SEG("ds", R_DS) SEG("es", R_ES) + SEG("ss", R_SS) SEG("fs", R_FS) SEG("gs", R_GS) { "pc", 0, monitor_get_pc, }, { NULL }, }; --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=dd-translate diff -rup -U 5 ../qemu-snap/target-i386/translate.c ./target-i386/translate.c --- ../qemu-snap/target-i386/translate.c 2004-09-05 23:52:37.000000000 +0100 +++ ./target-i386/translate.c 2004-09-07 01:38:38.000000000 +0100 @@ -1431,11 +1431,11 @@ static inline void gen_jcc(DisasContext if (!inv) { func((long)tb, val, next_eip); } else { func((long)tb, next_eip, val); } - s->is_jmp = 3; + s->is_jmp = DISAS_TB_JUMP; } else { if (s->cc_op != CC_OP_DYNAMIC) { gen_op_set_cc_op(s->cc_op); s->cc_op = CC_OP_DYNAMIC; } @@ -1519,15 +1519,15 @@ static void gen_movl_seg_T0(DisasContext /* abort translation because the addseg value may change or because ss32 may change. For R_SS, translation must always stop as a special handling must be done to disable hardware interrupts for the next instruction */ if (seg_reg == R_SS || (s->code32 && seg_reg < R_FS)) - s->is_jmp = 3; + s->is_jmp = DISAS_TB_JUMP; } else { gen_op_movl_seg_T0_vm(offsetof(CPUX86State,segs[seg_reg])); if (seg_reg == R_SS) - s->is_jmp = 3; + s->is_jmp = DISAS_TB_JUMP; } } static inline void gen_stack_update(DisasContext *s, int addend) { @@ -1710,11 +1710,11 @@ static void gen_exception(DisasContext * { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_jmp_im(cur_eip); gen_op_raise_exception(trapno); - s->is_jmp = 3; + s->is_jmp = DISAS_TB_JUMP; } /* an interrupt is different from an exception because of the priviledge checks */ static void gen_interrupt(DisasContext *s, int intno, @@ -1722,20 +1722,20 @@ static void gen_interrupt(DisasContext * { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_jmp_im(cur_eip); gen_op_raise_interrupt(intno, next_eip); - s->is_jmp = 3; + s->is_jmp = DISAS_TB_JUMP; } static void gen_debug(DisasContext *s, unsigned int cur_eip) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_jmp_im(cur_eip); gen_op_debug(); - s->is_jmp = 3; + s->is_jmp = DISAS_TB_JUMP; } /* generate a generic end of block. Trace exception is also generated if needed */ static void gen_eob(DisasContext *s) @@ -1751,11 +1751,11 @@ static void gen_eob(DisasContext *s) gen_op_raise_exception(EXCP01_SSTP); } else { gen_op_movl_T0_0(); gen_op_exit_tb(); } - s->is_jmp = 3; + s->is_jmp = DISAS_TB_JUMP; } /* generate a jump to eip. No segment change must happen before as a direct call to the next block may occur */ static void gen_jmp(DisasContext *s, unsigned int eip) @@ -1764,11 +1764,11 @@ static void gen_jmp(DisasContext *s, uns if (s->jmp_opt) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_jmp((long)tb, eip); - s->is_jmp = 3; + s->is_jmp = DISAS_TB_JUMP; } else { gen_op_jmp_im(eip); gen_eob(s); } } @@ -3904,11 +3904,11 @@ static uint8_t *disas_insn(DisasContext } else { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_jmp_im(s->pc - s->cs_base); gen_op_hlt(); - s->is_jmp = 3; + s->is_jmp = DISAS_TB_JUMP; } break; case 0x100: modrm = ldub_code(s->pc++); mod = (modrm >> 6) & 3; --k+w/mQv8wyuph6w0--