Commit Graph

2000 Commits

Author SHA1 Message Date
Peter Wemm
b421db370b The last argument to vm_object_page_clean() are now bit flags, rather than
the old true/false.

While here, have vfs_msync() only call vm_object_page_clean() with
OBJPC_SYNC if called with MNT_WAIT flags.  vfs_msync() is called at unmount
time (with MNT_WAIT) and from the syncer process (formerly update).
This should make dirty mmap writebacks a little less nasty.

I have tested this a little with SOFTUPDATES enabled, but I don't normally
use it since I've been badly burned too many times.
1998-10-31 07:42:04 +00:00
David Greenman
2a78b8d1f8 Unwire everything to the inactive queue in order to preserve LRU ordering. 1998-10-30 14:53:54 +00:00
Mike Smith
35d27a0f39 Add the ability to specify where on the at_shutdown queue a handler is
installed.

Remove cpu_power_down, and replace it with an entry at the end of the
SHUTDOWN_FINAL queue in the only place it's used (APM).

Submitted by:	Some ideas from Bruce Walter <walter@fortean.com>
1998-10-30 05:41:15 +00:00
Bruce Evans
cbbbd4c330 Oops, rev.1.167 made the device number checking in bdevvp() too strict
for mfs root mounts.  Don't require major 255 to be in bdevsw[].
1998-10-29 11:50:32 +00:00
David Greenman
0d5a725446 Fixed editing error. Pointed out by bde. 1998-10-29 11:04:22 +00:00
Peter Wemm
20f02ef5e9 Remove the V_SAVEMETA flag, nothing uses it any more now that msdosfs and
ext2fs call vtruncbuf() directly.  This simplifies and cleans up
vinvalbuf() a little.
1998-10-29 09:51:28 +00:00
Garrett Wollman
a64d49d14f A Perl5 version of makedevops.sh. Fixes a bug in the sh/awk version
which really annoyed me at the time but I don't think bites me any
more.
1998-10-29 01:52:59 +00:00
Garrett Wollman
af2a5c769a The new resource manager, hopefully in a reasonably stable form. 1998-10-29 01:48:36 +00:00
David Greenman
730075613a Added a second argument, "activate" to the vm_page_unwire() call so that
the caller can select either inactive or active queue to put the page on.
1998-10-28 13:37:02 +00:00
Doug Rabson
45a576b57a Lots of debugging code and some bugfixes.
Submitted by: Nick Hibma <nick.hibma@jrc.it>
1998-10-27 09:21:43 +00:00
Bruce Evans
885bf0b57a Updated the major number check in vfs_object_create(). It's not
clear if the check is necessary, but vfs_object_create() is called
for all vnodes and it was silly to create objects for VBLK vnodes
that don't even have a driver.
1998-10-26 08:07:00 +00:00
Bruce Evans
fffd686a31 Fixed breakage of the GPROF case of statclock() in the previous commit. 1998-10-26 06:13:18 +00:00
Bruce Evans
b64f28be2d Oops, back out some local changes that shouldn't have been in the
previous commit.
1998-10-25 20:11:36 +00:00
Bruce Evans
c8a1bed2ab Fixed breakage of the !SMP case of roundrobin() in the previous commit. 1998-10-25 19:57:23 +00:00
Poul-Henning Kamp
f5ef029e92 Nitpicking and dusting performed on a train. Removes trivial warnings
about unused variables, labels and other lint.
1998-10-25 17:44:59 +00:00
Bruce Evans
37906c686d Fixed device number checking in bdevvp():
- dev != NODEV was checked for, but 0 was returned on failure.  This was
  fixed in Lite2 (except the return code was still slightly wrong (ENODEV
  instead of ENXIO)) but the changes were not merged.  This case probably
  doesn't actually occur under FreeBSD.
- major(dev) was not checked to have a valid non-NULL bdevsw entry.  This
  caused panics when the driver for the root device didn't exist.

Fixed minor misformattings in bdevvp().  Rev.1.14 consisted mainly of
gratuitous reformattings that seem to have caused many Lite2 merge
errors.

