Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 2021 14:31:13 GMT
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 45af63e5f893 - stable/13 - Introduce kdb-level watchpoint functions
Message-ID:  <202104211431.13LEVDAx047663@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=45af63e5f89394219d56cc10e739be635fc6b116

commit 45af63e5f89394219d56cc10e739be635fc6b116
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2021-03-08 15:23:40 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2021-04-21 13:20:33 +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
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
    
    (cherry picked from commit 763107f26c3c3f4c8bb314a7cabc0a5548abff03)
---
 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 5ace60740bb6..5833ebf8285f 100644
--- a/sys/sys/kdb.h
+++ b/sys/sys/kdb.h
@@ -128,4 +128,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?202104211431.13LEVDAx047663>