ARMv7a/Cortex-A8: report watchpoint trigger insn
[openocd.git] / src / target / arm_dpm.h
1 /*
2 * Copyright (C) 2009 by David Brownell
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 #ifndef __ARM_DPM_H
21 #define __ARM_DPM_H
22
23 /**
24 * @file
25 * This is the interface to the Debug Programmers Model for ARMv6 and
26 * ARMv7 processors. ARMv6 processors (such as ARM11xx implementations)
27 * introduced a model which became part of the ARMv7-AR architecture
28 * which is most familiar through the Cortex-A series parts. While
29 * specific details differ (like how to write the instruction register),
30 * the high level models easily support shared code because those
31 * registers are compatible.
32 */
33
34 struct dpm_bp {
35 struct breakpoint *bp;
36 /* bp->address == breakpoint value register
37 * control == breakpoint control register
38 */
39 uint32_t control;
40 /* true if hardware state needs flushing */
41 bool dirty;
42 };
43
44 struct dpm_wp {
45 struct watchpoint *wp;
46 /* wp->address == watchpoint value register
47 * control == watchpoint control register
48 */
49 uint32_t control;
50 /* true if hardware state needs flushing */
51 bool dirty;
52 };
53
54 /**
55 * This wraps an implementation of DPM primitives. Each interface
56 * provider supplies a structure like this, which is the glue between
57 * upper level code and the lower level hardware access.
58 *
59 * It is a PRELIMINARY AND INCOMPLETE set of primitives, starting with
60 * support for CPU register access.
61 */
62 struct arm_dpm {
63 struct arm *arm;
64
65 /** Cache of DIDR */
66 uint32_t didr;
67
68 /** Invoke before a series of instruction operations */
69 int (*prepare)(struct arm_dpm *);
70
71 /** Invoke after a series of instruction operations */
72 int (*finish)(struct arm_dpm *);
73
74 /* WRITE TO CPU */
75
76 /** Runs one instruction, writing data to DCC before execution. */
77 int (*instr_write_data_dcc)(struct arm_dpm *,
78 uint32_t opcode, uint32_t data);
79
80 /** Runs one instruction, writing data to R0 before execution. */
81 int (*instr_write_data_r0)(struct arm_dpm *,
82 uint32_t opcode, uint32_t data);
83
84 /** Optional core-specific operation invoked after CPSR writes. */
85 int (*instr_cpsr_sync)(struct arm_dpm *dpm);
86
87 /* READ FROM CPU */
88
89 /** Runs one instruction, reading data from dcc after execution. */
90 int (*instr_read_data_dcc)(struct arm_dpm *,
91 uint32_t opcode, uint32_t *data);
92
93 /** Runs one instruction, reading data from r0 after execution. */
94 int (*instr_read_data_r0)(struct arm_dpm *,
95 uint32_t opcode, uint32_t *data);
96
97 /* BREAKPOINT/WATCHPOINT SUPPORT */
98
99 /**
100 * Enables one breakpoint or watchpoint by writing to the
101 * hardware registers. The specified breakpoint/watchpoint
102 * must currently be disabled. Indices 0..15 are used for
103 * breakpoints; indices 16..31 are for watchpoints.
104 */
105 int (*bpwp_enable)(struct arm_dpm *, unsigned index,
106 uint32_t addr, uint32_t control);
107
108 /**
109 * Disables one breakpoint or watchpoint by clearing its
110 * hardware control registers. Indices are the same ones
111 * accepted by bpwp_enable().
112 */
113 int (*bpwp_disable)(struct arm_dpm *, unsigned index);
114
115 /* The breakpoint and watchpoint arrays are private to the
116 * DPM infrastructure. There are nbp indices in the dbp
117 * array. There are nwp indices in the dwp array.
118 */
119
120 unsigned nbp;
121 unsigned nwp;
122 struct dpm_bp *dbp;
123 struct dpm_wp *dwp;
124
125 /** Address of the instruction which triggered a watchpoint. */
126 uint32_t wp_pc;
127
128 // FIXME -- read/write DCSR methods and symbols
129 };
130
131 int arm_dpm_setup(struct arm_dpm *dpm);
132 int arm_dpm_reinitialize(struct arm_dpm *dpm);
133
134 int arm_dpm_read_current_registers(struct arm_dpm *);
135 int arm_dpm_write_dirty_registers(struct arm_dpm *, bool bpwp);
136
137 void arm_dpm_report_wfar(struct arm_dpm *, uint32_t wfar);
138
139 #endif /* __ARM_DPM_H */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)