svn commit: r310791 - head/sys/arm/arm

Oleksandr Tymoshenko gonzo at FreeBSD.org
Thu Dec 29 21:55:24 UTC 2016


Author: gonzo
Date: Thu Dec 29 21:55:23 2016
New Revision: 310791
URL: https://svnweb.freebsd.org/changeset/base/310791

Log:
  [qemu] Fix VERSATILEPB kernel boot in QEMU broken by r300968
  
  QEMU does not implement hardware debug registers so when
  dbg_monitor_is_enabled is called kernel receives "invalid instruction"
  exception. QEMU implements only DIDR register and on read returns all
  zeroes to indicate that it doesn't support other registers. Real
  hardware has Version bits set.
  
  MFC after:	1 week

Modified:
  head/sys/arm/arm/debug_monitor.c

Modified: head/sys/arm/arm/debug_monitor.c
==============================================================================
--- head/sys/arm/arm/debug_monitor.c	Thu Dec 29 21:36:04 2016	(r310790)
+++ head/sys/arm/arm/debug_monitor.c	Thu Dec 29 21:55:23 2016	(r310791)
@@ -792,10 +792,21 @@ dbg_get_ossr(void)
 static __inline boolean_t
 dbg_arch_supported(void)
 {
+	uint32_t dbg_didr;
 
 	switch (dbg_model) {
 	case ID_DFR0_CP_DEBUG_M_V6:
 	case ID_DFR0_CP_DEBUG_M_V6_1:
+		dbg_didr = cp14_dbgdidr_get();
+		/*
+		 * read-all-zeroes is used by QEMU
+		 * to indicate that ARMv6 debug support
+		 * is not implemented. Real hardware has at
+		 * least version bits set
+		 */
+		if (dbg_didr == 0)
+			return (FALSE);
+		return (TRUE);
 	case ID_DFR0_CP_DEBUG_M_V7:
 	case ID_DFR0_CP_DEBUG_M_V7_1:	/* fall through */
 		return (TRUE);


More information about the svn-src-all mailing list