[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/23] exec.c: Record watchpoint fault address and di
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 09/23] exec.c: Record watchpoint fault address and direction |
Date: |
Fri, 12 Sep 2014 14:23:40 +0100 |
When we check whether we've hit a watchpoint we know the address
that we were attempting to access and whether it was a read or a
write. Record this information in the CPUWatchpoint struct so that
target-specific code can report it to the guest.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
exec.c | 7 ++++++-
include/qom/cpu.h | 6 +++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/exec.c b/exec.c
index 181ade0..2794b4b 100644
--- a/exec.c
+++ b/exec.c
@@ -1673,7 +1673,12 @@ static void check_watchpoint(int offset, int len, int
flags)
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
if (cpu_watchpoint_address_matches(wp, vaddr, len)
&& (wp->flags & flags)) {
- wp->flags |= BP_WATCHPOINT_HIT;
+ if (flags == BP_MEM_READ) {
+ wp->flags |= BP_WATCHPOINT_HIT_READ;
+ } else {
+ wp->flags |= BP_WATCHPOINT_HIT_WRITE;
+ }
+ wp->hitaddr = vaddr;
if (!cpu->watchpoint_hit) {
cpu->watchpoint_hit = wp;
tb_check_watchpoint(cpu);
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 7c06f37..c325774 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -170,6 +170,7 @@ typedef struct CPUBreakpoint {
typedef struct CPUWatchpoint {
vaddr vaddr;
vaddr len;
+ vaddr hitaddr;
int flags; /* BP_* */
QTAILQ_ENTRY(CPUWatchpoint) entry;
} CPUWatchpoint;
@@ -622,9 +623,12 @@ void cpu_single_step(CPUState *cpu, int enabled);
#define BP_MEM_WRITE 0x02
#define BP_MEM_ACCESS (BP_MEM_READ | BP_MEM_WRITE)
#define BP_STOP_BEFORE_ACCESS 0x04
-#define BP_WATCHPOINT_HIT 0x08
+/* 0x08 currently unused */
#define BP_GDB 0x10
#define BP_CPU 0x20
+#define BP_WATCHPOINT_HIT_READ 0x40
+#define BP_WATCHPOINT_HIT_WRITE 0x80
+#define BP_WATCHPOINT_HIT (BP_WATCHPOINT_HIT_READ | BP_WATCHPOINT_HIT_WRITE)
int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
CPUBreakpoint **breakpoint);
--
1.9.1
- [Qemu-devel] [PULL 00/23] target-arm queue, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 17/23] target-arm: Push legacy wildcard TLB ops back into v6, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 09/23] exec.c: Record watchpoint fault address and direction,
Peter Maydell <=
- [Qemu-devel] [PULL 18/23] target-arm: Make *IS TLB maintenance ops affect all CPUs, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 23/23] hw/arm/boot: enable DTB support when booting ELF images, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 11/23] target-arm: Implement setting of watchpoints, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 14/23] target-arm: Set DBGDSCR.MOE for debug exceptions taken to AArch32, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 10/23] cpu-exec: Make debug_excp_handler a QOM CPU method, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 16/23] target-arm: Implement minimal DBGVCR, OSDLR_EL1, MDCCSR_EL0, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 15/23] target-arm: Remove comment about MDSCR_EL1 being dummy implementation, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 19/23] hw/arm/virt: fix pl011 and pl031 irq flags, Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 05/23] target-arm: Fix broken indentation in arm_cpu_reest(), Peter Maydell, 2014/09/12
- [Qemu-devel] [PULL 07/23] exec.c: Relax restrictions on watchpoint length and alignment, Peter Maydell, 2014/09/12