Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Mar 2021 15:05:55 GMT
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 763107f26c3c - main - Introduce kdb-level watchpoint functions
Message-ID:  <202103291505.12TF5tg7043973@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=763107f26c3c3f4c8bb314a7cabc0a5548abff03

commit 763107f26c3c3f4c8bb314a7cabc0a5548abff03
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2021-03-08 15:23:40 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2021-03-29 15:05:43 +0000

    Introduce kdb-level watchpoint functions
    
    This basically mirrors what already exists in ddb, but provides a
    slightly improved interface. It allows the caller to specify the
    watchpoint access type, and returns more specific error codes to
    differentiate failure cases.
    
    This will be used to support hardware watchpoints in gdb(4).
    
    Stubs are provided for architectures lacking hardware watchpoint logic
    (mips, powerpc, riscv), while other architectures are added individually
    in follow-up commits.
    
    Reviewed by:    jhb, kib, markj
    MFC after:      3 weeks
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D29155
---
 sys/mips/include/kdb.h    | 15 +++++++++++++++
 sys/powerpc/include/kdb.h | 14 ++++++++++++++
 sys/riscv/include/kdb.h   | 14 ++++++++++++++
 sys/sys/kdb.h             |  6 ++++++
 4 files changed, 49 insertions(+)

diff --git a/sys/mips/include/kdb.h b/sys/mips/include/kdb.h
index 33e54bc5fc05..64e39e154f21 100644
--- a/sys/mips/include/kdb.h
+++ b/sys/mips/include/kdb.h
@@ -55,4 +55,19 @@ static __inline void
 kdb_cpu_sync_icache(unsigned char *addr, size_t size)
 {
 }
+
+static __inline int
+kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access)
+{
+
+	return (ENXIO);
+}
+
+static __inline int
+kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size)
+{
+
+	return (0);
+}
+
 #endif /* _MACHINE_KDB_H_ */
diff --git a/sys/powerpc/include/kdb.h b/sys/powerpc/include/kdb.h
index 74f3e390b423..78e4966eaaf0 100644
--- a/sys/powerpc/include/kdb.h
+++ b/sys/powerpc/include/kdb.h
@@ -54,4 +54,18 @@ kdb_cpu_trap(int vector, int _)
 {
 }
 
+static __inline int
+kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access)
+{
+
+	return (ENXIO);
+}
+
+static __inline int
+kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size)
+{
+
+	return (0);
+}
+
 #endif /* _MACHINE_KDB_H_ */
diff --git a/sys/riscv/include/kdb.h b/sys/riscv/include/kdb.h
index 312cac502824..0fdff26bb432 100644
--- a/sys/riscv/include/kdb.h
+++ b/sys/riscv/include/kdb.h
@@ -59,4 +59,18 @@ kdb_cpu_trap(int type, int code)
 {
 }
 
+static __inline int
+kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access)
+{
+
+	return (ENXIO);
+}
+
+static __inline int
+kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size)
+{
+
+	return (0);
+}
+
 #endif /* _MACHINE_KDB_H_ */
diff --git a/sys/sys/kdb.h b/sys/sys/kdb.h
index 72eb51d57aee..746abb0ee4f4 100644
--- a/sys/sys/kdb.h
+++ b/sys/sys/kdb.h
@@ -127,4 +127,10 @@ extern const char * volatile kdb_why;
 #define	KDB_REQ_PANIC		2	/* User requested a panic */
 #define	KDB_REQ_REBOOT		3	/* User requested a clean reboot */
 
+/* Debug breakpoint/watchpoint access types */
+#define	KDB_DBG_ACCESS_EXEC	0
+#define	KDB_DBG_ACCESS_R	1
+#define	KDB_DBG_ACCESS_W	2
+#define	KDB_DBG_ACCESS_RW	3
+
 #endif /* !_SYS_KDB_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103291505.12TF5tg7043973>