Commit Graph

76 Commits

Author SHA1 Message Date
matt
d0c9fc59d2 Change the ksyms ioctls to more compat_netbsd32 friendly. Use _IOWR ioctls
to avoid extra copyouts.  With these changes, netstat and vmstat work on
mips64eb with the normal N32 userland and a N64 kernel.
2015-05-20 02:45:20 +00:00
christos
f95c68cfed Don't hard code crap we have perfectly good constants for. 2014-12-15 13:50:10 +00:00
christos
161dbb7f01 - use the unused section in the array to put a NetBSD note in it
- cleanup the hard-coded constants in the stringtab
2014-12-09 02:30:09 +00:00
joerg
a26164117a Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.
2014-08-17 21:17:43 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland
a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
chs
3f6811bc27 don't overwrite the CTF info with the symbol table. 2013-04-07 00:49:45 +00:00
matt
4ffdc4bda5 Add a separate bool to indicate a symbol table has been loaded.
ksym_initted indicates whether the kmutex has been initted or not.
Add __cacheline_aligned to the kmutex.
2013-01-17 14:36:36 +00:00
chs
2c889486d3 make ksyms structures not depend on KDTRACE_HOOKS.
always include a CTF section, even though it might be empty.
this fixes savecore's generated kernel symbol table files.
2012-11-18 00:06:56 +00:00
christos
062de7c5a1 close the comment, there is a draft. 2011-12-05 21:30:48 +00:00
christos
857226ee50 PR/45687: Mike Pumford: savecore: (null): _ksyms_hdr not in namelist
Make it non-static and add a comment so that they don't become static again.
2011-12-05 20:55:14 +00:00
uebayasi
3abce800c0 Define SYMTAB_SPACE in opt_ksyms.h, not opt_ddbparam.h. Ensure
that ddb(4) code is independent of SYMTAB_SPACE value.
2011-07-28 13:42:16 +00:00
uebayasi
2de1fdfe8b These don't need uvm/uvm_extern.h. 2011-07-27 14:35:33 +00:00
rmind
bd5b92d68b - Replace few malloc(9) uses with kmem(9).
- Rename buf_malloc() to buf_alloc(), fix comments.
- Remove some unnecessary inclusions.
2011-04-24 18:46:22 +00:00
matt
1cf358c3b4 When determining max/min sym value, ignore ABS symbols which don't
have a type.  This stops ksym thinking that the _KERNEL_OPT symbols
could actually be useful.
2011-01-04 01:40:19 +00:00
jakllsch
359dcd7f55 Use 'z' printf format modifier to print size_t in debug code. 2010-07-27 14:25:23 +00:00
tsutsui
9a9555d932 Some KNF. 2010-05-04 14:14:54 +00:00
darran
17b7c13057 DTrace: Fix several bugs where the mod_ctf_get() function could return
success even though no CTF section was present in the kernel or module.
This fixes the panic that several people saw when trying out the FBT
provider without updating /boot or missing a CTF section in /netbsd.
2010-05-03 09:51:36 +00:00
darran
0ede06284a DTrace: Make the CTF handling conditional on KDTRACE_HOOKS for now since
it breaks the boot of the atari kernel (and possibly others).
2010-03-14 21:27:49 +00:00
christos
e8cb686278 make this compile. 2010-03-13 16:27:06 +00:00
darran
38c72d335c DTrace: Add support for CTF sections in the netbsd elf image, load these
at boot.
Add a ksyms_mod_foreach() function to iterate a callback function over the
set of elf symbols for a specific module (netbsd included).
Add kern_ctf.c and mod_ctf_get() to allow the retrieval and decompression
of CTF sections for a specific module.
2010-03-12 21:43:10 +00:00
darran
c9e0343fff Revert accidental commit of CTF work-in-progress changes. 2010-03-01 22:27:07 +00:00
darran
6a9056a926 DTrace: Add an SDT (Statically Defined Tracing) provider framework, and
implement most of the proc provider.  Adds proc:::create, exec,
exec_success, exec_faillure, signal_send, signal_discard, signal_handle,
lwp_create, lwp_start, lwp_exit.
2010-03-01 21:10:13 +00:00
hubertf
af120bb199 Replace more printfs with aprint_normal / aprint_verbose
Makes "boot -z" go mostly silent for me.
2010-01-31 00:43:37 +00:00
pooka
5fc3d70195 Remove highly questionable assert which demans that the kernel symbol
table is in memory at a lower address than the string table.
2009-11-25 13:16:55 +00:00
cegger
b8817e4aed ansify function definitions 2009-03-15 17:14:40 +00:00
jmmv
f084134ae9 Initialize SYMTAB_SPACE ksyms during ksyms_init. Per PR port-evbarm/40311. 2009-01-23 09:22:25 +00:00
pooka
f671460fc0 _KERNEL_OPT 2009-01-01 19:10:17 +00:00
ad
e91b9bcc27 Make the fake ELF object work with gdb.
- Output a .bss section and make all the symbols relative to it, instead
  of making them absolute.
