git: 4e1bc961bb44 - main - arm64, riscv: handle RB_KDB

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Tue, 01 Feb 2022 18:00:24 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=4e1bc961bb4467f074e48aa6e710ccd1aa7f2888

commit 4e1bc961bb4467f074e48aa6e710ccd1aa7f2888
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-02-01 17:58:07 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-02-01 17:59:54 +0000

    arm64, riscv: handle RB_KDB
    
    This allows entering the debugger at the earliest possible time, if
    the '-d' argument is passed to the kernel.
    
    Reviewed by:    jhb
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D34120
---
 sys/arm64/arm64/machdep.c | 4 ++++
 sys/riscv/riscv/machdep.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index 950169e50a5f..0e4aa657bb13 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -855,6 +855,10 @@ initarm(struct arm64_bootparams *abp)
 
 	dbg_init();
 	kdb_init();
+#ifdef KDB
+	if ((boothowto & RB_KDB) != 0)
+		kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
+#endif
 	pan_enable();
 
 	kcsan_cpu_init(0);
diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c
index 340b94448cfe..c27baa2d4a95 100644
--- a/sys/riscv/riscv/machdep.c
+++ b/sys/riscv/riscv/machdep.c
@@ -587,6 +587,10 @@ initriscv(struct riscv_bootparams *rvbp)
 	mutex_init();
 	init_param2(physmem);
 	kdb_init();
+#ifdef KDB
+	if ((boothowto & RB_KDB) != 0)
+		kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
+#endif
 
 	env = kern_getenv("kernelname");
 	if (env != NULL)