qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [Patch] x86 breakpoints and memory examination
@ 2008-01-13 17:57 Eddie Kohler
  2008-01-14  5:20 ` Mulyadi Santosa
  0 siblings, 1 reply; 2+ messages in thread
From: Eddie Kohler @ 2008-01-13 17:57 UTC (permalink / raw)
  To: qemu-devel

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

Hi all,

The following patch is useful for whole-system mode debugging and breakpoint 
setting on i386 QEMU.  It seems like both breakpoints and memory examination 
used semi-physical addresses, in that neither took account of segment 
translation.  This patch (relative to 0.9.1) adds segment translation.

I'm not sure this is the right way to do it (in fact, I'm sure that the memory 
examination patch is the WRONG way to do it) and would appreciate pointers or 
advice.

Thanks,
Eddie Kohler


[-- Attachment #2: qemu-0.9.1-i386-debug.patch --]
[-- Type: text/x-patch, Size: 1056 bytes --]

diff -ru qemu-0.9.1/target-i386/helper2.c qemu-0.9.1-p/target-i386/helper2.c
--- qemu-0.9.1/target-i386/helper2.c	2008-01-06 11:38:45.000000000 -0800
+++ qemu-0.9.1-p/target-i386/helper2.c	2008-01-12 23:56:34.000000000 -0800
@@ -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;
diff -ru qemu-0.9.1/target-i386/translate.c qemu-0.9.1-p/target-i386/translate.c
--- qemu-0.9.1/target-i386/translate.c	2008-01-06 11:38:45.000000000 -0800
+++ qemu-0.9.1-p/target-i386/translate.c	2008-01-13 00:00:23.000000000 -0800
@@ -6758,7 +6758,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] 2+ messages in thread

end of thread, other threads:[~2008-01-14  5:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-13 17:57 [Qemu-devel] [Patch] x86 breakpoints and memory examination Eddie Kohler
2008-01-14  5:20 ` Mulyadi Santosa

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