Commit Graph

3359 Commits

Author SHA1 Message Date
Mitsuru IWASAKI
be14b8e7ea Improve stack manipulation code of ACPI wakeup routine.
The new code just override stack top value with saved return address
rather than pop/push operation.

Submitted by:	jhb
2002-08-07 12:48:28 +00:00
Warner Losh
6690540821 Add Intersil and Symbol as vendors for 802.11 cards that the wi driver
supports.

Obtained from: NetBSD
2002-08-07 05:40:34 +00:00
Peter Wemm
c679b309f1 Revert rev 1.356 and 1.352 (pmap_mapdev hacks). It wasn't worth the
pain.
2002-08-05 06:10:03 +00:00
Alan Cox
8365d52166 o Introduce pmap_page_is_mapped(). Its purpose is to obsolete
the PG_MAPPED flag.
2002-08-05 03:40:28 +00:00
Eric Anholt
2690c0bb32 Add device agp to GENERIC, filter it out of floppy builds
Approved by:	des (mentor)
2002-08-04 18:35:02 +00:00
Peter Wemm
3f3655b092 Fix a mistake in 1.352 - I was returning a pointer to the rounded down
address.  I expect this will fix acpica.
2002-08-04 18:11:38 +00:00
Warner Losh
35e58ed326 Remove commented out PCI_ENABLE_IO_MODES. It is gone now. 2002-08-04 18:06:15 +00:00
Alan Cox
ea5e5b13f8 o Request a wired page from vm_page_grab() in _pmap_allocpte(). 2002-08-04 04:55:31 +00:00
Alan Cox
b9c51c912e o Ask for a prezeroed page in pmap_pinit() for the page directory page. 2002-08-03 20:24:51 +00:00
Alan Cox
5da2d6a46d o Don't set PG_MAPPED on the page allocated and mapped in _pmap_allocpte().
(Only set this flag if the mapping has a corresponding pv list entry,
   which this mapping doesn't.)
2002-08-03 06:42:30 +00:00
Peter Wemm
8f1586dd65 Take advantage of the fact that there is a small 1MB direct mapped region
on x86 in between KERNBASE and the kernel load address.  pmap_mapdev()
can return pointers to this for devices operating in the isa "hole".
2002-08-03 01:02:37 +00:00
Peter Wemm
1af04fadd1 Take a shot at fixing a nasty bug in the pmap changes that I did. I
missed the pmap_kenter/kremove in this file, which leads to read()/write()
of /dev/mem using stale TLB entries. (gah!)  Fortunately, mmap of /dev/mem
wasn't affected, so it wasn't as bad as it could have been.  This throws
some light on the 'X server affects stability' thread....

Pointed out by:	bde
2002-08-03 00:59:15 +00:00
Poul-Henning Kamp
14a3a6ea0b Move a prototype to the least wrong place.
Suggested by:	bde
2002-08-02 18:45:43 +00:00
Alan Cox
64a1b85efa o Lock page queue accesses by vm_page_deactivate(). 2002-08-02 04:14:19 +00:00
Marc Fonvieille
c0727dcbfe Fix the link to the Handbook 2002-08-01 17:21:18 +00:00
Mitsuru IWASAKI
6a7ef08763 Fix a bug about stack manipulation at ACPI wakeup.
This should avoid kernel panic on kernel compiled w/o
NO_CPU_COPTFLAGS.

Suggested by:	optimized code by -mcpu=pentiumpro
2002-08-01 09:48:01 +00:00
Alan Cox
239b5b9707 o Setting PG_MAPPED and PG_WRITEABLE on pages that are mapped and unmapped
by pmap_qenter() and pmap_qremove() is pointless.  In fact, it probably
   leads to unnecessary pmap_page_protect() calls if one of these pages is
   paged out after unwiring.

Note: setting PG_MAPPED asserts that the page's pv list may be
non-empty.  Since checking the status of the page's pv list isn't any
harder than checking this flag, the flag should probably be eliminated.
Alternatively, PG_MAPPED could be set by pmap_enter() exclusively
rather than various places throughout the kernel.
2002-07-31 18:46:47 +00:00
Poul-Henning Kamp
ab4db9b74f The Elan SC520 MMCR is actually 16bit wide, so u_char is inconvenient. 2002-07-31 13:45:44 +00:00
Mitsuru IWASAKI
b69ed3f4c6 Resolve conflicts arising from the ACPI CA 20020725 import. 2002-07-30 19:35:32 +00:00
Alan Cox
bfd2867046 o Lock page queue accesses by pmap_release_free_page(). 2002-07-30 06:45:39 +00:00
Mike Barcroft
49545b3891 Create a new header <machine/_stdint.h> for storing MD parts of
<stdint.h>.  Previously, parts were defined in <machine/ansi.h> and
<machine/limits.h>.  This resulted in two problems:
  (1) Defining macros in <machine/ansi.h> gets in the way of that
      header only defining types.
  (2) Defining C99 limits in <machine/limits.h> adds pollution to
      <limits.h>.
2002-07-29 17:41:23 +00:00
Alan Cox
14f8ceaa07 o Pass VM_ALLOC_WIRED to vm_page_grab() rather than calling vm_page_wire()
in pmap_new_thread(), pmap_pinit(), and vm_proc_new().
 o Lock page queue accesses by vm_page_free() in pmap_object_init_pt().
2002-07-29 05:42:44 +00:00
Peter Wemm
23efa1f8ca Unwind the syscall_with_err_pushed tweak that jake did some time back.
OK'ed by:	jake
2002-07-28 00:27:51 +00:00
Julian Elischer
b6d5995e5f Add some locking asserts and some comments 2002-07-24 23:21:05 +00:00
Peter Wemm
b618108fff de-count pci 2002-07-23 06:38:47 +00:00
Peter Wemm
fc147d7fe9 Add explicit unit count on 'device pci' for ahc/ahd 2002-07-21 23:07:31 +00:00
Warner Losh
e300f53ca2 style(9)ize the whole file
Approved in concept a long time ago by: msmith
2002-07-21 05:35:42 +00:00
Peter Wemm
e344afe7c9 Move SWTCH_OPTIM_STATS related code out of cpufunc.h. (This sort of stat
gathering is not an x86 cpu feature)
2002-07-21 05:22:16 +00:00
Peter Wemm
db27052e18 Regenerate 2002-07-20 02:56:34 +00:00
Peter Wemm
3ebc124838 Infrastructure tweaks to allow having both an Elf32 and an Elf64 executable
handler in the kernel at the same time.  Also, allow for the
exec_new_vmspace() code to build a different sized vmspace depending on
the executable environment.  This is a big help for execing i386 binaries
on ia64.   The ELF exec code grows the ability to map partial pages when
there is a page size difference, eg: emulating 4K pages on 8K or 16K
hardware pages.

Flesh out the i386 emulation support for ia64.  At this point, the only
binary that I know of that fails is cvsup, because the cvsup runtime
tries to execute code in pages not marked executable.

Obtained from:  dfr (mostly, many tweaks from me).
2002-07-20 02:56:12 +00:00
Alan Cox
4aca0b1510 o Use vm_page_alloc(... | VM_ALLOC_WIRED) in place of vm_page_wire(). 2002-07-19 19:35:06 +00:00
Andrew Gallatin
f76ec8facd Add support for probing secondary buses on the ServerWorks Grand Champion
chipset used for P4-Xeon machines

PR: kern/38894
Tested-by: "Marc G. Fournier" <scrappy@hub.org>
Submitted-by: Mark Tinguely (partially)
2002-07-19 18:35:08 +00:00
Mark Murray
4c5aee92a7 Beautify. This has the side effect of improving portability and
making lint work cleaner.

Inspired to do this by:	jhb
2002-07-18 15:56:46 +00:00
Poul-Henning Kamp
61658cf6a1 Add initialization code for the AMD Elan sc520 which maps the MMCR
into KVM and sets the i8254 frequency to the correct value.
2002-07-18 12:56:54 +00:00
Poul-Henning Kamp
3ae87b7ec6 Add an entry for the AMD Elan SC520 hostbridge. I do not belive we can
identify this gadget on the CPUID result alone, so I intend to activate
the necessary magic (i8254 frequency for instance) for it based on the
precense of the on-chip host to PCI bridge.
2002-07-18 10:57:20 +00:00
Peter Wemm
a9aa1a970f Use pmap_kenter() rather than vtopte() and bashing the page tables
directly.
2002-07-18 00:42:53 +00:00
Peter Wemm
d08c48b48a Avoid trying to set PG_G on the first 4MB when we set up the 4MB page.
This solves the SMP panic for at least one system.  I'd still like to know
why my xeon works though.

Tested by: bmilekic
2002-07-17 21:47:05 +00:00
Mark Murray
8306a37bbb Clean up the syntax WRT semicolons at the end of function-like-macros, and protect GCCisms from non-GNU compilers and lint. 2002-07-17 16:19:37 +00:00
Matthew Dillon
d4616eacb1 Qualify comment on machdep.cpu_idle_hlt. Turning this on on a SMP
machine will result in approximately a 4.2% loss of performance (buildworld)
and approximately a 5% reduction in power consumption (when idle).  Add XXX
note on how to really make hlt work (send an IPI to wakeup HLTed cpus on
a thread-schedule event?  Generate an interrupt somehow?).
2002-07-17 05:41:43 +00:00
John Baldwin
dde0429505 Various comment and minor style fixes. No actual content changes.
Inspired by:	bde
2002-07-16 18:20:17 +00:00
Mark Murray
e9b24da3d5 Retire the perl gethints.conf in favour of an awk version. Move
the awk version to a central place for maintenance.

Submitted by:	Cyrille Lefevre <cyrille.lefevre@laposte.net>
2002-07-16 09:28:25 +00:00
Peter Wemm
239d85c5ad The pmap_invalidate_all() here is definately not a good idea. We are
running with interrupts disabled, other cpus locked down, and only
making a temporary local mapping that we immediately back out again.

Tested by:	gallatin
2002-07-15 23:11:49 +00:00
John Baldwin
557c19bff3 makeLINT.send has been moved to sys/conf so we can build LINT on other
architectures besides i386.
2002-07-15 17:48:47 +00:00
Mark Murray
80a0ead4fe Wrap GNU specific code in ifdefs, and help lint out by providing
some alternative definitions.
2002-07-15 13:29:40 +00:00
Mark Murray
7e622d3c84 Cast to prevent "signed/unsigned comparison" warnings. 2002-07-15 13:27:43 +00:00
Mark Murray
bbcfaa6aa0 Warnings and lint-assisting fixes; mark unused function parameters as
unused; wrap GNUisms (asm code) in appropriate #ifdefs.
2002-07-15 13:25:15 +00:00
Alan Cox
700399bc41 o Lock page queue accesses by vm_page_wire(). 2002-07-14 20:24:40 +00:00
Bruce Evans
3c9d896571 Quick fix for high resolution kernel profiling on i386's. Use
-finstrument-functions instead of -mprofiler-epilogue.  The former
works essentially the same as the latter but has a higher overhead
(about 22 more bytes per function for passing unused args to the
profiling functions).

Removed all traces of the IDENT Makefile variable, which had been
reduced to just a place for holding profiling's contribution to CFLAGS
(the IDENT that gives the kernel identity was renamed to KERN_IDENT).
2002-07-13 22:28:34 +00:00
Peter Wemm
5c5e3622e6 Two invlpg's slipped through that were not protected from I386_CPU
Pointed out by:	dillon
2002-07-13 21:55:11 +00:00
Peter Wemm
96fd5002b4 invlpg() does not work too well on i386 cpus. Add token i386 support
back in to the pmap_zero_page* stuff.
2002-07-13 21:03:08 +00:00
Peter Wemm
006490441d Do global shootdowns when switching to/from 4MB pages. I believe we can
do a shootdown on a 4MB "page" though, but this should be safer for now.

Noticed by:  tegge
2002-07-13 20:58:56 +00:00
Peter Wemm
a7b1f16c86 Bandaid for SMP. Changing APTDpde without a global shootdown is not
safe yet.  We used to do a global shootdown here anyway so another day
or so shouldn't hurt.
2002-07-13 20:56:18 +00:00
Alan Cox
753492f404 o Lock some page queue accesses, in particular, those by vm_page_unwire(). 2002-07-13 19:48:54 +00:00
Jonathan Mini
08b38412c8 Add additional cred_free_thread() calls that I had missed the first time.
Pointed out by:	jhb
2002-07-13 04:36:50 +00:00
Matthew Dillon
fbcf77c2ea Re-enable the idle page-zeroing code. Remove all IPIs from the idle
page-zeroing code as well as from the general page-zeroing code and use a
lazy tlb page invalidation scheme based on a callback made at the end
of mi_switch.

A number of people came up with this idea at the same time so credit
belongs to Peter, John, and Jake as well.

Two-way SMP buildworld -j 5 tests (second run, after stabilization)
    2282.76 real  2515.17 user  704.22 sys	before peter's IPI commit
    2266.69 real  2467.50 user  633.77 sys	after peter's commit
    2232.80 real  2468.99 user  615.89 sys	after this commit

Reviewed by:	peter, jhb
Approved by:	peter
2002-07-12 20:17:06 +00:00
John Baldwin
33d7ad1abe Set the thread state of the newly chosen to run thread to TDS_RUNNING in
choosethread() in MI C code instead of doing it in in assembly in all the
various cpu_switch() functions.  This fixes problems on ia64 and sparc64.

Reviewed by:	julian, peter, benno
Tested on:	i386, alpha, sparc64
2002-07-12 18:34:22 +00:00
Peter Wemm
f1b665c8fe Revive backed out pmap related changes from Feb 2002. The highlights are:
- It actually works this time, honest!
- Fine grained TLB shootdowns for SMP on i386.  IPI's are very expensive,
  so try and optimize things where possible.
- Introduce ranged shootdowns that can be done as a single IPI.
- PG_G support for i386
- Specific-cpu targeted shootdowns.  For example, there is no sense in
  globally purging the TLB cache for where we are stealing a page from
  the local unshared process on the local cpu.  Use pm_active to track
  this.
- Add some instrumentation for the tlb shootdown code.
- Rip out SMP code from <machine/cpufunc.h>
- Try and fix some very bogus PG_G and PG_PS interactions that were bad
  enough to cause vm86 bios calls to break.  vm86 depended on our existing
  bugs and this was the cause of the VESA panics last time.
- Fix the silly one-line error that caused the 'panic: bad pte' last time.
- Fix a couple of other silly one-line errors that should have caused more
  pain than they did.

Some more work is needed:
- pmap_{zero,copy}_page[_idle].  These can be done without IPI's if we
  have a hook in cpu_switch.
- The IPI handlers need some cleanup.  I have a bogus %ds load that can
  be avoided.
- APTD handling is rather bogus and appears to be a large source of
  global TLB IPI shootdowns for no really good reason.

I see speedups of between 1.5% and ~4% on buildworlds in a while 1 loop.
I expect to see a bigger difference when there is significant pageout
activity or the system otherwise has memory shortages.

I have backed out a few optimizations that I had been using over the last
few days in order to be a little more conservative.  I'll revisit these
again over the next few days as the dust settles.

New option:  DISABLE_PG_G - In case I missed something.
2002-07-12 07:56:11 +00:00
Alfred Perlstein
074453c230 Introduce syscall.master option 'COMPAT4' which allows one to wrap
syscalls for FreeBSD 4 compatibility.
Add kernel option COMPAT_FREEBSD4 to enable these syscalls.
2002-07-12 06:38:34 +00:00
Peter Wemm
4a0226c633 Unexpand a couple of 8-space indents that I added in rev 1.285. 2002-07-12 04:58:51 +00:00
Peter Wemm
da035a22eb Bah, move the invltlb counter to C code and hook a debug sysctl onto it. 2002-07-11 08:31:10 +00:00
Peter Wemm
dedf64505a s/NCPU/MAXCPU/ to try and get this to compile. 2002-07-11 08:24:33 +00:00
Julian Elischer
83587634ec fix a comment and note a problem with XXXSMP 2002-07-10 21:17:23 +00:00
Matthew Dillon
50b6a55512 Remove the critmode sysctl - the new method for critical_enter/exit (already
the default) is now the only method for i386.

Remove the paraphanalia that supported critmode.  Remove td_critnest, clean
up the assembly, and clean up (mostly remove) the old junk from
cpu_critical_enter() and cpu_critical_exit().
2002-07-10 20:15:58 +00:00
David E. O'Brien
b8e7c5a8e1 Consistently line-up /**/ comments so they don't cause line wrappage. 2002-07-10 19:36:04 +00:00
Julian Elischer
f55348f07c Include all of isa/ipl.s into exception.s as there is now nothing left in
ipl.s except doreti which really belongs in with the exceptions as it's
just the other side of the same coin. Will remove ipl.s in a separate commit.

Agreed by: several including bde@freebsd.org
2002-07-10 02:24:44 +00:00
Mark Murray
8d03e1e931 Comment out apm; ACPI is the modern replacement, and folks who really
need it can uncomment it. This may buy us some kernel space.

Discussed with:	imp & msmith (quite a while ago)
2002-07-08 11:56:44 +00:00
Peter Wemm
9ecb46bf87 The clock is already allocated as 'fast' - no need to try and intercept a
'slow' interrupt registration and convert it into 'fast'.
2002-07-08 09:12:22 +00:00
Peter Wemm
fcdc053233 Cosmetic. Remove #if 0 definition of vtophys() - it predates 4MB pages.
Remove avtophys(), it isn't referenced anywhere.
2002-07-08 08:14:28 +00:00
Peter Wemm
a58b3a6878 Add a special page zero entry point intended to be called via the single
threaded VM pagezero kthread outside of Giant.  For some platforms, this
is really easy since it can just use the direct mapped region.  For others,
IPI sending is involved or there are other issues, so grab Giant when
needed.

We still have preemption issues to deal with, but Alan Cox has an
interesting suggestion on how to minimize the problem on x86.

Use Luigi's hack for preserving the (lack of) priority.

Turn the idle zeroing back on since it can now actually do something useful
outside of Giant in many cases.
2002-07-08 04:24:26 +00:00
Peter Wemm
19981bcd54 s/procrunnable/kserunnable/ in a comment 2002-07-08 01:52:55 +00:00
Peter Wemm
64ca701084 Fix a hideous TLB bug. pmap_unmapdev neglected to remove the device
mappings from the page tables, which were mapped with PG_G!  We could
reuse the page table entry for another mapping (pmap_mapdev) but it
would never have cleared any remaining PG_G TLB entries.
2002-07-08 00:17:43 +00:00
Peter Wemm
a136efe9b6 Collect all the (now equivalent) pmap_new_proc/pmap_dispose_proc/
pmap_swapin_proc/pmap_swapout_proc functions from the MD pmap code
and use a single equivalent MI version.  There are other cleanups
needed still.

While here, use the UMA zone hooks to keep a cache of preinitialized
proc structures handy, just like the thread system does.  This eliminates
one dependency on 'struct proc' being persistent even after being freed.
There are some comments about things that can be factored out into
ctor/dtor functions if it is worth it.  For now they are mostly just
doing statistics to get a feel of how it is working.
2002-07-07 23:05:27 +00:00
Warner Losh
22c0046f53 Make NEWCARD the default pccard/cardbus system. 2002-07-07 19:00:00 +00:00
Maxime Henrion
44c9e34eda One #include <sys/lock.h> is enough.
Submitted by:	Olivier Houchard <cognet@ci0.org>
2002-07-07 18:05:42 +00:00
David E. O'Brien
ce03184300 Make space for compilations. 2002-07-06 02:49:07 +00:00
Peter Wemm
3a7ef7918c Diff reduction (microoptimization) with another WIP. Move the frame
calculation in get_ptbase() to a little later on.
2002-07-04 19:53:24 +00:00
Julian Elischer
8692e184dc Don't free pages we never allocated..
My eyes openned by: Matt
2002-07-04 00:35:48 +00:00
Julian Elischer
0d6735c628 Slight restatement of the code and remove some unused variables. 2002-07-04 00:04:06 +00:00
Julian Elischer
e04d8bf890 Add comments and slightly rearrange the thread stack assignment code
to try make it less obscure.
2002-07-03 20:47:50 +00:00
Julian Elischer
b2adb4b2c3 Remove vestiges of old code...
These functions are always called on new memory so they can
not already be set up, so don't bother testing for that.
(This was left over from before we used UMA (which is cool))
2002-07-03 20:06:38 +00:00
Mitsuru IWASAKI
74fc979a09 Resolve conflicts arising from the ACPI CA 20020404 import. 2002-06-30 17:53:12 +00:00
David E. O'Brien
ea9ea04c0d This is the start of the FreeBSD/x86_64 kernel. 2002-06-30 08:57:17 +00:00
David E. O'Brien
176d0ec15d This is the start of the FreeBSD/x86_64 kernel. 2002-06-30 07:42:36 +00:00
David E. O'Brien
eca69d62e7 Gcc 3.1 varargs support. 2002-06-30 07:22:30 +00:00
Mike Barcroft
a19d429398 Since printf(3) now supports the `j' conversion specifier, use that
when printing intmax_t and uintmax_t.

Forgotten by:	mike
Noticed by:	bde
2002-06-30 05:48:03 +00:00
Robert Watson
006f19e4f2 Remove ALT_BREAK_TO_DEBUGGER. This was inconsistent (both in form
and function) with existing configuration choices.  Arguably if
ALT_BREAK_TO_DEBUGGER was present, so should have been
BREAK_TO_DEBUGGER.  Regardless, it broke the option sort order in
these kernel configuration files.

Requested by:	bde
2002-06-30 04:12:21 +00:00
Julian Elischer
8540497c50 Fix reverse ordering of locks. add a comment about locks on some platforms.
Submitted by:	jhb@freebsd.org
2002-06-29 23:58:50 +00:00
Julian Elischer
e602ba25fd Part 1 of KSE-III
The ability to schedule multiple threads per process
(one one cpu) by making ALL system calls optionally asynchronous.
to come: ia64 and power-pc patches, patches for gdb, test program (in tools)

Reviewed by:	Almost everyone who counts
	(at various times, peter, jhb, matt, alfred, mini, bernd,
	and a cast of thousands)

	NOTE: this is still Beta code, and contains lots of debugging stuff.
	expect slight instability in signals..
2002-06-29 17:26:22 +00:00
Julian Elischer
44990b8cb8 Add files that are new for KSE. 2002-06-29 07:04:59 +00:00
Peter Wemm
160554fbf4 Remove a couple of __P() stragglers. 2002-06-29 02:32:34 +00:00
Andrew R. Reiter
c6d84b4d4b Fix for the problem stated below by Tor Egge:
(from: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=832566+0+ \
       current/freebsd-current)

  "Too many pages were prefaulted in pmap_object_init_pt, thus
   the wrong physical page was entered in the pmap for the virtual
   address where the .dynamic section was supposed to be."

Submitted by:	tegge
Approved by:	tegge's patches never fail
2002-06-27 06:34:03 +00:00
Ian Dowse
23f09d50bb Avoid using the 64-bit vm_pindex_t in a few places where 64-bit
types are not required, as the overhead is unnecessary:

 o In the i386 pmap_protect(), `sindex' and `eindex' represent page
   indices within the 32-bit virtual address space.
 o In swp_pager_meta_build() and swp_pager_meta_ctl(), use a temporary
   variable to store the low few bits of a vm_pindex_t that gets used
   as an array index.
 o vm_uiomove() uses `osize' and `idx' for page offsets within a
   map entry.
 o In vm_object_split(), `idx' is a page offset within a map entry.
2002-06-26 20:32:51 +00:00
Ian Dowse
6395da5437 Complete the initial set of VM changes required to support full
64-bit file sizes. This step simply addresses the remaining overflows,
and does attempt to optimise performance. The details are:

 o Use a 64-bit type for the vm_object `size' and the size argument
   to vm_object_allocate().
 o Use the correct type for index variables in dev_pager_getpages(),
   vm_object_page_clean() and vm_object_page_remove().
 o Avoid an overflow in the i386 pmap_object_init_pt().
2002-06-25 22:14:06 +00:00
Peter Wemm
417a86bac7 Compile in the cpu halt code even on SMP, instead just default the
sysctl (machdep.cpu_idle_hlt) to off in the SMP case.  This allows you to
turn it on if you wish and do not particularly care about the small window
where a cpu will remain halted even when a job is placed on the run queue
(until the next clock tick).
2002-06-24 21:31:57 +00:00
Jake Burkholder
8ba3d077ff Add an MD callout like cpu_exit, but which is called after sched_lock is
obtained, when all other scheduling activity is suspended.  This is needed
on sparc64 to deactivate the vmspace of the exiting process on all cpus.
Otherwise if another unrelated process gets the exact same vmspace structure
allocated to it (same address), its address space will not be activated
properly.  This seems to fix some spontaneous signal 11 problems with smp
on sparc64.
2002-06-24 15:48:02 +00:00
Jonathan Mini
00676596e3 userout -> out. These two labels are now identical.
Approved by:	alfred
2002-06-24 06:23:41 +00:00
Jonathan Mini
01ad8a53db Remove unused diagnostic function cread_free_thread().
Approved by:	alfred
2002-06-24 06:22:00 +00:00
Mark Peek
73cb22707a Add additional cpuid feature flags and put into a canonical format.
MFC after:	1 week
2002-06-22 23:00:33 +00:00
Juli Mallett
e0cf55e42a Use rm -f in the clean target, as seems to be common practice, and also avoids
errors if no LINT exists.

Submitted by:	dwcjr
2002-06-22 18:16:24 +00:00
Mark Peek
5e3939b59b Clock frequencies reported by sysctl should be unsigned values. Discovered
when machdep.tsc_freq returned a negative number on a 2.2GHz Xeon.

Submitted by:	Brian Harrison <bharrison@ironport.com>
Reviewed by:	phk
MFC after:	1 week
2002-06-22 16:30:18 +00:00
Kirk McKusick
1c85e6a35d This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.

Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.

Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).