- Output a single load section, no need for two.

'gdb /dev/ksyms' still doesn't work because ksyms doesn't do mmap yet.
2008-12-05 21:38:10 +00:00
martin
719a906ef5 As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.
2008-11-30 18:21:31 +00:00
ad
c6555ead19 Our qsort() is inappropriate for kernel use because it makes recursive
calls. Replace it with a kheapsort() function in kernel. Pointed out
by tron@.
2008-11-16 16:15:58 +00:00
ad
7bdea38e00 Remove unneeded includes. 2008-11-16 15:29:53 +00:00
ad
b766740610 Fix ksyms_getname() broken in previous. 2008-11-16 15:28:15 +00:00
ad
9485f42356 - Local symbols could shadow globals in some instances. Fix it.
- mutex_enter() from ksyms_getval() could panic due to a change made
  in revision 1.40. Fix it.

- Replace the p-tree with a binary search of global symbols. Saves about
  250kB of wired memory on i386 and allows for faster lookups within
  module symbol tables.
2008-11-16 15:13:35 +00:00
ad
0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
christos
bc44c7d780 don't hold locks in ddb (call ksyms_getval_unlocked()), pointed out by ad. 2008-10-24 13:55:42 +00:00
christos
ff0507541f don't expose ksyms_lock 2008-10-23 20:41:13 +00:00
ad
ee66516bfd PR kern/38814 ksyms needs locking
- Make ksyms MT safe.
- Fix deadlock from an operation like "modload foo.lkm < /dev/ksyms".
- Fix uninitialized structure members.
- Reduce memory footprint for loaded modules.
- Export ksyms structures for kernel grovellers like savecore.
- Some KNF.
2008-10-20 10:24:18 +00:00
skrll
af82972758 RCSID police. 2008-10-10 23:09:19 +00:00
ad
139d645eee PR kern/39681 ddb doesn't work with new MODULAR modules
Complete initialization of new symbol table record.
2008-10-06 11:49:44 +00:00
christos
0f5d35d8d1 report local symbols too. 2008-07-22 21:18:35 +00:00
matt
e463f28885 For each symtab, remember which symbols have the minimum and maximum value.
When returning a "close" symbol, make sure the value being searched for is
within the symtab.  This prevents ddb matching addresses beyond the end of
the kernel.
2008-02-20 02:30:51 +00:00
ad
c0cd2b871b Ignore symbols marked undefined. 2008-01-04 11:28:13 +00:00
christos
7074d009d5 Don't panic if we don't find a symbol or string table. Perhaps the kernel
has been stripped?
2007-04-02 16:44:44 +00:00
christos
53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
jmmv
c3429f8083 Pass a simple ELF header to ksyms_init_explicit with the minimum contents
required to initialize ksyms_hdr.  Otherwise LKMs do not work when using
ksyms_init_explicit instead of ksyms_init, as is the case of booting an
i386 kernel using Multiboot.
2006-11-06 13:35:35 +00:00
yamt
1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
jmmv
133d7c5ba4 Add a function (ksyms_init_explicit) to add a symbol table when we know the
exact address of the symtab and strtab ELF sections contents beforehand.

This will be used in i386's Multiboot code to add the initial kernel ksyms
without having to prepare a minimal ELF image that matches the format
expected by the reguluar ksyms_init function.

This part was reviewed by cube@ and successfully passes a full i386 release
build.
2006-10-25 13:46:36 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00