The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fe51b5a76de38d20cddc05a4c6cb1103d1a0547e

commit fe51b5a76de38d20cddc05a4c6cb1103d1a0547e
Author:     Colin Percival <cperc...@freebsd.org>
AuthorDate: 2021-05-30 23:25:01 +0000
Commit:     Colin Percival <cperc...@freebsd.org>
CommitDate: 2021-06-21 03:09:47 +0000

    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
---
 sys/kern/kern_tslog.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

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);
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to