PR:			8417
1998-10-25 16:11:49 +00:00
Bruce Evans
a6cda5b68f Fixed sysctl attachment for statically configured vfs's.
Broken in:		previous commit
1998-10-25 10:52:34 +00:00
Mike Smith
6fe8861e01 Don't put 0x in front of %p, it does it already.
Submitted by:	 Brian Feldman <green@janus.syracuse.net>
1998-10-24 18:35:09 +00:00
Poul-Henning Kamp
3bac064ff7 Change the way we simulate stable storage for timecounters.
If you have problems with the "calcru" messages and processes being
killed for excessive cpu time, try to increase the NTIMECOUNTER
#define and report your findings.
1998-10-23 10:44:52 +00:00
John Polstra
2c2a0cf191 Eliminate a superfluous comment. 1998-10-21 16:31:38 +00:00
Peter Wemm
52c24af701 Some cleanups and optimizations:
- Use the system headers method for Elf32/Elf64 symbol compatability
- get rid of the UPRINTF debugging.
- check the ELF header for compatability much more completely
- optimize the section mapper.  Use the same direct VM interfaces that
  imgact_aout.c and kern_exec.c use.
- Check the return codes from the vm_* functions better.  Some return
  KERN_* results, not an errno.
- prefault the page tables to reduce startup faults on page tables like
  a.out does.
- reset the segment protection to zero for each loop, otherwise each
  segment could get progressively more privs. (eg: if the first was
  read/write/execute, and the second was meant to be read/execute, the
  bug would make the second r/w/x too.  In practice this was not a
  problem because executables are normally laid out with text first.)
- Don't impose arbitary limits.  Use the limits on headers imposed by
  the need to fit them into one page.
- Remove unused switch() cases now that the verbose debugging is gone.

I've been using an earlier version of this for a month or so.
This sped up ELF exec speed a bit for me but I found it hard to get
consistant benchmarks when I tested it last (a few weeks ago).
I'm still bothered by the page read out of order caused by the
transition from data to bss. This which requires either part filling the
transition page or clearing the remainder.
1998-10-18 15:55:12 +00:00
Bruce Evans
95242f5a02 Overload the correct errno for attempts to set an in-core label with
a raw partition at a nonzero offset (EINVAL should have been EXDEV;
DIOCSDINFO was broken, and DIOCWDINFO was broken because it depended
on DIOCSDINFO).

A zero offset for the raw partition should probably be enforced in
setdisklabel(), and DIOCWDINFO should probably always be handled by
first calling setdisklabel() so that writedisklabel() doesn't need to
enforce it, but this has never been done; dsioctl() has a special
check.  Changes in this commit are limited to dsioctl() to preserve
bug for bug compatibility in drivers that don't use the slice code
(notably the ccd driver, which allows setting a bogus label in
DIOCWDINFO and doesn't undo the setting when writedisklabel() fails).
1998-10-17 09:46:42 +00:00
Bruce Evans
e36b4f594a Use only the correct raw partition for writing labels. Don't use the
partition that the label ioctl is being done on just because it has
offset 0, since there is no guarantee that such a partition is large
enough to contain the label.  Don't use the wrong raw partition (0
instead of RAW_PART).

This fixes problems rewriting bizarre labels (with a nonzero offset
for the 'a' partition) in newfs(8).  Such labels shouldn't normally
be used, but creating them was allowed if the ioctl was done on the
raw partition, and sysinstall creates them if the root partition isn't
allocated first.

Note that allowing write access to a partition other than the one that
has been checked for write access doesn't increase security holes
significantly, since write access to any partition already allows
changing the in-core label.

This fix should be in 3.0R.  Rev.1.26 of newfs/newfs.c shouldn't be
in 3.0R.
1998-10-17 07:49:04 +00:00
Jordan K. Hubbard
908dcbd2a4 fixup for alpha. 1998-10-16 10:14:21 +00:00
Peter Wemm
aa855a598d *gulp*. Jordan specifically OK'ed this..
This is the bulk of the support for doing kld modules.  Two linker_sets
were replaced by SYSINIT()'s.  VFS's and exec handlers are self registered.
kld is now a superset of lkm.  I have converted most of them, they will
follow as a seperate commit as samples.
This all still works as a static a.out kernel using LKM's.
1998-10-16 03:55:01 +00:00
Peter Wemm
df481e793f Fix some bugs in link_aout.c caused by using uninitialized malloc space.
Pre-Approved by:  jkh
1998-10-16 03:45:35 +00:00
Peter Wemm
434bf653d2 - bzero() after malloc() bug fix
- look up relocation symbol names in correct table bugfix.
- remove unused (initialized to 0) variable and conditional free() of it.
1998-10-15 17:16:24 +00:00
Peter Wemm
bd4e381b03 - bzero() after malloc(). This is especially obvious when kern_malloc is
compiled with DIAGNOSTIC.
- Don't break from the preload module processing loop prematurely.
1998-10-15 17:12:12 +00:00
Peter Wemm
ddd62546e1 Fix sysinit_add().
- Don't include multiple copies of the previous sysinit in the new one.
- Leave space for and explicitly null terminate the new list.
1998-10-15 17:09:19 +00:00
Doug Rabson
216a0f2d7f Don't frob the user stack directly, use suword instead. This fixes the
elf_freebsd_fixup() panic which many people have noticed on the alpha.
1998-10-15 09:52:19 +00:00
Doug Rabson
67fc32a9ff Use the interface name as well as the method name when creating the method
description.

