From: vince <liuwf0302@gmail.com>
To: kvm@vger.kernel.org
Cc: ryan.roberts@arm.com, will@kernel.org,
julien.thierry.kdev@gmail.com, vince <liuwf0302@gmail.com>
Subject: [PATCH v3 3/3] arm64: Sync guest instruction patches for GDB breakpoints
Date: Wed, 1 Apr 2026 12:20:34 +0800 [thread overview]
Message-ID: <20260401042034.755639-4-liuwf0302@gmail.com> (raw)
In-Reply-To: <20260401042034.755639-3-liuwf0302@gmail.com>
---
arm/aarch64/gdb.c | 8 ++++++++
include/kvm/gdb.h | 10 ++++++++++
x86/gdb.c | 4 ++++
3 files changed, 22 insertions(+)
diff --git a/arm/aarch64/gdb.c b/arm/aarch64/gdb.c
index cbe854b..7872686 100644
--- a/arm/aarch64/gdb.c
+++ b/arm/aarch64/gdb.c
@@ -203,6 +203,14 @@ size_t kvm_gdb__arch_reg_pkt_size(void)
return GDB_REGS_SIZE;
}
+void kvm_gdb__arch_sync_guest_insn(void *host, size_t len)
+{
+ char *start = host;
+ char *end = start + len;
+
+ __builtin___clear_cache(start, end);
+}
+
/* ------------------------------------------------------------------ */
/* Helpers: which SP to expose as GDB register 31 */
/* ------------------------------------------------------------------ */
diff --git a/include/kvm/gdb.h b/include/kvm/gdb.h
index 623dad0..8e10cd7 100644
--- a/include/kvm/gdb.h
+++ b/include/kvm/gdb.h
@@ -90,6 +90,12 @@ size_t kvm_gdb__arch_reg_pkt_size(void);
/* GDB signal number to report on stop (SIGTRAP=5) */
int kvm_gdb__arch_signal(struct kvm_cpu *vcpu);
+/*
+ * Make a guest instruction patch visible to later instruction fetches.
+ * host points at the host virtual address backing the patched guest bytes.
+ */
+void kvm_gdb__arch_sync_guest_insn(void *host, size_t len);
+
/*
* Returns true if the KVM_EXIT_DEBUG exit was caused by a software
* breakpoint (INT3 / #BP exception), as opposed to a hardware debug
@@ -133,6 +139,10 @@ static inline bool kvm_gdb__active(struct kvm *kvm)
return false;
}
+static inline void kvm_gdb__arch_sync_guest_insn(void *host, size_t len)
+{
+}
+
#endif
#endif /* KVM__GDB_H */
diff --git a/x86/gdb.c b/x86/gdb.c
index f0fa941..91d8a5a 100644
--- a/x86/gdb.c
+++ b/x86/gdb.c
@@ -107,6 +107,10 @@ size_t kvm_gdb__arch_reg_pkt_size(void)
return GDB_REGS_SIZE;
}
+void kvm_gdb__arch_sync_guest_insn(void *host, size_t len)
+{
+}
+
/* ------------------------------------------------------------------ */
/* Helpers: read/write KVM register structures */
/* ------------------------------------------------------------------ */
--
2.34.1
prev parent reply other threads:[~2026-04-01 4:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 15:41 [PATCH kvmtool 0/2] Add GDB stub and step-debug support for x86 and arm64 vince
2026-03-18 15:41 ` [PATCH 1/2] x86: Add GDB stub and step-debug support vince
2026-03-18 15:41 ` [PATCH 2/2] arm64: " vince
2026-03-25 14:24 ` Ben Horgan
2026-03-27 2:37 ` [PATCH kvmtool " vince
2026-03-25 6:48 ` [PATCH kvmtool 0/2] Add GDB stub and step-debug support for x86 and arm64 vince
2026-03-27 2:48 ` [PATCH v2 " vince
2026-03-27 2:48 ` [PATCH v2 1/2] x86: Add GDB stub and step-debug support vince
2026-03-27 2:48 ` [PATCH v2 2/2] arm64: " vince
2026-04-01 4:20 ` [PATCH v3 0/3] Add GDB remote debug stub for x86 and arm64 vince
2026-04-01 4:20 ` [PATCH v3 1/3] x86: Add GDB stub and step-debug support vince
2026-04-01 4:20 ` [PATCH v3 2/3] arm64: " vince
2026-04-01 4:20 ` vince [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260401042034.755639-4-liuwf0302@gmail.com \
--to=liuwf0302@gmail.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox