Skip to contentSkip to conversation

fix breakpoint address conversions

PATCH In review andrzej zaborowski 1 participant 2 messages Apr 7, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix breakpoint address conversions

Hi,
This patch adds conversion of the breakpoint addresses from the target to host space when invalidating translation blocks.
This issue prevented breakpoints from working on machines that have physical memory mapped starting at a different place than address zero (such as TI OMAP boards), except for the cases when the translation block was accidentaly invalidated due to e.g a jump, at the same time. As a result this was also breaking the stepping single instructions in gdb. This patch fixes this problem.
--
balrog 2oo6

Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258

#1 lore raw
Quoted 12 lines · andrzej zaborowski

Hi,
This patch adds conversion of the breakpoint addresses from the target to host space when invalidating translation blocks.
This issue prevented breakpoints from working on machines that have physical memory mapped starting at a different place than address zero (such as TI OMAP boards), except for the cases when the translation block was accidentaly invalidated due to e.g a jump, at the same time. As a result this was also breaking the stepping single instructions in gdb. This patch fixes this problem.
--
balrog 2oo6

Quoted 3 lines

Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258

I forgot about the attachment...
--
balrog 2oo6

Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258

exec.c +10 -2
diff -pNaur qemu/exec.c qemu-omap-clean/exec.c
@@ -993,9 +993,17 @@ static void tb_reset_jump_recursive(Tran
 #if defined(TARGET_HAS_ICE)
 static void breakpoint_invalidate(CPUState *env, target_ulong pc)
 {
-    target_ulong phys_addr;
+    target_ulong phys_addr, addr, pd;
+    PhysPageDesc *p;
 
-    phys_addr = cpu_get_phys_page_debug(env, pc);
+    addr = cpu_get_phys_page_debug(env, pc);
+    p = phys_page_find(addr >> TARGET_PAGE_BITS);
+    if (!p) {
+        pd = IO_MEM_UNASSIGNED;
+    } else {
+        pd = p->phys_offset;
+    }
+    phys_addr = (pd & TARGET_PAGE_MASK) | (addr & ~TARGET_PAGE_MASK);
     tb_invalidate_phys_page_range(phys_addr, phys_addr + 1, 0);
 }
 #endif