Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2018 18:43:00 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329989 - head/sys/arm/arm
Message-ID:  <201802251843.w1PIh0j9065508@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sun Feb 25 18:42:59 2018
New Revision: 329989
URL: https://svnweb.freebsd.org/changeset/base/329989

Log:
  Add support for booting into kdb on arm platforms when the RB_KDB is set
  (using "boot -d" at the loader propmt or setting boot_ddb in loader.conf).
  
  Submitted by:	Thomas Skibo <thomasskibo@yahoo.com>
  Differential Revision:	https://reviews.freebsd.org/D14428

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/machdep_boot.c

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c	Sun Feb 25 18:26:50 2018	(r329988)
+++ head/sys/arm/arm/machdep.c	Sun Feb 25 18:42:59 2018	(r329989)
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/kernel.h>
 #include <sys/linker.h>
 #include <sys/msgbuf.h>
+#include <sys/reboot.h>
 #include <sys/rwlock.h>
 #include <sys/sched.h>
 #include <sys/syscallsubr.h>
@@ -785,7 +786,17 @@ set_stackptrs(int cpu)
 }
 #endif
 
+static void
+arm_kdb_init(void)
+{
 
+	kdb_init();
+#ifdef KDB
+	if (boothowto & RB_KDB)
+		kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
+#endif
+}
+
 #ifdef FDT
 #if __ARM_ARCH < 6
 void *
@@ -1054,7 +1065,7 @@ initarm(struct arm_boot_params *abp)
 
 	init_param2(physmem);
 	dbg_monitor_init();
-	kdb_init();
+	arm_kdb_init();
 
 	return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
 	    sizeof(struct pcb)));
@@ -1263,7 +1274,7 @@ initarm(struct arm_boot_params *abp)
 	/* Init message buffer. */
 	msgbufinit(msgbufp, msgbufsize);
 	dbg_monitor_init();
-	kdb_init();
+	arm_kdb_init();
 	/* Apply possible BP hardening. */
 	cpuinfo_init_bp_hardening();
 	return ((void *)STACKALIGN(thread0.td_pcb));

Modified: head/sys/arm/arm/machdep_boot.c
==============================================================================
--- head/sys/arm/arm/machdep_boot.c	Sun Feb 25 18:26:50 2018	(r329988)
+++ head/sys/arm/arm/machdep_boot.c	Sun Feb 25 18:42:59 2018	(r329989)
@@ -27,6 +27,7 @@
  */
 
 #include "opt_platform.h"
+#include "opt_ddb.h"
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
@@ -55,6 +56,10 @@ __FBSDID("$FreeBSD$");
 
 #ifdef EFI
 #include <sys/efi.h>
+#endif
+
+#ifdef DDB
+#include <ddb/ddb.h>
 #endif
 
 #ifdef DEBUG



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