aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2021-05-30 23:25:01 +0000
committerColin Percival <cperciva@FreeBSD.org>2021-06-21 03:09:47 +0000
commitfe51b5a76de38d20cddc05a4c6cb1103d1a0547e (patch)
treee79fd865f9c04d825e06f7810f15c67a5aff926a
parent537a44bf281559d304850b5e28b6f8b8e44fd593 (diff)
downloadsrc-fe51b5a76de38d20cddc05a4c6cb1103d1a0547e.tar.gz
src-fe51b5a76de38d20cddc05a4c6cb1103d1a0547e.zip
kern_tslog: Include tslog data from loader
The i386 loader (and hopefully others to come) now passes tslog data as a "preloaded module". Include this in the data returned by the debug.tslog sysctl. Reviewed by: kevans
-rw-r--r--sys/kern/kern_tslog.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/kern/kern_tslog.c b/sys/kern/kern_tslog.c
index a0cb230f191c..dd3b25158340 100644
--- a/sys/kern/kern_tslog.c
+++ b/sys/kern/kern_tslog.c
@@ -28,6 +28,8 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/linker.h>
#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
@@ -74,6 +76,9 @@ sysctl_debug_tslog(SYSCTL_HANDLER_ARGS)
int error;
struct sbuf *sb;
size_t i, limit;
+ caddr_t loader_tslog;
+ void * loader_tslog_buf;
+ size_t loader_tslog_len;
/*
* This code can race against the code in tslog() which stores
@@ -84,6 +89,16 @@ sysctl_debug_tslog(SYSCTL_HANDLER_ARGS)
* anyone will ever experience this race.
*/
sb = sbuf_new_for_sysctl(NULL, NULL, 1024, req);
+
+ /* Get data from the boot loader, if it provided any. */
+ loader_tslog = preload_search_by_type("TSLOG data");
+ if (loader_tslog != NULL) {
+ loader_tslog_buf = preload_fetch_addr(loader_tslog);
+ loader_tslog_len = preload_fetch_size(loader_tslog);
+ sbuf_bcat(sb, loader_tslog_buf, loader_tslog_len);
+ }
+
+ /* Add data logged within the kernel. */
limit = MIN(nrecs, nitems(timestamps));
for (i = 0; i < limit; i++) {
sbuf_printf(sb, "%p", timestamps[i].td);