Submitted by: Nick Hibma <nick.hibma@jrc.it>
1998-10-15 09:50:45 +00:00
Kenneth D. Merry
a937ccdc09 Disable the 'devstat_end_transaction' busy count printf until after 3.0
release goes out the door.  We know there's a bug in the devstat
implementation in the wd driver, but bde and msmith haven't been able to
fix it yet.

So, disable the printf to avoid confusing/worrying people.

Suggested by:	msmith
1998-10-14 20:44:05 +00:00
Dmitrij Tejblum
f74d75a2b6 Backed out rev. 1.164. It caused problems on SMP.
PR:		8309
1998-10-14 15:05:52 +00:00
Peter Wemm
2a26e9ea83 Align to sizeof(long) rather than sizeof(int32_t). It needs to be
long because this code is shared with the alpha.  I hope the alpha can
read 32 bit ints at 32 bit alignment (vs. 64 bit alignment).
1998-10-14 05:07:23 +00:00
Peter Wemm
ca65d5c714 Load the full symbol tables if they are present. This means that ddb
and tracebacks have access to local symbols.  This is particularly
important for the Alpha.
1998-10-13 09:27:00 +00:00
David Greenman
6cde7a165f Fixed two potentially serious classes of bugs:
1) The vnode pager wasn't properly tracking the file size due to
   "size" being page rounded in some cases and not in others.
   This sometimes resulted in corrupted files. First noticed by
   Terry Lambert.
   Fixed by changing the "size" pager_alloc parameter to be a 64bit
   byte value (as opposed to a 32bit page index) and changing the
   pagers and their callers to deal with this properly.
2) Fixed a bogus type cast in round_page() and trunc_page() that
   caused some 64bit offsets and sizes to be scrambled. Removing
   the cast required adding casts at a few dozen callers.
   There may be problems with other bogus casts in close-by
   macros. A quick check seemed to indicate that those were okay,
   however.
1998-10-13 08:24:45 +00:00
Dmitrij Tejblum
9bbd8a2498 UnVMIO vnodes of block devices when they are no longer in use. (Some
things, like msdosfs, do not work (panic) on devices with VMIO enabled.
FFS enable VMIO on mounted devices, and nothing previously disabled it, so,
after you mounted FFS floppy, you could not mount msdosfs floppy anymore...)

This is mostly a quick before-release fix.

Reviewed by:	bde
1998-10-12 20:14:09 +00:00
Peter Wemm
2d636ab077 Only print kernel entry point during load.
Drastically quieten down the verbose load progress messages.  They were
more useful for debugging than anything, but are beyond a joke when loading
a few dozen modules.
Simplify the ELF extended symbol table load format.  Just take the main
symbol table and the string table that corresponds.  This is what we will
be getting local symbols from.  (needed for the alpha stack tracebacks).
Use the (optional) full symbol tables in lookups.  This means we have to
furhter distinguish between symbols that can come from the dynamic linking
table and the complete table.
The alpha boot code now needs to be adapted as ddb/db_elf.c cannot use
the simpler format.
I have not implemented loading the extended symbol tables from the syscall
interface yet, just for preloaded modules.
I am not sure about the symbol resolution.  I *think* it's possible that
a local symbol can be found in preference to a global, depending on the
search sequence and dependency tree.
1998-10-12 09:13:50 +00:00
Peter Wemm
2da2eeacee Relocate a few extra addresses that are stored as physical addresses via
the boot loader.
1998-10-12 09:03:48 +00:00
John Polstra
d1dbc69449 If an ELF executable has a recognized brand, then believe it.
Formerly, the heuristic involving the interpreter path took
precedence.