Sponsored by: DARPA & NAI Labs.
Reviewed by:	Poul-Henning Kamp <phk@freebsd.org>
2002-06-21 06:18:05 +00:00
Peter Wemm
b23619e02a Deorbit suibyte(). It was only used for split address space systems
for supporting UIO_USERISPACE (ie: it wasn't used).
2002-06-20 07:13:35 +00:00
Peter Wemm
2f9267ec23 Move the "- 1" into the RQB_FFS(mask) macro itself so that
implementations can provide a base zero ffs function if they wish.
This changes
  #define RQB_FFS(mask) (ffs64(mask))
  foo = RQB_FFS(mask) - 1;
to
  #define RQB_FFS(mask) (ffs64(mask) - 1)
  foo = RQB_FFS(mask);
On some platforms we can get the "- 1" for free, eg: those that use the
C code for ffs64().

Reviewed by:	jake (in principle)
2002-06-20 06:21:20 +00:00
Jeff Roberson
18aa2de5a7 - Introduce the new M_NOVM option which tells uma to only check the currently
allocated slabs and bucket caches for free items.  It will not go ask the vm
  for pages.  This differs from M_NOWAIT in that it not only doesn't block, it
  doesn't even ask.

- Add a new zcreate option ZONE_VM, that sets the BUCKETCACHE zflag.  This
  tells uma that it should only allocate buckets out of the bucket cache, and
  not from the VM.  It does this by using the M_NOVM option to zalloc when
  getting a new bucket.  This is so that the VM doesn't recursively enter
  itself while trying to allocate buckets for vm_map_entry zones.  If there
  are already allocated buckets when we get here we'll still use them but
  otherwise we'll skip it.

- Use the ZONE_VM flag on vm map entries and pv entries on x86.
2002-06-17 22:02:41 +00:00
Bruce Evans
98bcdec469 If trap() is called when ddb is active, then go directly to trap_fatal();
do not blunder around enabling interrupts and running trap handlers.
trap_pfault() will normally pass control to ddb's fault handler which
will normally do the right thing.

This bug is very old. but in old versions of FreeBSD it is probably only
serious for trap handling that involves sleeping.  In -current, attempting
to examine unmapped memory while stopped at a breakpoint at mi_switch()
was always fatal.
2002-06-12 13:30:52 +00:00
John Baldwin
99cca534f3 - Fixup / remove obsolete comments.
- ktrace no longer requires Giant so do ktrace syscall events before and
  after acquiring and releasing Giant, respectively.
- For i386, ia32 syscalls on ia64, powerpc, and sparc64, get rid of the
  goto bad hack and instead use the model on ia64 and alpha were we
  skip the actual syscall invocation if error != 0.  This fixes a bug
  where if we the copyin() of the arguments failed for a syscall that
  was not marked MP safe, we would try to release Giant when we had
  not acquired it.
2002-06-07 05:47:35 +00:00
Justin T. Gibbs
cdd49e97b4 Hook up the ahd driver. 2002-06-06 16:35:58 +00:00
Alfred Perlstein
50225e2f48 Silence preprocessor warning, No need to use CONCAT with "," and "word". 2002-06-01 20:22:33 +00:00
Bruce Evans
136956ed12 Fixed the return value of fpsetmask(). The API requires inversion of the
mask on both input and output to fpsetmask(), but this was only done for
input, so fpsetmask() returned the complement of the old mask (ANDed with
the mask bitfield).

PR:		38170
MFC after:	4 weeks
2002-06-01 17:39:46 +00:00
Bruce Evans
511dab6218 Fixed style bugs in rev.1.9. 2002-06-01 17:27:16 +00:00
Warner Losh
8ce1ab3a24 Use a common function to map the bogus intlines.
Don't require pin be non-zero before we map bogus intlines, always do it.
This fixes a number of problems on HP Omnibook computers.

Tested/Reviewed by: Brooks Davis
2002-06-01 05:14:11 +00:00
Doug Rabson
99bd783419 Move the definition of ElfN_Hashelt to common headers. The only platform
which has a different definition for this is alpha.
2002-05-30 08:32:18 +00:00
David E. O'Brien
69d18565e0 Do not refer to the Intel PRO/1000 by its internal name.
Requested by:	pdeuskar
2002-05-29 18:42:26 +00:00
Brooks Davis
26722a1909 Restore the irq=0 => irq=255 hack to pci_cfgintr_search(). Just having
it in pci_cfgregread() wasn't sufficent on at least the HP Omnibook 500.

Reviewed by:	imp
2002-05-29 16:16:16 +00:00
Doug Rabson
396a429cfd Add declarations of suword32 and suword64. Add implementations of one or
the other (or both) to all the platforms. Similar for fuword32 and
fuword64.
2002-05-26 16:03:13 +00:00
Jake Burkholder
d2ac231616 Make the run queue parameters machine dependent. Optimize 64 bit
architectures by using a 64 bit word for the bit array which keeps
track of non-empty queues.

Reviewed by:	peter
2002-05-25 01:12:23 +00:00
John Baldwin
6b8c698908 Rename pause() to ia32_pause() so it doesn't conflict with the pause()
function defined in <unistd.h>.  I didn't #ifdef _KERNEL it because the
mutex implementation in libpthread will probably need this.
2002-05-22 20:32:39 +00:00
David E. O'Brien
540e5c2eaf Restore us back to the rev 1.324 level of having an Intel gigE driver. 2002-05-22 19:00:48 +00:00
John Baldwin
07508f90b6 Debug registers aren't selectors, so use saner names for the variables in
the inline functions for reading and writing the debug registers.
2002-05-22 13:29:18 +00:00
John Baldwin
2be69f326a - Sort the pause() inline into the appropriate location.
- Add many missing prototypes to the non-GCC section.
2002-05-22 13:27:05 +00:00
John Baldwin
0228ea4e0b Rename cpu_pause() to pause(). Originally I was going to make this an
MI API with empty cpu_pause() functions on other arch's, but this
functionality is definitely unique to IA-32, so I decided to leave it
as i386-only and wrap it in #ifdef's.  I should have dropped the cpu_
prefix when I made that decision.

Requested by:	bde
2002-05-22 13:19:22 +00:00
Robert Watson
ddbbc9628d Permit alternative break sequence to break to debugger in GENERIC. Breakage
of serial break on -CURRENT seems rampant for some reason, and I like
being able to get into ddb.

Reviewed by:	peter
2002-05-21 23:35:51 +00:00
John Baldwin
bb0d293f15 Add an inline function cpu_pause() for the IA32 'pause' instruction. 2002-05-21 20:21:53 +00:00
Peter Wemm
b2604e1cf1 Make this compile with gcc-3.1, which objects to the multi-line string. 2002-05-19 06:42:29 +00:00
Bruce Evans
74f168bf7a Fixed a semantic error. va_arg(ap, u_short) is nonsense except on i386's
with 16-bit ints, since u_short is promoted when it is passed to a
varargs function.  gcc now warns about this.  We always pass small
integers (this is well obuscated), so there are no conversion problems.

Fixed a related style bug (bogus cast).
2002-05-13 14:34:47 +00:00
Bruce Evans
f5d3fceede Fixed a syntax error (a label not followed by a statement). 2002-05-13 11:53:40 +00:00
David E. O'Brien
fc336fdfbb Gcc 3.1 varargs support. 2002-05-10 02:02:54 +00:00
Bill Fenner
7bf744074d Restore the ability interrupt dumps on i386, based on
the old kern_shutdown.c .  Other archs might be able to
use similar code but I don't have anything to test on.
2002-05-04 17:45:48 +00:00
Juli Mallett
ea0b7a7699 Typo fix: detects -> detect.
Reviewed by:	phk
2002-05-03 17:59:25 +00:00
Dag-Erling Smørgrav
cff135d87c Join the pissing contest: generate LINT with a single sed(1) command.
Smaller script, smaller (though equivalent) output.
2002-05-02 16:34:47 +00:00
Jun Kuriyama
23dc40e1dd Use shell script version (using awk and sed) of makeLINT.pl. 2002-05-02 06:10:09 +00:00
Poul-Henning Kamp
2266fe776e Don't export timecounter structures under debug. with sysctl, they
contain no truly interesting data anymore.
2002-04-30 19:34:31 +00:00
Peter Wemm
db17c6fc07 Tidy up some loose ends.
i386/ia64/alpha - catch up to sparc64/ppc:
- replace pmap_kernel() with refs to kernel_pmap
- change kernel_pmap pointer to (&kernel_pmap_store)
  (this is a speedup since ld can set these at compile/link time)
all platforms (as suggested by jake):
- gc unused pmap_reference
- gc unused pmap_destroy
- gc unused struct pmap.pm_count
(we never used pm_count - we track address space sharing at the vmspace)
2002-04-29 07:43:16 +00:00
Alan Cox
c01945726b For what it's worth, fix the compilation of an I386_CPU-only kernel
now that certain warnings are fatal.
2002-04-27 18:13:35 +00:00
Alan Cox
ce6612b6b6 Don't call vm_map_growstack() from trapwrite() as vm_fault() now performs
this automatically.
2002-04-27 17:07:15 +00:00
Scott Long
fe3cb0e1ec Add a CAM interface to the aac driver. This is useful in case you should
ever connect a SCSI Cdrom/Tape/Jukebox/Scanner/Printer/kitty-litter-scooper
to your high-end RAID controller.  The interface to the arrays is still
via the block interface; this merely provides a way to circumvent the
RAID functionality and access the SCSI buses directly.  Note that for
somewhat obvious reasons, hard drives are not exposed to the da driver
through this interface, though you can still talk to them via the pass
driver.  Be the first on your block to low-level format unsuspecting
drives that are part of an array!

To enable this, add the 'aacp' device to your kernel config.

MFC after:	3 days
2002-04-27 01:31:17 +00:00
Poul-Henning Kamp
7e2d76ff05 Remove the tc_update() function. Any frequency change to the
timecounter will be used starting at the next second, which is
good enough for sysctl purposes.  If better adjustment is needed
the NTP PLL should be used.
2002-04-26 10:06:26 +00:00
Marcel Moolenaar
d297ad160e Don't use the symbol name to lookup the symbol value when we can use
the symbol index defined by the relocation. The elf_lookup() support
function is to be used by elf_reloc() when symbol lookups need to be
done. The elf_lookup() function operates on the symbol index and
will do a symbol name based lookup when such is required, otherwise
it uses the symbol index directly. This solves the problem seen on
ia64 where the symbol hash table does not contain local symbols and
a symbol name based lookup would fail for those symbols.

Don't pass the symbol name to elf_reloc(), as it isn't used any more.
2002-04-25 01:22:16 +00:00
Warner Losh
d5ccecfad7 o Work around bugs in the powerof2 macro: It thinks that 0 is a power of
2, but that's not the case.  This fixes the case where there were slots
  in the PIR table that had no bits set, but we assumed they did and used
  strange results as a result.
o Map invalid INTLINE registers to 255 in pci_cfgreg.c.  This should allow
  us to remove the bogus checks in MI code for non-255 values.

I put these changes out for review a while ago, but no one responded
to them, so into current they go.

This should help us work better on machines that don't route
interrupts in the traditional way.

MFC After: 4286 millifortnights
2002-04-24 15:30:11 +00:00
Warner Losh
e5d7e9c76c Fix a PNPID in a comment
Submitted by: David Xu
2002-04-24 15:22:53 +00:00
Poul-Henning Kamp
3c9f58204e Don't free(9) a pointer which has been modified.
Chapeau de pointe:	mux
2002-04-23 18:52:39 +00:00
Mark Murray
db8f2e326c Stylify (mainly line up macro EOL-continuation \'s), and add a dummy
alternative for lint.
2002-04-21 10:49:00 +00:00
Alfred Perlstein
74d618ca43 Clean up:
Comment run_filter() to explain what it does.

Remove chatty comments.

void busdma_swi() { }  -> void busdma_swi(void) { }
2002-04-19 22:58:09 +00:00
Robert Watson
91e007dc70 Since WITNESS doesn't just do mutexes, remove "mutex" from the WITNESS
comment in GENERIC config files of appropriate platforms.  For whatever
reason, powerpc didn't use WITNESS in GENERIC.
2002-04-18 03:44:44 +00:00
Alan Cox
6139043b1f o Call vm_map_growstack() from vm_fault() if vm_map_lookup() has failed
due to conditions that suggest the possible need for stack growth.
   This has two beneficial effects: (1) we can
   now remove calls to vm_map_growstack() from the MD trap handlers and (2)
   simple page faults are faster because we no longer unnecessarily perform
   vm_map_growstack() on every page fault.
 o Remove vm_map_growstack() from the i386's trap_pfault().
 o Remove the acquisition and release of Giant from i386's trap_pfault().
   (vm_fault() still acquires it.)
2002-04-18 03:28:27 +00:00
Tor Egge
de8218bb7b Fix typo in adjusted panic message.
Submitted by:	cokane
2002-04-17 22:41:58 +00:00
Tor Egge
50c15af4da Update io_apic_ints array properly when revoking an irq mapping.
Adjust panic message.

Submitted by:	David Xu <bsddiy@yahoo.com>
2002-04-17 18:27:10 +00:00
Maxime Henrion
d786139c76 Rework the kernel environment subsystem. We now convert the static
environment needed at boot time to a dynamic subsystem when VM is
up.  The dynamic kernel environment is protected by an sx lock.

This adds some new functions to manipulate the kernel environment :
freeenv(), setenv(), unsetenv() and testenv().  freeenv() has to be
called after every getenv() when you have finished using the string.
testenv() only tests if an environment variable is present, and
doesn't require a freeenv() call. setenv() and unsetenv() are self
explanatory.

The kenv(2) syscall exports these new functionalities to userland,
mainly for kenv(1).

Reviewed by:	peter
2002-04-17 13:06:36 +00:00
Peter Wemm
1a87a0da66 Pass vm_page_t instead of physical addresses to pmap_zero_page[_area]()
and pmap_copy_page().  This gets rid of a couple more physical addresses
in upper layers, with the eventual aim of supporting PAE and dealing with
the physical addressing mostly within pmap.  (We will need either 64 bit
physical addresses or page indexes, possibly both depending on the
circumstances.  Leaving this to pmap itself gives more flexibilitly.)

Reviewed by:	jake
Tested on:	i386, ia64 and (I believe) sparc64. (my alpha was hosed)
2002-04-15 16:00:03 +00:00
David Malone
7376ec0dd7 Make the MTRR code a bit more defensive - this should help people
trying to run X on some Athlon systems where the BIOS does odd things
(mines an ASUS A7A266, but it seems to also help on other systems).

Here's a description of the problem and my fix:

	The problem with the old MTRR code is that it only expects
	to find documented values in the bytes of MTRR registers.
	To convert the MTRR byte into a FreeBSD "Memory Range Type"
	(mrt) it uses the byte value and looks it up in an array.
	If the value is not in range then the mrt value ends up
	containing random junk.

	This isn't an immediate problem. The mrt value is only used
	later when rewriting the MTRR registers. When we finally
	go to write a value back again, the function i686_mtrrtype()
	searches for the junk value and returns -1 when it fails
	to find it. This is converted to a byte (0xff) and written
	back to the register, causing a GPF as 0xff is an illegal
	value for a MTRR byte.

	To work around this problem I've added a new mrt flag
	MDF_UNKNOWN.  We set this when we read a MTRR byte which
	we do not understand.  If we try to convert a MDF_UNKNOWN
	back into a MTRR value, then the new function, i686_mrt2mtrr,
	just returns the old value of the MTRR byte. This leaves
	the memory range type unchanged.

I'd like to merge this before the 4.6 code freeze, so if people
can test this with XFree 4 that would be very useful.

PR:		28418, 25958
Tested by:	jkh, Christopher Masto <chris@netmonger.net>
MFC after:	2 weeks
2002-04-14 20:13:08 +00:00
David Malone
a983fdfe4c Move do_cpuid into the correct place in this file and make
the indentation more like the other multi-line assembley in
this file.

Someone who understands gcc constraints could update the
constraints for do_cpuid.
2002-04-10 21:18:46 +00:00
Alan Cox
eac84263c4 o In osigreturn(), restore all of the registers in one place.
o Recent changes to osigreturn() and sigreturn() have made them MPSAFE.  Add
   a comment to this effect.

Submitted by:	bde (bullet #1)
Reviewed by:	jhb (bullet #2)
2002-04-10 20:08:07 +00:00
Doug Rabson
5eb29d9b90 Initial support for executing IA-32 binaries. This will not compile
without a few patches for the rest of the kernel to allow the image
activator to override exec_copyout_strings and setregs.

None of the syscall argument translation has been done. Possibly, this
translation layer can be shared with any platform that wants to support
running ILP32 binaries on an LP64 host (e.g. sparc32 binaries?)
2002-04-10 19:34:51 +00:00
Poul-Henning Kamp
2ce7d7a033 GC various bits and pieces of USERCONFIG from all over the place. 2002-04-09 11:18:46 +00:00
Bruce Evans
32893f634b Removed ispc98 sysctl completely. Applications should understand that
ispc98 isn't set if its sysctl doesn't exist.  At least make(1) already
understands this.

Approved by:	nyan
2002-04-08 10:34:57 +00:00
Poul-Henning Kamp
67ec58a802 GC the "dumplo" variable, which is no longer used.
A lot of sys/*/*/machdep.c seems not to be.
2002-04-07 21:01:37 +00:00
Yoshihiro Takahashi
181593adec Move ICU_* defines into icu.h. 2002-04-06 08:25:05 +00:00
Yoshihiro Takahashi
78ee686247 Remove pc98 code. 2002-04-06 08:22:33 +00:00
Matthew Dillon
80f5c8bf42 Embed a struct vmmeter in the per-cpu structure and add a macro,
PCPU_LAZY_INC() which increments elements in it for cases where we
can afford the occassional inaccuracy.  Use of per-cpu stats counters
avoids significant cache stalls in various critical paths that would
otherwise severely limit our cpu scaleability.

Adjust all sysctl's accessing cnt.* elements to now use a procedure
which aggregates the requested field for all cpus and for the global
vmmeter.

The global vmmeter is retained, since some stats counters, like v_free_min,
cannot be made per-cpu.  Also, this allows us to convert counters from
the global vmmeter to the per-cpu vmmeter in a piecemeal fashion, so
have at it!
2002-04-04 21:38:47 +00:00
John Baldwin
6008862bc2 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
Brian Somers
920987e3c1 Back out the previous commit.
In the i386 case, options BOOTP requires options NFS_ROOT as well as
options NFSCLIENT.  With *both* the NFS options, a bootpc_init()
prototype is brought in by nfsclient/nfsdiskless.h.

In the ia64 case, it just doesn't work and my change just pushes it
further away from working.

Suggested to be wrong by:	bde
2002-04-04 17:58:21 +00:00
Bruce Evans
79065dba2a Moved signal handling and rescheduling from userret() to ast() so that
they aren't in the usual path of execution for syscalls and traps.
The main complication for this is that we have to set flags to control
ast() everywhere that changes the signal mask.

Avoid locking in userret() in most of the remaining cases.

Submitted by:	luoqi (first part only, long ago, reorganized by me)
Reminded by:	dillon
2002-04-04 17:49:48 +00:00
Brian Somers
55d884db38 Pre-declare bootpc_init() so that options BOOTP doesn't break the
build in ia64 and i386 due to -Werror.
2002-04-04 14:27:57 +00:00
John Baldwin
dd267672cd First round at trying to split up NOTES into MI and MD portions.
Unfortunately, this level doesn't really provide enough granularity.  We
probably need several MI NOTES type files for things that are shared by
several architectures but not by all.  For example, the PCI options could
live in a NOTES.pci.

This also updates the Makefile for i386 to generate LINT.  The only changes
in the generated LINT are the order of various options.

Suggestions for improvement welcome.
2002-04-03 18:09:17 +00:00
Ruslan Ermilov
12c79eb288 Dike out a highly insecure UCONSOLE option.
TIOCCONS must be able to VOP_ACCESS() /dev/console to succeed.

Obtained from:	OpenBSD
2002-04-03 10:56:59 +00:00
Marcel Moolenaar
5cb87b0c59 Make the kernel dump header endianness invariant by always dumping
in dump byte order (=network byte order). Swap blocksize and dumptime
to avoid extraneous padding on 64-bit architectures. Use CTASSERT
instead of runtime checks to make sure the header is 512 bytes large.
Various style(9) fixes.

Reviewed by: phk, bde, mike
2002-04-03 07:24:12 +00:00
John Baldwin
c53c013bae - Move the MI mutexes sched_lock and Giant from being declared in the
various machdep.c's to being declared in kern_mutex.c.
- Add a new function mutex_init() used to perform early initialization
  needed for mutexes such as setting up thread0's contested lock list
  and initializing MI mutexes.  Change the various MD startup routines
  to call this function instead of duplicating all the code themselves.

Tested on:	alpha, i386
2002-04-02 22:19:16 +00:00
Matthew Dillon
182da8209d Stage-2 commit of the critical*() code. This re-inlines cpu_critical_enter()
and cpu_critical_exit() and moves associated critical prototypes into their
own header file, <arch>/<arch>/critical.h, which is only included by the
three MI source files that need it.

Backout and re-apply improperly comitted syntactical cleanups made to files
that were still under active development.  Backout improperly comitted program
structure changes that moved localized declarations to the top of two
procedures.  Partially re-apply one of the program structure changes to
move 'mask' into an intermediate block rather then in three separate
sub-blocks to make the code more readable.  Re-integrate bug fixes that Jake
made to the sparc64 code.

Note: In general, developers should not gratuitously move declarations out
of sub-blocks.  They are where they are for reasons of structure, grouping,
readability, compiler-localizability, and to avoid developer-introduced bugs
similar to several found in recent years in the VFS and VM code.

Reviewed by:	jake
2002-04-01 23:51:23 +00:00
John Baldwin
44731cab3b Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API.  The entire API now consists of two functions
similar to the pre-KSE API.  The suser() function takes a thread pointer
as its only argument.  The td_ucred member of this thread must be valid
so the only valid thread pointers are curthread and a few kernel threads
such as thread0.  The suser_cred() function takes a pointer to a struct
ucred as its first argument and an integer flag as its second argument.
The flag is currently only used for the PRISON_ROOT flag.

Discussed on:	smp@
2002-04-01 21:31:13 +00:00
Poul-Henning Kamp
81661c94b6 Here follows the new kernel dumping infrastructure.
Caveats:

The new savecore program is not complete in the sense that it emulates
enough of the old savecores features to do the job, but implements none
of the options yet.

I would appreciate if a userland hacker could help me out getting savecore
to do what we want it to do from a users point of view, compression,
email-notification, space reservation etc etc.  (send me email if
you are interested).

Currently, savecore will scan all devices marked as "swap" or "dump" in
/etc/fstab _or_ any devices specified on the command-line.

All architectures but i386 lack an implementation of dumpsys(), but
looking at the i386 version it should be trivial for anybody familiar
with the platform(s) to provide this function.

Documentation is quite sparse at this time, more to come.

Details:

ATA and SCSI drivers should work as the dump formatting code has been
removed.  The IDA, TWE and AAC have not yet been converted.

Dumpon now opens the device and uses ioctl(DIOCGKERNELDUMP) to set
the device as dumpdev.  To implement the "off" argument, /dev/null
is used as the device.

Savecore will fail if handed any options since they are not (yet)
implemented.  All devices marked "dump" or "swap" in /etc/fstab
will be scanned and dumps found will be saved to diskfiles
named from the MD5 hash of the header record.  The header record
is dumped in readable format in the .info file.  The kernel
is not saved.  Only complete dumps will be saved.

All maintainer rights for this code are disclaimed: feel free to
improve and extend.

Sponsored by:   DARPA, NAI Labs
2002-03-31 22:37:00 +00:00
Poul-Henning Kamp
8d19a26558 Centralize the "bootdev" and "dumpdev" variables. They are still pretty
bogus all things considered, but at least now they don't camouflage as
being MD variables.
2002-03-31 07:15:28 +00:00
Alan Cox
ca19a2d68c Implement i386's (o)sigreturn() like the alpha's: Use copyin() to read
the osigcontext or ucontext_t rather than useracc() followed by direct user-
space memory accesses.  This reduces (o)sigreturn()'s execution time by 5-
50%.

Submitted by:	bde
2002-03-31 01:13:21 +00:00
John Baldwin
e6c838590e GC #if 0'd assembly mutex micro operations. If someone wants to bring
these back later then can get them from the attic.  Also, GC, some stale
macros to acquire and release sleep mutexes in assembly.
2002-03-28 15:14:23 +00:00
Yoshihiro Takahashi
3be63aef6f Remove unneeded pc98 hack. 2002-03-28 12:13:57 +00:00
David E. O'Brien
ae7c70d595 style(9)
Approved by:	jake
2002-03-28 02:54:44 +00:00
Jeff Roberson
f22a4b62f5 Add a new mtx_init option "MTX_DUPOK" which allows duplicate acquires of locks
with this flag.  Remove the dup_list and dup_ok code from subr_witness.  Now
we just check for the flag instead of doing string compares.

Also, switch the process lock, process group lock, and uma per cpu locks over
to this interface.  The original mechanism did not work well for uma because
per cpu lock names are unique to each zone.

Approved by:	jhb
2002-03-27 09:23:41 +00:00
Matthew Dillon
93e70a5f37 Tab-out the backslashes in icu_vector.s to make it more readable and to
match it up with apic_vector.s.
2002-03-27 05:43:11 +00:00
Matthew Dillon
d74ac6819b Compromise for critical*()/cpu_critical*() recommit. Cleanup the interrupt
disablement assumptions in kern_fork.c by adding another API call,
cpu_critical_fork_exit().  Cleanup the td_savecrit field by moving it
from MI to MD.  Temporarily move cpu_critical*() from <arch>/include/cpufunc.h
to <arch>/<arch>/critical.c (stage-2 will clean this up).

Implement interrupt deferral for i386 that allows interrupts to remain
enabled inside critical sections.  This also fixes an IPI interlock bug,
and requires uses of icu_lock to be enclosed in a true interrupt disablement.

This is the stage-1 commit.  Stage-2 will occur after stage-1 has stabilized,
and will move cpu_critical*() into its own header file(s) + other things.
This commit may break non-i386 architectures in trivial ways.  This should
be temporary.

Reviewed by:	core
Approved by:	core
2002-03-27 05:39:23 +00:00
Bruce Evans
ea1499bf8f Fixed some style bugs in the removal of __P(()). The main ones were
not removing tabs before "__P((", and not outdenting continuation lines
to preserve non-KNF lining up of code with parentheses.  Switch to KNF
formatting and/or rewrap the whole prototype in some cases.
2002-03-23 16:01:49 +00:00
Nicolas Souchu
c17d43407f Major rework of the iicbus/smbus framework:
- VIA chipset SMBus controllers added
	- alpm driver updated
	- Support for dynamic modules added
	- bktr FreeBSD smbus updated but not tested
	- cleanup
2002-03-23 15:49:15 +00:00
Bruce Evans
809dbbc99b Fixed some style bugs in the removal of __P(()). The main ones were
not removing tabs before "__P((", and not outdenting continuation lines
to preserve non-KNF lining up of code with parentheses.  Switch to KNF
formatting and/or rewrap the whole prototype in some cases.
2002-03-23 15:09:35 +00:00
Bruce Evans
fa9c948c1c Fixed some style bugs in the removal of __P(()). The main ones were
not removing tabs before "__P((", and not outdenting continuation lines
to preserve non-KNF lining up of code with parentheses.  Switch to KNF
formatting and/or rewrap the whole prototype in some cases.
2002-03-23 14:27:06 +00:00
Takanori Watanabe
391b5c4a91 Add bios area range check (lower side). 2002-03-23 06:44:04 +00:00
David E. O'Brien
439a4003ab ASM versions of __FBSDID. 2002-03-23 02:01:27 +00:00
Alan Cox
8fcaddd792 o Use the MI vm_map_growstack() instead of grow_stack() in trap_pfault()
and trapwrite().
 o On i386/pc98, remove the (now) unused grow_stack().
2002-03-21 19:27:15 +00:00
Warner Losh
ba74981e71 Fix abuses of cpu_critical_{enter,exit} by converting to
intr_{disable,restore} as well as providing an implemenation of
intr_{disable,restore}.

Reviewed by: jake, rwatson, jhb
2002-03-21 06:19:08 +00:00
Jeff Roberson
46d0abf370 Remove references to vm_zone.h and switch over to the new uma API. 2002-03-21 00:48:25 +00:00
John Baldwin
f25fcd64b8 Change the way we ensure td_ucred is NULL if DIAGNOSTIC is defined.
Instead of caching the ucred reference, just go ahead and eat the
decerement and increment of the refcount.  Now that Giant is pushed down
into crfree(), we no longer have to get Giant in the common case.  In the
case when we are actually free'ing the ucred, we would normally free it on
the next kernel entry, so the cost there is not new, just in a different
place.  This also removse td_cache_ucred from struct thread.  This is
still only done #ifdef DIAGNOSTIC.

Tested on:	i386, alpha
2002-03-20 21:09:09 +00:00
Warner Losh
e7b110dcf7 Fix minor style(9) violation in de__Ping 2002-03-20 19:04:56 +00:00
Alfred Perlstein
15fe306743 Remove __P. 2002-03-20 08:56:31 +00:00
Alfred Perlstein
89c9a48352 Remove __P. 2002-03-20 07:51:46 +00:00
Alfred Perlstein
b63dc6ad47 Remove __P. 2002-03-20 05:48:58 +00:00
Jeff Roberson
8355f576a9 This is the first part of the new kernel memory allocator. This replaces
malloc(9) and vm_zone with a slab like allocator.

Reviewed by:	arch@
2002-03-19 09:11:49 +00:00
Alan Cox
8bf0e8324d Eliminate grow_stack() from (o)sendsig(). If the stack needs to grow,
copyout() will page fault and perform grow_stack() from trap_pfault().
These calls to grow_stack() accomplish nothing.

Reviewed by:	bde
2002-03-18 07:59:57 +00:00
Dag-Erling Smørgrav
2d5c9da3d9 s/options\t\t/options \t/ 2002-03-17 23:48:24 +00:00
Alan Cox
42d5624e1f o Stop calling useracc() in (o)sendsig() now that we use copyout()
to copy the sigframe to the user's stack.  Useracc() takes a non-trivial
   amount of time.  Eliminating it speeds up signal delivery by 15% or more.
 o Update some comments.

Submitted by:	bde
2002-03-17 04:21:19 +00:00
Warner Losh
654d58ca24 Don't call the bios if the interrupt appaers to be already routed. Some
older PCI BIOSes hate this and this leads to panics when it is done.  Also,
assume that a uniquely routed interrupt is already routed.  This also
seems to help some older laptops with feable BIOSes cope.
2002-03-16 23:02:41 +00:00
Dag-Erling Smørgrav
a2e0658045 Move the definition of PT_[GS]ET{,DB,FP}REGS from the MD ptrace.h to the
MI ptrace.h, since all platforms define them.  Keep the MD ptrace.h around
for FIX_SSTEP (which is currently only needed on Alpha).
2002-03-16 00:25:53 +00:00
Luigi Rizzo
60cf2c1254 Export a (machine dependent) kernel variable bootdev as
machdep.guessed_bootdev, and add code to sysctl to parse its value
and give a (not necessarily correct) name to the device we booted
from (the main motivation for this code is to use the info in the
PicoBSD boot scripts, and the impact on the kernel is minimal).

NOTE: the information available in bootdev is not always reliable,
so you should not trust it too much.  The parsing code is the same
as in boot2.c, and cannot cover all cases -- as it is, it seems to
work fine with floppies and IDE disks recognised by the BIOS. It
_should_ work as well with SCSI disks recognised by the BIOS.
Booting from a CDROM in floppy emulation will return /dev/fd0 (because
this is what the BIOS tells us).
Booting off the network (e.g. with etherboot) leaves bootdev unset so
the value will be printed as "invalid (0xffffffff)".

Finally, this feature might go away at some point, hopefully when we
have a more reliable way to get the same information.

MFC-after: 5 days
2002-03-10 20:08:44 +00:00
Alan Cox
b275b127db Condition the compilation of trapwrite() on I386_CPU. 2002-03-10 02:11:38 +00:00