Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern create an nmap table for module symtabs too.
details: https://anonhg.NetBSD.org/src/rev/fde0c6d1560d
branches: trunk
changeset: 354365:fde0c6d1560d
user: chs <chs%NetBSD.org@localhost>
date: Wed Jun 14 00:52:37 2017 +0000
description:
create an nmap table for module symtabs too.
needed by dtrace.
diffstat:
sys/kern/kern_ksyms.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diffs (72 lines):
diff -r f7bc3c1b59fc -r fde0c6d1560d sys/kern/kern_ksyms.c
--- a/sys/kern/kern_ksyms.c Wed Jun 14 00:40:05 2017 +0000
+++ b/sys/kern/kern_ksyms.c Wed Jun 14 00:52:37 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ksyms.c,v 1.84 2016/07/07 06:55:43 msaitoh Exp $ */
+/* $NetBSD: kern_ksyms.c,v 1.85 2017/06/14 00:52:37 chs Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.84 2016/07/07 06:55:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.85 2017/06/14 00:52:37 chs Exp $");
#if defined(_KERNEL) && defined(_KERNEL_OPT)
#include "opt_copy_symtab.h"
@@ -336,8 +336,9 @@
nglob = 0;
for (i = n = 0; i < nsyms; i++) {
- /* This breaks CTF mapping, so don't do it when
- * DTrace is enabled
+ /*
+ * This breaks CTF mapping, so don't do it when
+ * DTrace is enabled.
*/
#ifndef KDTRACE_HOOKS
/*
@@ -396,6 +397,7 @@
tab->sd_symstart = nsym;
tab->sd_symsize = n * sizeof(Elf_Sym);
tab->sd_nglob = nglob;
+
addsymtab_strstart = str;
if (kheapsort(nsym, n, sizeof(Elf_Sym), addsymtab_compar, &ts) != 0)
panic("addsymtab");
@@ -731,11 +733,14 @@
char *strstart, vsize_t strsize)
{
struct ksyms_symtab *st;
+ void *nmap;
st = kmem_zalloc(sizeof(*st), KM_SLEEP);
+ nmap = kmem_zalloc(symsize / sizeof(Elf_Sym) * sizeof (uint32_t),
+ KM_SLEEP);
mutex_enter(&ksyms_lock);
addsymtab(name, symstart, symsize, strstart, strsize, st, symstart,
- NULL, 0, NULL);
+ NULL, 0, nmap);
mutex_exit(&ksyms_lock);
}
@@ -757,6 +762,8 @@
if (!ksyms_isopen) {
TAILQ_REMOVE(&ksyms_symtabs, st, sd_queue);
ksyms_sizes_calc();
+ kmem_free(st->sd_nmap,
+ st->sd_nmapsize * sizeof(uint32_t));
kmem_free(st, sizeof(*st));
}
break;
@@ -984,6 +991,8 @@
next = TAILQ_NEXT(st, sd_queue);
if (st->sd_gone) {
TAILQ_REMOVE(&ksyms_symtabs, st, sd_queue);
+ kmem_free(st->sd_nmap,
+ st->sd_nmapsize * sizeof(uint32_t));
kmem_free(st, sizeof(*st));
resize = true;
}
Home |
Main Index |
Thread Index |
Old Index