Commit Graph

50 Commits

Author SHA1 Message Date
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
riz 67399f088e Use %zx in a format string to print a size_t, not %lx, so a kernel
with KSYMS_DEBUG will compile.
2005-06-25 05:30:04 +00:00
thorpej 73c9fbb0e6 Use ANSI function decls. Apply some static. 2005-06-23 23:15:12 +00:00
christos efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
perry da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
cube 9367bbf87b The way I handled /dev/ksyms requests vs. kernel requests was completely
broken.  Inside the kernel, we always have to use the real values of the
st_name fields, and only do the math when the request comes from userland.

No need for ksyms_getval_from{kernel,userland} hack anymore.  However, a
different version will be asked for pull-up in -2{,-0}, one that doesn't
break the API, that is.

Fixes PR#29133 from Jens Kessmeier.
2005-02-15 21:09:57 +00:00
matt cb57c6f8e9 Move detection of a special symbol into a separate function. Add some more
special symbols.
2004-02-19 03:42:01 +00:00
matt f01501b2c6 Support really large LKMs. Find out how much space is needed for symbols
and then allocate it on demand.  Rename some common symbols (__bss_start,
_edata, _end, __start_link_set_*, __stop_link_set_*) so that ".<module>"
is appended to them.  This shrinks an amd64 kernel by 20KB of BSS.
2004-02-18 23:44:49 +00:00
matt 004f0d503a s/sumbols/symbols/ 2004-02-18 20:41:09 +00:00
cube 3bf5e4c13b If ksyms have not been initialized, return ENXIO in ksymsopen instead of
ksymsread, because ksyms client test availability with open() and not
read().
2004-01-08 22:48:26 +00:00
cube d3730f1c68 o Fix a bug in ksyms that changed the real meaning of st_name entries for
symbols, and made it impossible for the kernel to use that value, and
  correctly find symbols from LKMs.
o Allow LKM users to use DDB to debug the entry function of a LKM by
  loading the symbol table with the temporary name /lkmtemp/ before calling
  it, and then renaming it once we know the module name.

Approved by ragge@.
2003-11-17 10:16:18 +00:00
ragge c556165f92 Do not try to enter more than MAX_INT16 symbols into the patricia tree;
the not-entered symbols will be found anyway but via a linear-search.
This only happens if something is wrong when linking the kernel.
Fixes problems reported on port-hp700.
2003-11-06 18:22:01 +00:00
christos 9ff8e797c6 fix uninitialized variables. one of them is a compiler bug. 2003-10-25 09:03:59 +00:00
ragge d13eca2ef5 long -> unsigned long. 2003-09-03 10:55:22 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
jdolecek bb940d41a0 Add __KERNEL_RCSID() 2003-06-01 00:03:39 +00:00
itojun f265a4a4da use strlcpy. [fixed off-by-one in subr_prop.c] 2003-05-16 14:25:02 +00:00
jdolecek d17c485917 make couple ksym functions' arguments const 2003-05-11 08:23:22 +00:00
ragge 4f432cf54f Remove useless entries from the symbol table at load.
Add patricia-tree-style lookup code for symbols (for fast lookups).
2003-05-07 21:28:16 +00:00
ragge 87c706341d #ifdef KSYMS_DEBUG should be #if NKSYMS. 2003-05-02 09:34:57 +00:00
tron 74905fd4b6 Fix build problems for kernel configurations without the "ksyms"
pseudo-device.
2003-05-02 09:19:51 +00:00
ragge b16f870314 Enable the ioctl's. 2003-05-01 20:46:20 +00:00
ragge 520c93de28 Make ksymms_init() take void * parameters instead of caddr_t. 2003-04-26 10:24:58 +00:00
ragge cddfd23e42 Mobe the SYMTAB_SPACE stuff to ksyms_init, so that it can be used without
DDB compiled-in.
2003-04-25 20:30:57 +00:00
ragge 0bd41108c4 Explicitly cast printf arg to long, from Tom Spindler. 2003-04-25 07:35:21 +00:00
ragge 44305abd0b Basic implementation of in-kernel symbol table manager + /dev/ksyms. 2003-04-24 19:56:43 +00:00