Logging without locking before the MMU is initialized.
Some architectures require MMU to be initialized before atomic
operations are functional.
Change-Id: Ibebae7a811f5710a387d058bf78c046057e2df45
diff --git a/src/dlog.c b/src/dlog.c
index e9643c5..9737805 100644
--- a/src/dlog.c
+++ b/src/dlog.c
@@ -176,18 +176,17 @@
}
/**
- * Same as "dlog", except that arguments are passed as a va_list.
+ * Same as "dlog_nosync", except that arguments are passed as a va_list. This
+ * must only be used before the MMU has been initialized so that the atomic
+ * operations needed for locking are operational.
*/
-void vdlog(const char *fmt, va_list args)
+void vdlog_nosync(const char *fmt, va_list args)
{
- static struct spinlock sl = SPINLOCK_INIT;
const char *p;
size_t w;
int flags;
char buf[2];
- sl_lock(&sl);
-
for (p = fmt; *p; p++) {
switch (*p) {
default:
@@ -281,7 +280,31 @@
break;
}
}
+}
+/**
+ * Prints the given format string to the debug log without locking. This must
+ * only be used before the MMU has been initialized so that the atomic
+ * operations needed for locking are operational.
+ */
+void dlog_nosync(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ vdlog_nosync(fmt, args);
+ va_end(args);
+}
+
+/**
+ * Same as "dlog", except that arguments are passed as a va_list.
+ */
+void vdlog(const char *fmt, va_list args)
+{
+ static struct spinlock sl = SPINLOCK_INIT;
+
+ sl_lock(&sl);
+ vdlog_nosync(fmt, args);
sl_unlock(&sl);
}