| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: db_machdep.c,v 1.38 2021/03/11 09:48:40 ryo Exp $ */ | | 1 | /* $NetBSD: db_machdep.c,v 1.39 2021/03/11 10:34:34 ryo Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2014 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2014 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Matt Thomas of 3am Software Foundry. | | 8 | * by Matt Thomas of 3am Software Foundry. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.38 2021/03/11 09:48:40 ryo Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.39 2021/03/11 10:34:34 ryo Exp $"); |
34 | | | 34 | |
35 | #ifdef _KERNEL_OPT | | 35 | #ifdef _KERNEL_OPT |
36 | #include "opt_compat_netbsd32.h" | | 36 | #include "opt_compat_netbsd32.h" |
37 | #endif | | 37 | #endif |
38 | | | 38 | |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
40 | #include <sys/systm.h> | | 40 | #include <sys/systm.h> |
41 | #include <sys/atomic.h> | | 41 | #include <sys/atomic.h> |
42 | #include <sys/cpu.h> | | 42 | #include <sys/cpu.h> |
43 | #include <sys/lwp.h> | | 43 | #include <sys/lwp.h> |
44 | #include <sys/intr.h> | | 44 | #include <sys/intr.h> |
45 | | | 45 | |
46 | #include <uvm/uvm.h> | | 46 | #include <uvm/uvm.h> |
| @@ -169,30 +169,31 @@ const struct db_command db_machine_comma | | | @@ -169,30 +169,31 @@ const struct db_command db_machine_comma |
169 | }, | | 169 | }, |
170 | { | | 170 | { |
171 | DDB_ADD_CMD( | | 171 | DDB_ADD_CMD( |
172 | "ttbr", db_md_ttbr_cmd, 0, | | 172 | "ttbr", db_md_ttbr_cmd, 0, |
173 | "Dump or count TTBR table", | | 173 | "Dump or count TTBR table", |
174 | "[/apc] address | pid", | | 174 | "[/apc] address | pid", |
175 | "\taddress:\taddress of pmap to display\n" | | 175 | "\taddress:\taddress of pmap to display\n" |
176 | "\tpid:\t\tpid of pmap to display") | | 176 | "\tpid:\t\tpid of pmap to display") |
177 | }, | | 177 | }, |
178 | { | | 178 | { |
179 | DDB_ADD_CMD( | | 179 | DDB_ADD_CMD( |
180 | "watch", db_md_watch_cmd, 0, | | 180 | "watch", db_md_watch_cmd, 0, |
181 | "set or clear watchpoint", | | 181 | "set or clear watchpoint", |
182 | "[/12345678] [address|#]", | | 182 | "[/rwbhlq] [address|#]", |
183 | "\taddress: watchpoint address to set\n" | | 183 | "\taddress: watchpoint address to set\n" |
184 | "\t#: watchpoint number to remove" | | 184 | "\t#: watchpoint number to remove\n" |
185 | "\t/1..8: size of data\n") | | 185 | "\t/rw: read or write access\n" |
| | | 186 | "\t/bhlq: size of access\n") |
186 | }, | | 187 | }, |
187 | { | | 188 | { |
188 | DDB_ADD_CMD( | | 189 | DDB_ADD_CMD( |
189 | "meminfo", db_md_meminfo_cmd, 0, | | 190 | "meminfo", db_md_meminfo_cmd, 0, |
190 | "Dump info about memory ranges", | | 191 | "Dump info about memory ranges", |
191 | NULL, NULL) | | 192 | NULL, NULL) |
192 | }, | | 193 | }, |
193 | #endif | | 194 | #endif |
194 | { | | 195 | { |
195 | DDB_END_CMD | | 196 | DDB_END_CMD |
196 | }, | | 197 | }, |
197 | }; | | 198 | }; |
198 | | | 199 | |
| @@ -968,40 +969,42 @@ db_md_watch_cmd(db_expr_t addr, bool hav | | | @@ -968,40 +969,42 @@ db_md_watch_cmd(db_expr_t addr, bool hav |
968 | | | 969 | |
969 | if (!have_addr) { | | 970 | if (!have_addr) { |
970 | show_watchpoints(); | | 971 | show_watchpoints(); |
971 | return; | | 972 | return; |
972 | } | | 973 | } |
973 | | | 974 | |
974 | accesstype = watchsize = 0; | | 975 | accesstype = watchsize = 0; |
975 | if ((modif != NULL) && (*modif != '\0')) { | | 976 | if ((modif != NULL) && (*modif != '\0')) { |
976 | int ch; | | 977 | int ch; |
977 | for (; *modif != '\0'; modif++) { | | 978 | for (; *modif != '\0'; modif++) { |
978 | ch = *modif; | | 979 | ch = *modif; |
979 | | | 980 | |
980 | switch (ch) { | | 981 | switch (ch) { |
981 | case '1': | | 982 | case 'b': |
982 | case '2': | | 983 | watchsize = 1; |
983 | case '3': | | 984 | break; |
984 | case '4': | | 985 | case 'h': |
985 | case '5': | | 986 | watchsize = 2; |
986 | case '6': | | | |
987 | case '7': | | | |
988 | case '8': | | | |
989 | watchsize = ch - '0'; | | | |
990 | break; | | 987 | break; |
991 | case 'l': | | 988 | case 'l': |
| | | 989 | watchsize = 4; |
| | | 990 | break; |
| | | 991 | case 'q': |
| | | 992 | watchsize = 8; |
| | | 993 | break; |
| | | 994 | case 'r': |
992 | accesstype |= WATCHPOINT_ACCESS_LOAD; | | 995 | accesstype |= WATCHPOINT_ACCESS_LOAD; |
993 | break; | | 996 | break; |
994 | case 's': | | 997 | case 'w': |
995 | accesstype |= WATCHPOINT_ACCESS_STORE; | | 998 | accesstype |= WATCHPOINT_ACCESS_STORE; |
996 | break; | | 999 | break; |
997 | } | | 1000 | } |
998 | } | | 1001 | } |
999 | } | | 1002 | } |
1000 | if (watchsize == 0) | | 1003 | if (watchsize == 0) |
1001 | watchsize = 4; /* default: 4byte */ | | 1004 | watchsize = 4; /* default: 4byte */ |
1002 | if (accesstype == 0) | | 1005 | if (accesstype == 0) |
1003 | accesstype = WATCHPOINT_ACCESS_LOADSTORE; /* default */ | | 1006 | accesstype = WATCHPOINT_ACCESS_LOADSTORE; /* default */ |
1004 | | | 1007 | |
1005 | added = -1; | | 1008 | added = -1; |
1006 | cleared = -1; | | 1009 | cleared = -1; |
1007 | if (0 <= addr && addr <= max_watchpoint) { | | 1010 | if (0 <= addr && addr <= max_watchpoint) { |