socsvn commit: r271071 - soc2014/op/freebsd-base/sys/kern

op at FreeBSD.org op at FreeBSD.org
Fri Jul 18 10:02:55 UTC 2014


Author: op
Date: Fri Jul 18 10:02:54 2014
New Revision: 271071
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=271071

Log:
  KSP: added debug code
  
  Signed-off-by: Oliver Pinter <oliver.pntr at gmail.com>
  
  git: https://github.com/opntr/opBSD/tree/op/gsoc2014/kpatch

Modified:
  soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c

Modified: soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c
==============================================================================
--- soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c	Fri Jul 18 08:23:53 2014	(r271070)
+++ soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c	Fri Jul 18 10:02:54 2014	(r271071)
@@ -38,12 +38,13 @@
 #include <sys/linker.h>
 #include <sys/linker_set.h>
 #include <sys/selfpatch.h>
+#include <sys/sysctl.h>
 
 #include <machine/md_var.h>
 #include <machine/specialreg.h>
 
 #define DBG(...)					\
-	if (bootverbose) {				\
+	if (selfpatch_debug) {				\
 		printf("%s: ", __func__);		\
 		printf(__VA_ARGS__);			\
 	}
@@ -51,13 +52,18 @@
 extern struct lf_selfpatch __start_set_ksp_kpatch_set[];
 extern struct lf_selfpatch __stop_set_ksp_kpatch_set[];
 
+static int selfpatch_debug=1;
+SYSCTL_INT(_debug, OID_AUTO, selfpatch_debug, CTLFLAG_RWTUN,
+    &selfpatch_debug, 0, "Set various levels of selfpatch debug");
 
 bool
 lf_selfpatch_patch_needed(struct lf_selfpatch *p)
 {
-	if (p == NULL)
-		return (false);
+	if (p == NULL) {
+		DBG("false\n");
 
+		return (false);
+	}
 
 	switch (p->feature_selector) {
 	case  KSP_CPU_FEATURE         :
@@ -134,5 +140,7 @@
 	KASSERT(p->patch_size == p->patchable_size,
 	    ("%s: patch_size != patchable_size", __func__));
 
+	DBG("%p\n", p->patch);
+
 	memcpy(p->patchable, p->patch, p->patchable_size);
 }


More information about the svn-soc-all mailing list