qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] PATCH: allow i386 debugging when segment offset != 0
@ 2008-03-06 22:50 Eddie Kohler
  0 siblings, 0 replies; only message in thread
From: Eddie Kohler @ 2008-03-06 22:50 UTC (permalink / raw)
  To: qemu-devel

Hi all,

This patch makes QEMU's gdb debugging stub and CPU breakpoints work when
the segment offset is not 0.

Previously, the debugging stub assumed the segment offset was 0, leading
to very odd behavior.

This patch assumes that the code segment and data segment have the same
offset.  This is a reasonable assumption.  Making the code work for
different code and data offsets would be more invasive.

Please accept this patch (this is a resend.)

Eddie Kohler


Index: target-i386/helper2.c
===================================================================
RCS file: /sources/qemu/qemu/target-i386/helper2.c,v
retrieving revision 1.62
diff -u -r1.62 helper2.c
--- target-i386/helper2.c	24 Dec 2007 14:04:06 -0000	1.62
+++ target-i386/helper2.c	6 Mar 2008 22:46:46 -0000
@@ -1081,6 +1081,7 @@
  {
      uint32_t pde_addr, pte_addr;
      uint32_t pde, pte, paddr, page_offset, page_size;
+    addr += env->segs[R_DS].base;

      if (env->cr[4] & CR4_PAE_MASK) {
          uint32_t pdpe_addr, pde_addr, pte_addr;
Index: target-i386/translate.c
===================================================================
RCS file: /sources/qemu/qemu/target-i386/translate.c,v
retrieving revision 1.79
diff -u -r1.79 translate.c
--- target-i386/translate.c	24 Feb 2008 07:45:42 -0000	1.79
+++ target-i386/translate.c	6 Mar 2008 22:46:46 -0000
@@ -6740,7 +6740,7 @@
      for(;;) {
          if (env->nb_breakpoints > 0) {
              for(j = 0; j < env->nb_breakpoints; j++) {
-                if (env->breakpoints[j] == pc_ptr) {
+                if (env->breakpoints[j] == pc_ptr - dc->cs_base) {
                      gen_debug(dc, pc_ptr - dc->cs_base);
                      break;
                  }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-06 22:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-06 22:50 [Qemu-devel] PATCH: allow i386 debugging when segment offset != 0 Eddie Kohler

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).