Also, print a better error message if the brand is missing or not
recognized.  If there is no brand at all, give the user a hint that
"brandelf" needs to be run.
1998-10-11 19:22:07 +00:00
KATO Takenori
7344a7bb2e mp_machdep.c: Set a vector to boot code (PC-98).
locore.s: Tell the bios to warmboot next time (PC-98).
1998-10-10 13:37:16 +00:00
KATO Takenori
ed68ba2cd0 PC-98 doesn't have CMOS ram. 1998-10-10 09:38:02 +00:00
Peter Wemm
26deceba9c Display module type as well as module name when we find one preloaded. 1998-10-10 02:29:07 +00:00
Peter Wemm
51f3fe7ab2 Use Mike Smith's linker module search path code.
Implement preloading in a fairly MI way, assuming the information is
prepared.
DDB interface helpers..  Provide some support for db_kld.c so that we
don't have to export too much detail.
Debugging and cosmetic nits left in from development..
The other half of the containing file hack so modules can associate
themselves with their "file".
1998-10-10 00:07:53 +00:00
Peter Wemm
f3b0d44290 Keep track of the containing file for modules. This is a bit of a hack,
but I can't think of another (relatively) easy way of getting the info
since the boot-time initialization is not done immediately after "loading".
XXX module_register() gained an extra arg.  This might break the alpha
compile, if so, just add a zero to get the old behavior.
1998-10-10 00:03:07 +00:00
Peter Wemm
e4f1a52f7a Updates for alignment rounding. XXX this is highly machine dependent and
should probably be moved to i386/i386/link_machdep.c (and the same for the
alpha).
Implement "deleting" a preloaded module by destroying it's tags. This is a
hack.  We cannot reuse the data, it's been destroyed by relocation,
statically initialized variables have been modified, etc.  Note that to
reclaim the load space is going to be more machine-dependent work.
Implement a relocate hook for machdep.c to call so that the physical
addresses get converted to the equivalent KVM addresses.
1998-10-09 23:59:01 +00:00
Peter Wemm
de78ca7e63 Fully implement KLD and preloading.
- seperate unload for preloaded linker objects.
- Don't build a kernel object if running as an a.out kernel.
- extract the real kernel name rather than hardwiring "kernel" for kldstat.
  (sysctl kern.bootfile getst the full name via bootinfo)
- use real addresses on the kernel "module" rather than fictitious ones.
- preloaded module support
- search module path for file modules.
- symbols are checked to see if they are in the right containing file
  before using their indexes into string tables.  This is to help ddb
  since it only supplies a pointer to an opaque symbol and there is no
  telling which file/object/module/whatever it came from.
1998-10-09 23:55:31 +00:00
Peter Wemm
adbb7dbee6 Updates for KLD backends.
- symbol_values checks that the symbol is indeed belonging to the
   correct symbol and string table pairs before looking up. (since there
   could be many pairs, and KLD/DDB need to find out).
 - different ops for files versus preload modules - the unload mechanism
   is different.  (a preloaded module has to be deleted on unload since
   the in-core image is tainted by relocation and variables used)
 - Do not build an a.out kernel module if we're running on an elf
   kernel. :-)  Note that it should theoretically be possible to
   mix a.out and elf KLD modules providing -mno-underscores was used
   to compile it, or some other symbol conversion takes place.
 - Support preload modules (even though /boot/loader doesn't yet)
 - Search the module path when loading files.
1998-10-09 23:49:28 +00:00
Peter Wemm
94e9d7c12d Implement merging SYSINIT's from preloaded KLD modules. This means we
check off SYSINIT entries as they are run, and when more arrive, we re-sort
and restart (skipping the already-run entries).
This can *only* be done after KMEM (and malloc) is up and running - this is
fine because KLD is the only consumer of this and it's done after that.
The nice thing about this is that the SYSINIT's within preloaded KLD modules
are executed in their natural order.  It should be possible to register
devices for the probes which follow, etc.  (soon.. several key things
prevent this, such as use of linker sets for things like pci devices).
1998-10-09 23:42:47 +00:00
Mike Smith
a8dad95401 Don't try to initialise the environment out of a sysinit, it's handled
in MD code instead.
1998-10-09 21:21:34 +00:00