svn commit: r269931 - projects/arm64/sys/arm64/arm64

Andrew Turner andrew at FreeBSD.org
Wed Aug 13 12:35:36 UTC 2014


Author: andrew
Date: Wed Aug 13 12:35:35 2014
New Revision: 269931
URL: http://svnweb.freebsd.org/changeset/base/269931

Log:
  Implement cpu_idle correctly

Modified:
  projects/arm64/sys/arm64/arm64/machdep.c

Modified: projects/arm64/sys/arm64/arm64/machdep.c
==============================================================================
--- projects/arm64/sys/arm64/arm64/machdep.c	Wed Aug 13 12:35:30 2014	(r269930)
+++ projects/arm64/sys/arm64/arm64/machdep.c	Wed Aug 13 12:35:35 2014	(r269931)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/ptrace.h>
 #include <sys/reboot.h>
 #include <sys/rwlock.h>
+#include <sys/sched.h>
 #include <sys/signalvar.h>
 #include <sys/sysproto.h>
 #include <sys/ucontext.h>
@@ -196,7 +197,16 @@ void
 cpu_idle(int busy)
 {
 
-	/* Insert code to halt (until next interrupt) for the idle loop. */
+	spinlock_enter();
+	if (!busy)
+		cpu_idleclock();
+	if (!sched_runnable())
+		__asm __volatile(
+		    "dsb sy \n"
+		    "wfi    \n");
+	if (!busy)
+		cpu_activeclock();
+	spinlock_exit();
 }
 
 void


More information about the svn-src-projects mailing list