]> xenbits.xensource.com Git - people/liuw/rumprun.git/commitdiff
Store printf output a "dmesg buffer"
authorAntti Kantee <pooka@iki.fi>
Sun, 19 Apr 2015 16:06:54 +0000 (16:06 +0000)
committerAntti Kantee <pooka@iki.fi>
Sun, 19 Apr 2015 16:06:54 +0000 (16:06 +0000)
Currently, the easiest way to print the contents is to attach gdb
and from the gdb command prompt run: printf "%x", bmk_dmesg

lib/librumprun_core/subr_prf.c

index 677fb10b9a6c0fe4aa5d4c1827656dc0cad1cb50..9b0c135da7d84621962463a16ee6ab76823cbcca 100644 (file)
@@ -94,6 +94,13 @@ static const char HEXDIGITS[] = "0123456789ABCDEF";
  * functions
  */
 
+/* dmesg ring buffer */
+#ifndef BMK_DMESG_SIZE
+#define BMK_DMESG_SIZE (16*1024)
+#endif
+static char bmk_dmesg[BMK_DMESG_SIZE];
+static int bmk_dmesgoff;
+
 /*
  * putchar: print a single character on console or user terminal.
  *
@@ -105,8 +112,10 @@ static void
 cons_putchar(int c, int flags)
 {
 
-       if (flags & TOCONS)
-               (*v_putc)(c);
+       bmk_dmesg[bmk_dmesgoff] = c;
+       if (++bmk_dmesgoff == sizeof(bmk_dmesg))
+               bmk_dmesgoff = 0;
+       (*v_putc)(c);
 }
 
 static void