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