qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Derek Fawcus <dfawcus@cisco.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Patch: Bugfix in monitor,  tidy in translate
Date: Sun, 12 Sep 2004 22:17:47 +0100	[thread overview]
Message-ID: <20040912221747.F23092@edinburgh.cisco.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

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

[-- Attachment #2: dd-monitor --]
[-- Type: text/plain, Size: 813 bytes --]

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 },
 };

[-- Attachment #3: dd-translate --]
[-- Type: text/plain, Size: 3588 bytes --]

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;

             reply	other threads:[~2004-09-12 21:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-12 21:17 Derek Fawcus [this message]
2004-09-13 21:16 ` [Qemu-devel] Patch: Bugfix in monitor, tidy in translate Fabrice Bellard
2004-09-13 22:45   ` [Qemu-devel] Host API escape Derek Fawcus
2004-09-14  7:54     ` Gwenole Beauchesne
2004-09-14  9:49       ` Derek Fawcus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040912221747.F23092@edinburgh.cisco.com \
    --to=dfawcus@cisco.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).