Commit Graph

30549 Commits

Author SHA1 Message Date
Alfred Perlstein
21dbcfd500 Fix a NULL deref panic in pipe_write, we can't blindly lock
pipe->pipe_peer->pipe_mtxp because it may be NULL, so lock the
passed in pipe's mutex instead.
2002-02-27 17:23:16 +00:00
Thomas Moestl
90ce56c287 Add the following functions/macros to support byte order conversions and
device drivers for bus system with other endinesses than the CPU (using
interfaces compatible to NetBSD):

- bwap16() and bswap32(). These have optimized implementations on some
  architectures; for those that don't, there exist generic implementations.
- macros to convert from a certain byte order to host byte order and vice
  versa, using a naming scheme like le16toh(), htole16().
  These are implemented using the bswap functions.
- stream bus space access functions, which do not perform a byte order
  conversion (while the normal access functions would if the bus endianess
  differs from the CPU endianess).

htons(), htonl(), ntohs() and ntohl() are implemented using the new
functions above for kernel usage. None of the above interfaces is currently
exported to user land.

Make use of the new functions in a few places where local implementations
of the same functionality existed.

Reviewed by:	mike, bde
Tested on alpha by:	mike
2002-02-27 17:16:18 +00:00
Robert Drehmel
51aa959f05 Use the updated getcredhostname() function. 2002-02-27 16:55:30 +00:00
Robert Drehmel
668ae58863 Use the updated getcredhostname() function. 2002-02-27 16:47:27 +00:00
Robert Drehmel
ad1ff0997e Make getcredhostname() take a buffer and the buffer's size
as arguments.  The correct hostname is copied into the buffer
while having the prison's lock acquired in a jailed process'
case.

Reviewed by:	jhb, rwatson
2002-02-27 16:43:20 +00:00
Robert Drehmel
9fdb8219fa - Use the new getcredhostname function in xenix_utsname(),
ibcs2_getipdomainname(), and ibcs2_utssys().

Reviewed by:	phk
2002-02-27 15:23:01 +00:00
Robert Drehmel
cb83438de4 - Use the new getcredhostname function in the SVR4 uname system call.
- Remove spurious empty line.

Reviewed by:	phk
2002-02-27 15:12:56 +00:00
Robert Drehmel
5597f0ccf2 Use the getcredhostname function to fill the hostname into
the linux_newuname_args structure.  This should fix the case
of jailed linux processes not using the jail's hostname.

PR:		35336
Reviewed by:	phk
2002-02-27 15:06:33 +00:00
Robert Drehmel
9484d0c0e8 Add a function which returns the correct hostname for a given
credential.

Reviewed by:	phk
2002-02-27 14:58:32 +00:00
Crist J. Clark
93ec91ba6d Change the wording of the inline comments from the previous commit.
Objection from:	ru
2002-02-27 13:52:06 +00:00
Alfred Perlstein
ffddaaeeeb MPsafe fixes:
use SYSINIT to initialize pipe_zone.
use PIPE_LOCK to protect kevent ops.
2002-02-27 11:27:48 +00:00
Seigo Tanimura
2f9325870d Return ESRCH if the target process is not inferior to the curproc.
Spotted by:	HIROSHI OOTA <oota@LSi.nec.co.jp>
2002-02-27 10:38:14 +00:00
Alfred Perlstein
e6be967434 Don't hardcode /sys when making tags, instead use ${.CURDIR}/.. this
fixes a problem where one tries to make tags when the source isn't in
/sys.

Submitted by: Jihui Yang <yangjihui@yahoo.com>
2002-02-27 10:07:15 +00:00
Peter Wemm
30d1ca27fe Re-fix a pointer/integer warning. 2002-02-27 09:58:06 +00:00
Peter Wemm
d1693e1701 Back out all the pmap related stuff I've touched over the last few days.
There is some unresolved badness that has been eluding me, particularly
affecting uniprocessor kernels.  Turning off PG_G helped (which is a bad
sign) but didn't solve it entirely.  Userland programs still crashed.
2002-02-27 09:51:33 +00:00
Julian Elischer
13b33111fe Fix warnings that have become fatal
1/ conditionalise (#if 0) function that is not used.
 Unused code left in place for netBSD compatibility.
2/ Recode loop to convince gcc that it does initialise a variable
 (use do-while instead of for() so gcc knows that we always go through
 at least once.  Feel free to check my logic.
2002-02-27 09:16:00 +00:00
Julian Elischer
561dac2175 turn on the ethertype filter module 2002-02-27 08:54:13 +00:00
Gary Jennejohn
ffa4ab673b Remove a redundant decalaration of call_desc[] since it's now a
fatal error.
2002-02-27 08:33:08 +00:00
Alfred Perlstein
f81b04d96c First rev at making pipe(2) pipe's MPsafe.
Both ends of the pipe share a pool_mutex, this makes allocation
and deadlock avoidance easy.

Remove some un-needed FILE_LOCK ops while I'm here.

There are some issues wrt to select and the f{s,g}etown code that
we'll have to deal with, I think we may also need to move the calls
to vfs_timestamp outside of the sections covered by PIPE_LOCK.
2002-02-27 07:35:59 +00:00
Jake Burkholder
df38f87be1 Minimal testing has shown that a 4 page tsb is a nice sweet spot for current
work loads.  It tapers off after that as gcc's working set generally just fits.

compiling bin/csh:

TSB_PAGES = 2
	213.33 real        77.59 user       110.01 sys
TSB_PAGES = 4
	116.43 real        75.78 user        19.16 sys
TSB_PAGES = 8
	119.27 real        76.38 user        18.12 sys

Testing by:	tmm
2002-02-27 06:18:02 +00:00
Jake Burkholder
95a44511f3 Parameterize the number of pages to allocate for the per-cpu area on
PCPU_PAGES.
2002-02-27 06:08:13 +00:00
Jake Burkholder
62ad058292 Make cpu_identify take the value of the ver register and cpuid as arguments
so we can print nice things about non-current cpus.
2002-02-27 06:05:50 +00:00
Peter Wemm
5c004dc68e Bandaid for the Uniprocessor kernel exploding. This makes a UP kernel
boot and run (and indeed I am committing from it) instead of exploding
during the int 0x15 call from inside the atkbd driver to get the keyboard
repeat rates.
2002-02-27 06:05:24 +00:00
Alfred Perlstein
60d9b32e44 More IPV6 const fixes. 2002-02-27 05:11:50 +00:00
Warner Losh
7ba175ac23 Use the pci.c code wherever possible, rather than copying all the pci
code into cardbus and s/pci/cardbus.  This exposes a few pci_*
functions that are now static.

This work is similar to work Justin posted to the mobile list about a
year or two ago, which I have neglected since then.

This is a subset of his current work with the multiple inheritance
newbus architecutre.  When completed, that will eliminate the need for
pci/pci_private.h.

Similar work is needed for the cardbus_cis and pccard_cis code as well.
2002-02-27 05:09:14 +00:00
Dima Dorfman
76183f3453 Introduce a version field to `struct xucred' in place of one of the
spares (the size of the field was changed from u_short to u_int to
reflect what it really ends up being).  Accordingly, change users of
xucred to set and check this field as appropriate.  In the kernel,
this is being done inside the new cru2x() routine which takes a
`struct ucred' and fills out a `struct xucred' according to the
former.  This also has the pleasant sideaffect of removing some
duplicate code.

Reviewed by:	rwatson
2002-02-27 04:45:37 +00:00
Alfred Perlstein
b7eeb587f6 clarify panic message 2002-02-27 04:27:36 +00:00
Alfred Perlstein
c4c0c592f0 Fix warnings caused by discarding const.
Hairy Eyeball At: peter
2002-02-27 02:44:45 +00:00
Julian Elischer
3ffc8ab1ac Remove errors in LINT (now that they are fatal) 2002-02-27 02:21:43 +00:00
Peter Wemm
bd1e3a0f89 Jake further reduced IPI shootdowns on sparc64 in loops by using ranged
shootdowns in a couple of key places.  Do the same for i386.  This also
hides some physical addresses from higher levels and has it use the
generic vm_page_t's instead.  This will help for PAE down the road.

Obtained from:	jake (MI code, suggestions for MD part)
2002-02-27 02:14:58 +00:00
Daniel O'Callaghan
3c3c45471c Remove problematic PHY_WRITE so that autoneg to 10 Mbps
actually works.

Submitted by: Dennis <TD790@aol.com>
Reviewed by:	Bill Paul <wpaul@freebsd.org>
MFC after:	7 days
2002-02-27 02:11:34 +00:00
Alfred Perlstein
012b7109b9 remove trailing semi-colons from macro definitions. 2002-02-27 02:02:13 +00:00
Matthew Dillon
9f34c41601 didn't quite undo the last reversion. This gets it. 2002-02-27 01:48:17 +00:00
Jake Burkholder
ad414cb452 Minor cleanup. 2002-02-27 00:31:31 +00:00
Jake Burkholder
d689965cb4 Wrap long lines. 2002-02-27 00:28:35 +00:00
Jake Burkholder
9d16662aa3 Use pcpu.pc_cpumask instead of computing 1 << cpuid. 2002-02-27 00:27:05 +00:00
Jake Burkholder
5d60dc233a Add a macro for shift of an integer (1 << shift == sizeof). Move the pointer
define to live alongside it.  For kicks assert at compile time that they are
correct.  Use these instead of magic numbers.
2002-02-27 00:21:04 +00:00
Jake Burkholder
7a8ee66881 Wrap long lines. 2002-02-27 00:03:01 +00:00
Julian Elischer
bc9f367b48 remove "discards qualifier" erro by not potentially writing to
a const *.
2002-02-26 23:38:34 +00:00
David E. O'Brien
db3442f54d Define basic macros required by GDB. 2002-02-26 21:49:46 +00:00
Matthew Dillon
08b38b1ff7 revert compatibility fix temporarily (thought it would not break anything
leaving it in).
2002-02-26 20:34:52 +00:00
Matthew Dillon
181df8c9d4 revert last commit temporarily due to whining on the lists. 2002-02-26 20:33:41 +00:00
Brooks Davis
6f4ded3a73 Fix warnings in the gif(4) driver so it compiles with -Werror. 2002-02-26 20:11:33 +00:00
Brooks Davis
240b1323c3 Set ifp->if_name to "awi" instead of device_get_name(dev) to avoid
casting away a const qualifier so the awi driver compiles.
2002-02-26 20:09:19 +00:00
Mike Barcroft
834dcade30 Rather than include namespace pollution in <grp.h> in order to declare
`gid_t', use the canonical protection scheme to define a type in two or
more headers.  This brings <grp.h> closer to POSIX.1-2001 conformance.
2002-02-26 19:43:03 +00:00
Brooks Davis
673623b376 Staticize an extern that no one else used. 2002-02-26 18:24:00 +00:00
Matthew Dillon
24e68cb0bc Make peter's commit compatible with interrupt-enabled critical_enter()
and exit(), which has already solved the problem in regards to deadlocked
IPI's.
2002-02-26 18:08:54 +00:00
Brooks Davis
521393ea56 Add a missing field to the end of array marker in the pci_ids array.
Submitted by:	sumikawa
2002-02-26 17:35:21 +00:00
Matthew Dillon
b13de3b84f Did someone turn on -Werror or something?
Fix kernel breakage.
2002-02-26 17:11:37 +00:00
Jake Burkholder
c7f9e1fdbf Apparently gcc3.1 is now using deprcated v8 instructions in v9 code
due to them being faster in certain cases.  Therefore we need to save
and restore the v8 %y register around traps in kernel mode as well as
traps in usermode.

Tested by:	obrien, tmm
2002-02-26 17:09:24 +00:00
Matthew Dillon
f96ad4c223 STAGE-1 of 3 commit - allow (but do not require) interrupts to remain
enabled in critical sections and streamline critical_enter() and
critical_exit().

This commit allows an architecture to leave interrupts enabled inside
critical sections if it so wishes.  Architectures that do not wish to do
this are not effected by this change.

This commit implements the feature for the I386 architecture and provides
a sysctl, debug.critical_mode, which defaults to 1 (use the feature).  For
now you can turn the sysctl on and off at any time in order to test the
architectural changes or track down bugs.

This commit is just the first stage.  Some areas of the code, specifically
the MACHINE_CRITICAL_ENTER #ifdef'd code, is strictly temporary and will
be cleaned up in the STAGE-2 commit when the critical_*() functions are
moved entirely into MD files.

The following changes have been made:

	* critical_enter() and critical_exit() for I386 now simply increment
	  and decrement curthread->td_critnest.  They no longer disable
	  hard interrupts.  When critical_exit() decrements the counter to
	  0 it effectively calls a routine to deal with whatever interrupts
	  were deferred during the time the code was operating in a critical
	  section.

	  Other architectures are unaffected.

	* fork_exit() has been conditionalized to remove MD assumptions for
	  the new code.  Old code will still use the old MD assumptions
	  in regards to hard interrupt disablement.  In STAGE-2 this will
	  be turned into a subroutine call into MD code rather then hardcoded
	  in MI code.

	  The new code places the burden of entering the critical section
	  in the trampoline code where it belongs.

	* I386: interrupts are now enabled while we are in a critical section.
	  The interrupt vector code has been adjusted to deal with the fact.
	  If it detects that we are in a critical section it currently defers
	  the interrupt by adding the appropriate bit to an interrupt mask.

	* In order to accomplish the deferral, icu_lock is required.  This
	  is i386-specific.  Thus icu_lock can only be obtained by mainline
	  i386 code while interrupts are hard disabled.  This change has been
	  made.

	* Because interrupts may or may not be hard disabled during a
	  context switch, cpu_switch() can no longer simply assume that
	  PSL_I will be in a consistent state.  Therefore, it now saves and
	  restores eflags.

	* FAST INTERRUPT PROVISION.  Fast interrupts are currently deferred.
	  The intention is to eventually allow them to operate either while
	  we are in a critical section or, if we are able to restrict the
	  use of sched_lock, while we are not holding the sched_lock.

	* ICU and APIC vector assembly for I386 cleaned up.  The ICU code
	  has been cleaned up to match the APIC code in regards to format
	  and macro availability.  Additionally, the code has been adjusted
	  to deal with deferred interrupts.

	* Deferred interrupts use a per-cpu boolean int_pending, and
	  masks ipending, spending, and fpending.  Being per-cpu variables
	  it is not currently necessary to lock; bus cycles modifying them.

	  Note that the same mechanism will enable preemption to be
	  incorporated as a true software interrupt without having to
	  further hack up the critical nesting code.

	* Note: the old critical_enter() code in kern/kern_switch.c is
	  currently #ifdef to be compatible with both the old and new
	  methodology.  In STAGE-2 it will be moved entirely to MD code.

Performance issues:

	One of the purposes of this commit is to enhance critical section
	performance, specifically to greatly reduce bus overhead to allow
	the critical section code to be used to protect per-cpu caches.
	These caches, such as Jeff's slab allocator work, can potentially
	operate very quickly making the effective savings of the new
	critical section code's performance very significant.

	The second purpose of this commit is to allow architectures to
	enable certain interrupts while in a critical section.  Specifically,
	the intention is to eventually allow certain FAST interrupts to
	operate rather then defer.

	The third purpose of this commit is to begin to clean up the
	critical_enter()/critical_exit()/cpu_critical_enter()/
	cpu_critical_exit() API which currently has serious cross pollution
	in MI code (in fork_exit() and ast() for example).

	The fourth purpose of this commit is to provide a framework that
	allows kernel-preempting software interrupts to be implemented
	cleanly.  This is currently used for two forward interrupts in I386.
	Other architectures will have the choice of using this infrastructure
	or building the functionality directly into critical_enter()/
	critical_exit().

	Finally, this commit is designed to greatly improve the flexibility
	of various architectures to manage critical section handling,
	software interrupts, preemption, and other highly integrated
	architecture-specific details.
2002-02-26 17:06:21 +00:00
Bruce Evans
fbd7573929 Initialize a variable bogusly to avoid a gcc bug that causes a spurious
warning.
2002-02-26 17:04:29 +00:00
Hajimu UMEMOTO
e8647cfc81 off by one error in Aaron Gifford's code. KAME PR 393.
PR:		kern/34242
Submitted by:	Aaron D. Gifford <agifford@infowest.com>
MFC after:	1 week
2002-02-26 16:58:58 +00:00
Bruce Evans
ffe4d2f7c7 Fixed 3 regressions in rev.1.99 (clobbering of the English fix in rev.1.98,
and 2 unformattings).
2002-02-26 16:17:45 +00:00
Søren Schmidt
ed57cfc480 Hide "bla bla exists, skipping it" behind bootverbose. 2002-02-26 10:38:33 +00:00
Robert Drehmel
4d79812a7c - Fix indentation and return statements to conform to style(9).
- Use the __FBSDID macro.
 - Fix some warnings.

Submitted by:	obrien (partly)
2002-02-26 10:05:20 +00:00
Josef Karthauser
dae0af0c83 Revert part of the last commit. A couple of defines were removed
by NetBSD because they don't use them (they've no usbd), but we do.
2002-02-26 10:00:32 +00:00
Benno Rice
4b1211c7cc Add makeoptions NO_WERROR=true so that we can build. =) 2002-02-26 09:55:17 +00:00
Poul-Henning Kamp
c91f7a7332 Cast the variable, not the constant to 64 bits. 2002-02-26 09:27:39 +00:00
Poul-Henning Kamp
0f5c7c4b1c Fix warning in !SMP case.
Submitted by:	 Maxime Henrion <mux@mu.org>
2002-02-26 09:21:52 +00:00
Poul-Henning Kamp
1634e90817 Remove unused variable. 2002-02-26 09:16:27 +00:00
Mike Barcroft
be2adb3b6c Hide GCCisms in the non-GCC case. 2002-02-26 07:44:03 +00:00
Jake Burkholder
de3fee8992 Convert pmap.pm_context to an array of contexts indexed by cpuid. This
doesn't make sense for SMP right now, but it is a means to an end.
2002-02-26 06:57:30 +00:00
Jake Burkholder
200e6309c9 Pu back a call to pmap_context_destroy which was accidentily removed
in the previous commit.

Spotted by:	tmm
2002-02-26 06:39:38 +00:00
Doug Ambrisko
c9977aaadf In ad-hoc mode, the "associate" bit is valid to check to see if it is
part of an ad-hoc network.  This means another station needs to be
around so they can both associate.

MFC after:	1 week
2002-02-26 05:43:05 +00:00
Warner Losh
476f923056 Until I can figure out how to live without the volatile qualifier on
comdefaultrate, comment out the support for machdep.conspeed for now.
2002-02-26 03:46:14 +00:00
Warner Losh
375b025257 Remove an unused variable. 2002-02-26 03:37:35 +00:00
Warner Losh
1efefb2d4d Fix warnings introduced in the PCI_ALLOW_UNSUPPORTED_IO_RANGE case. 2002-02-26 03:31:35 +00:00
Warner Losh
47f9536259 If we're going to ifdef out the only reference to asr_drvinit, then
go ahead and ifdef out the function too.
2002-02-26 03:22:44 +00:00
Warner Losh
96fc5a062e Add an experimental tunable: machdep.conspeed.
# I'm not sure where to document this.
2002-02-26 03:13:30 +00:00
Warner Losh
0375947168 minor style(9) fix: return (foo); The file was mostly style(9) before. 2002-02-26 03:00:19 +00:00
Jake Burkholder
6e5f3d0f0f Allow the user tsb to span multiple pages. Make the default 2 pages for now
until we do some testing to see what's best.  This gives a massive reduction
in system time for processes with a relatively large working set.  The size
of the tsb directly affects the rss size that a user process can keep mapped.
When it starts to get full replacements occur and the process takes a lot of
soft vm faults.  Increasing the default from 1 page to 2 gives the following
before and after numbers for compiling vfs_bio.c:

before:
       14.27 real         6.56 user         5.69 sys
after:
        8.57 real         6.11 user         1.62 sys

This should make self hosted builds more tolerable.
2002-02-26 02:37:43 +00:00
Brooks Davis
7a46ec8f63 When using hardware decoding, reconstruct the wire form of the ethernet
header and push it up any attached bpf devices on the parent interface.
This makes hardware vlan decoding more like the normal software path.

Tested by:	cjtt@employees.org
MFC after:	2 weeks
2002-02-26 02:19:33 +00:00
Chris D. Faulhaber
546f251b29 Enforce inbound IPsec SPD
Reviewed by:	fenner
2002-02-26 02:11:13 +00:00
Brooks Davis
872f786a75 Make gif(4) nesting level and parallel tunnel support tunable at runtime
via sysctl's.  The old #defines, MAX_GIF_NEST and XBONEHACK are
currently supported for backwards compatability, but will probably be
removed at some point in the future.
2002-02-26 01:56:56 +00:00
Alfred Perlstein
6f65a2bd46 in ulpt_reset() req.bmRequestType was unitialized, fix it. 2002-02-26 01:19:56 +00:00
Josef Karthauser
648b06a6ed Merge from NetBSD:
usb.h (rev 1.61):

    date: 2002/01/01 14:23:37;  author: augustss;
    Add a missing subclass definition.

usb.h (rev 1.63) and usb_port.h (rev 1.52):

    date: 2002/02/25 00:46:37;  author: augustss;
    Some portability improvement.
    Add define for usb.h version.
2002-02-26 01:15:08 +00:00
Peter Wemm
c0933269c3 Fix a warning by pulling prototype for arp_ifinit() into scope.
Then fix cast the correct value into an incorrect value, which was not
detected due to the missing prototype (but was harmless anyway).
2002-02-26 01:11:08 +00:00
Peter Wemm
0574a5a746 Fix warning; amdsmb_abort() is not used. 2002-02-26 01:04:58 +00:00
Peter Wemm
e2256f43ed Fix warning. s/microuptime()/binuptime()/ for switchtime initial value. 2002-02-26 01:03:39 +00:00
Peter Wemm
dd50331c0e Remove unused variable (td) 2002-02-26 01:01:37 +00:00
Peter Wemm
a1f7f9fec8 Fix a warning. useracc() should take a const pointer argument. 2002-02-26 01:00:39 +00:00
Peter Wemm
bd47bef5aa Fix a warning. Do not assume pointer == long. 2002-02-26 00:55:27 +00:00
Peter Wemm
6bd95d70db Work-in-progress commit syncing up pmap cleanups that I have been working
on for a while:
- fine grained TLB shootdown for SMP on i386
- ranged TLB shootdowns.. eg: specify a range of pages to shoot down with
  a single IPI, since the IPI is very expensive.  Adjust some callers
  that used to trigger this inside tight loops to do a ranged shootdown
  at the end instead.
- PG_G support for SMP on i386 (options ENABLE_PG_G)
- defer PG_G activation till after we decide what we are going to do with
  PSE and the 4MB pages at the start of the kernel.  This should solve
  some rumored strangeness about stale PG_G entries getting stuck
  underneath the 4MB pages.
- add some instrumentation for the fine TLB shootdown
- convert some asm instruction wrappers from functions to inlines.  gcc
  seems to do a fair bit better with this.
- [temporarily!] pessimize the tlb shootdown IPI handlers.  I will fix
  this again shortly.

This has been working fairly well for me for a while, but I have tweaked
it again prior to commit since my last major testing round.  The only
outstanding problem that I know of is PG_G related, which is why there
is an option for it (not on by default for SMP).  I have seen a world
speedups by a few percent (as much as 4 or 5% in one case) but I have
*not* accurately measured this - I am a bit sceptical of these numbers.
2002-02-25 23:49:51 +00:00
Jake Burkholder
07d99740b6 Remove code to lock the user tsb into the tlb. We can handle faults on it
now, as we do for normal wired kernel memory.
2002-02-25 22:58:41 +00:00
David E. O'Brien
65955377e3 I was able to boot this kernel using the latest WIP kernel sources.
I don't believe anyone is quite using the sparc64 kernel sources in CVS
yet -- things aren't just quite ready (but almost).  So this commit should
be OK to make.
2002-02-25 22:13:44 +00:00
Peter Wemm
2faccca61a Turn on -Werror by default. This is is easily turned off, by either:
- fix the warnings, they are there for a reason!
- add -DNO_ERROR to your make(1) command.
- add 'makeoptions NO_WERROR=true' to your kernel config.
- add 'nowerror' to conf/files* that have warnings that should be fixed
  due to tracking 3rd party vendor code.
- add 'nowerror' to conf/files* where the warning is false due to a
  compiler bug and fixing it with brute force would be too expensive.

There are some very sloppy warnings in our kernel build, come on folks!

'make release' uses -DNO_WERROR intentionally.
2002-02-25 22:04:33 +00:00
Peter Wemm
46bbc8f2bb Add 'nowerror' to the vendor acpica code that spews out warnings. 2002-02-25 21:54:06 +00:00
Peter Wemm
963131fe0a Tidy up some warnings 2002-02-25 21:42:23 +00:00
Jake Burkholder
4c4a1a19e8 Implement a nested window state. This avoids attempting to spill a user
window to the user stack while in a nested kernel trap.  We do this for
entry to the kernel from user mode, but if we get an interrupt in kernel
mode while there are still user windows in the cpu, and we attempt to spill
to the user stack, we may take too many nested traps and overflow the trap
stack, causing a red state exception.  This is needed by upcoming changes
to allow the user tsb to not be locked in the tlb.

Reviewed by:	tmm
2002-02-25 18:37:17 +00:00
Poul-Henning Kamp
cb877d0050 Add a new test_counter() function which tries to determine the width of
the inter-value histogram for 2000 samples.  If the width is 3 or less
for 10 consequtive samples, we trust the counter to be good, otherwise
we use the *_safe() method.

This method may be too strict, but the worst which can happen is that
we take the performance hit of the *_safe() method when we should not.

Make the *_safe() method more discriminating by mandating that the three
samples do not span more than 15 ticks on the counter.

Disable the PCI-ident based probing as a means to recognize good
counters.

Inspiration from:	dillon and msmith
2002-02-25 09:51:17 +00:00
Alfred Perlstein
6d53e16389 Document what inpcb->inp_vflag is for.
Submitted by: Marco Molteni <molter@tin.it>
2002-02-25 09:41:43 +00:00
Crist J. Clark
2ca2159f22 The TCP code did not do sufficient checks on whether incoming packets
were destined for a broadcast IP address. All TCP packets with a
broadcast destination must be ignored. The system only ignored packets
that were _link-layer_ broadcasts or multicast. We need to check the
IP address too since it is quite possible for a broadcast IP address
to come in with a unicast link-layer address.

Note that the check existed prior to CSRG revision 7.35, but was
removed. This commit effectively backs out that nine-year-old change.

PR:		misc/35022
2002-02-25 08:29:21 +00:00
Jake Burkholder
3c997c536c Modify the tte format to not include the tlb context number and to store the
virtual page number in a much more convenient way; all in one piece.  This
greatly simplifies the comparison for a matching tte, and allows the fault
handlers to be much simpler due to not having to load wierd masks.
Rewrite the tlb fault handlers to account for the new format.  These are also
written to allow faults on the user tsb inside of the fault handlers; the
kernel fault handler must be aware of this and not clobber the other's
registers.  The faults do not yet occur due to other support that is needed
(and still under my desk).

Bug fixes from:	tmm
2002-02-25 04:56:50 +00:00
Bruce Evans
0c6ec4aca0 Declare time(not3) instead of depending on namespace pollution 3 layers
deep in <stand.h> to eventually include <time.h> to declare the user
version.

This is not quite the right place to declare it, but <stand.h> would
be worse because time() is very MD so it isn't in libstand.

Many places in the boot sources still get the user version using only
1 layer of pollution (#include <sys/time.h>.  Some pollute themselves
directly (#include <time.h>).  But the boot Makefiles are too broken
to enable warnings for redeclarations.
2002-02-25 04:31:25 +00:00
Bruce Evans
fa883367ab Removed mounds of unused variables. 2002-02-25 03:45:09 +00:00
Mike Smith
5da19f398a The thermal thread needs to take Giant before it does anything with the
interpreter.

Submitted by:	Magnus B{ckstr|m <b@etek.chalmers.se>
2002-02-25 02:21:22 +00:00
Ian Dowse
ddb7d629f1 Sockets passed into uipc_abort() have been allocated by sonewconn()
but never accept'ed, so they must be destroyed. Originally, unp_drop()
detected this situation by checking if so->so_head is non-NULL.
However, since revision 1.54 of uipc_socket.c (Feb 1999), so->so_head
is set to NULL before calling soabort(), so any unix-domain sockets
waiting to be accept'ed are leaked if the server socket is closed.

Resolve this by moving the socket destruction code into uipc_abort()
itself, and making it unconditional (the other caller of unp_drop()
never needs the socket to be destroyed). Use unp_detach() to avoid
the original code duplication when destroying the socket.

PR:		kern/17895
Reviewed by:	dwmalone (an earlier version of the patch)
MFC after:	1 week
2002-02-25 00:03:34 +00:00
Benno Rice
dfc02c301d Make atomic_cmpset_32 correctly return 0 on failure. 2002-02-24 23:31:49 +00:00
Alfred Perlstein
0077e8223b Fix style bugs:
Missing `const' qualifier.
Initialization in declaration.

Submitted by: mike
2002-02-24 23:24:01 +00:00
Matthew Dillon
d32e27a9f4 Tests by numerous people have shown that many chipsets do not properly
latch the acpi timer, resulting in weird deltas.  The problem is severe
enough to adversely effect the timecounter code.

Default to the 'safe' version of the get-timecount function.  The probe
will override it if a known-good chipset is found.  This is temporary
until a more complete solution is found.

Reviewed by:	phk
2002-02-24 22:58:15 +00:00
Alfred Perlstein
3f7ad4d593 bump __FreeBSD_version for usb structure rename. 2002-02-24 22:45:33 +00:00
Alfred Perlstein
b2e4739f7e Give a little more information as to why pnp configuration of a device
may have failed.

Submitted by: Terry Lambert <tlambert2@mindspring.com>
2002-02-24 22:27:54 +00:00
Poul-Henning Kamp
5b7d8efa8d Add a generation number to timecounters and spin if it changes under
our feet when we look inside timecounter structures.

Make the "sync_other" code more robust by never overwriting the
tc_next field.

Add counters for the bin[up]time functions.

Call tc_windup() in tc_init() and switch_timecounter() to make sure
we all the fields set right.
2002-02-24 20:04:07 +00:00
Poul-Henning Kamp
e9be968e95 Fix a typo (?) in previous commit told ttyprintf() to print the integer
part of the user-time as a 64bit quantity.  This resulted in weird
output from SIGINFO.
2002-02-24 19:56:41 +00:00
David E. O'Brien
44bec8227d Sync with the Alpha's GENERIC configuration.
Most of the contents are commented out as they are as-yet untested.
However, I wanted the contents to match our other arches, so that when
people make changes to {i386,alpha,ia64}, they will also make the same
changes here.
2002-02-24 18:49:38 +00:00
Søren Schmidt
acf7db1110 Finish phk's previous removal of BIO_ORDERED, all code that
depended on ATA_FLUSHCACHE_ON is now useless.
2002-02-24 12:28:24 +00:00
Mike Smith
e941505796 Move some debugger-only symbols around; this patch didn't make it into
the commit resolution for some reason.  Fixes ACPI_DEBUG.
2002-02-24 07:51:46 +00:00
Dag-Erling Smørgrav
a0eed7bc1c Add a sysctl, sysctl hw.snd.report_soft_formats, that controls whether the
AIOGCAP ioctl reports software-emulated formats.  It defaults to on.  People
who use performance-sensitive audio software and do not want it to pick a
software-emulated audio format instead of one supported by their hardware
should turn it off.

This unbreaks isdnphone(1) on systems with PCM-only sound cards.

Approved by:	cg
2002-02-24 00:49:43 +00:00
Thomas Moestl
d2d45a4aa5 Fix LINT breakage by adding a missing include. 2002-02-23 22:55:47 +00:00
Jake Burkholder
b450bd2a37 Add PMAP_STATS option so pmap.c compiles. 2002-02-23 22:35:57 +00:00
Jake Burkholder
27886bcca9 Make use of the ranged tlb demap operations where ever possible. Use
pmap_qenter and pmap_qremove in preference to pmap_kenter/pmap_kremove.
The former maps in multiple pages at a time, and so can do a ranged
flush.  Don't assume that pmap_kenter and pmap_kremove will flush the tlb,
even though they still do.  It will not once the MI code is updated to use
pmap_qenter and pmap_qremove.
2002-02-23 22:18:15 +00:00
Jake Burkholder
4852de3022 Add needed include of ucontext.h. 2002-02-23 22:03:25 +00:00
Dag-Erling Smørgrav
649e717865 Fix namespace pollution introduced in previous commit. 2002-02-23 21:14:43 +00:00
Jake Burkholder
4d6fc96f19 Add inlines for demapping a range of pages from the itlb and dtlb. This
will be used to reduce the number of tlb shootdown ipis in an smp system
by sending one ipi for a whole range of pages, instead of one per page.
Munge the context demap operations slightly to support demapping a non-primary
context.
2002-02-23 21:10:06 +00:00
Jake Burkholder
e87e98c1d6 Use intr_disable/intr_restore instead of TLB_ATOMIC_START/END.
Submitted by:	tmm
2002-02-23 20:59:35 +00:00
Jake Burkholder
b7e93803fb Use PCB_REG instead of loading the pcb from curthread. This fixes a bug
where %g6 could be inconsistent for 1 instruction.
2002-02-23 20:54:01 +00:00
Jake Burkholder
919f71f0fc Adapt the tsb_foreach interface to take a source and a destination pmap so
that it can be used for pmap_copy.  Other consumers ignore the second pmap.
Add statistics gathering for tsb_foreach.
Implement pmap_copy.
2002-02-23 20:25:20 +00:00
Jake Burkholder
7cc66bde35 Add statistic gathering for various tsb operations.
Submitted by:	tmm
2002-02-23 20:11:11 +00:00
Jake Burkholder
d250bf3668 Remove debug code. 2002-02-23 20:08:06 +00:00
Jake Burkholder
b07078429e Add statistic gathering for various pmap operations.
Submitted by:	tmm
2002-02-23 20:06:19 +00:00
Jake Burkholder
ca0d9d125e Remove CADDR1 and CADDR2 which are no longer used. On other architectures
these are used for copy and zeroing physical pages; we use physical addresses
directly.
2002-02-23 20:00:33 +00:00
Jake Burkholder
502a371561 Add macros to extract the UPA module id from the UPA config register.
This is the hardware cpuid.
2002-02-23 19:54:34 +00:00
Jake Burkholder
120a25d68a 1. Setup the user stack pointer before returning to a user trap handler.
If we don't do this here there's a 1 instruction race where an interrupt
   could come in and crash the user process due to having no stack.
2. Pass %fsr to the user trap handler in %l4.  Since %fsr can only be loaded
   from or stored to memory, we need to do some contortions and temporarily
   save it to the alternate global stack.
3. Reload the pcb and pcpu registers for traps in kernel mode, for sanity.

Submitted by:	tmm (1, 2)
2002-02-23 18:55:21 +00:00
Jake Burkholder
40e8552ea0 Include intr_machdep.h only for !LOCORE. 2002-02-23 18:41:34 +00:00
Jake Burkholder
4d4b329999 Add needed include of ucontext.h. Fix braino setting curpcb. 2002-02-23 18:39:09 +00:00
Jake Burkholder
47fc42e6a0 Add metadata types for dtlb and itlb data, and number of slots used. 2002-02-23 17:43:44 +00:00
Seigo Tanimura
f591779bb5 Lock struct pgrp, session and sigio.
New locks are:

- pgrpsess_lock which locks the whole pgrps and sessions,
- pg_mtx which protects the pgrp members, and
- s_mtx which protects the session members.

Please refer to sys/proc.h for the coverage of these locks.

Changes on the pgrp/session interface:

- pgfind() needs the pgrpsess_lock held.

- The caller of enterpgrp() is responsible to allocate a new pgrp and
  session.

- Call enterthispgrp() in order to enter an existing pgrp.

- pgsignal() requires a pgrp lock held.

Reviewed by:	jhb, alfred
Tested on:	cvsup.jp.FreeBSD.org
		(which is a quad-CPU machine running -current)
2002-02-23 11:12:57 +00:00
Jake Burkholder
4aaca88542 Keep track of the ttes used to map the kernel and pass them to it as loader
metadata.  Modify tlb handling functions to take a tte, instead of virtual
address, physical address and flags.
2002-02-23 11:06:37 +00:00
Benno Rice
f8e03c1093 Don't call critical_enter()/critical_exit() around calls to pmap_pvo_enter()
as it does it's own handling of critical sections.
2002-02-23 05:55:51 +00:00
Mike Smith
222c49a4c7 AcpiOsPrintf and AcpiOsVprintf now return void. 2002-02-23 05:32:51 +00:00
Mike Smith
9232a543e6 AcpiOsCallocate is no longer required. 2002-02-23 05:32:10 +00:00
Mike Smith
72e5754cfb Match namespace cleanup changes in ACPI CA 20020217 update. 2002-02-23 05:31:38 +00:00
Mike Smith
dd5d65087b Add our own private defines for driver debug layers.
Obsolete the acpi_GetInto* interfaces.

Fix a typo to be less appropriate.
2002-02-23 05:30:54 +00:00
Mike Smith
1a6f2d2ab3 Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Convert to using a kthread rather than timeout() to avoid problems
with the interpreter sleeping.
2002-02-23 05:29:23 +00:00
Mike Smith
741ef403c2 Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.
2002-02-23 05:28:22 +00:00
Mike Smith
c1b1f7874c Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Use _ADR as well as _BBN to get our bus number.
2002-02-23 05:27:49 +00:00
Mike Smith
9127281c88 Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
2002-02-23 05:26:45 +00:00
Mike Smith
dbd0058a4e Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.

The ACPI global lock acquire takes a timeout value.  I'm not sure what
we should do about timeouts on it; a deadlock against this lock is
catastrophic.
2002-02-23 05:26:31 +00:00
Mike Smith
595a08978c Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Kill off the timeouts that used to read _BIF and _BST.  These are
invoked when the battery is actually read.  timeout() is dangerous
in combination with ACPI, as the interpreter can block.

This driver still needs more work.
2002-02-23 05:24:14 +00:00
Mike Smith
b53f277167 Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Add AcpiBatteryIsPresent helper to determine whether a battery device
is inserted.

Add ACPI_ALL_DRIVERS to the list of debug layers, now that we own the
namespace for this.

Pr:
2002-02-23 05:21:56 +00:00
Mike Smith
afa56f0b6d Resolve conflicts arising from the ACPI CA 20020217 import. 2002-02-23 05:16:34 +00:00
Mike Smith
8f296b2e5d This commit was generated by cvs2svn to compensate for changes in r91116,
which included commits to RCS files with non-trunk default branches.
2002-02-23 05:10:40 +00:00
Mike Smith
857591c3aa Vendor import of the Intel ACPI CA 20020217 drop. 2002-02-23 05:10:40 +00:00
Jake Burkholder
90774cfa30 Add -ffreestanding to CFLAGS. 2002-02-23 04:36:15 +00:00
Jake Burkholder
3c5ef798a0 Add make variables for fs support and propagate them to CFLAGS. Put
-ffreestanding in CFLAGS.  Remove unnecessary LDFLAGS.
2002-02-23 04:35:28 +00:00
Jake Burkholder
23b93fc323 Fix test for != 0 that should be > 0. 2002-02-23 04:33:15 +00:00
Jake Burkholder
c2ef11f244 Check the return values of index() and don't dereference it if its null;
the path may not have a ':' in it.  The mac address property is called
mac-address for sparc64.  Don't allocate a dma buffer for sparc64 either.
2002-02-23 04:31:30 +00:00
Jake Burkholder
0c7065ad98 #if 0 more bootinfo stuff. 2002-02-23 04:13:02 +00:00
Jake Burkholder
d112f7bd5b Fix fs support ifdefs. Add tftp support. Add physical and virtual
watchpoint support for debugging (under LOADER_DEBUG).  Claim the
physical and virtual addresses used to map the kernel from the prom;
we map it ourselves behind the scenes though.  Add a reboot command.

Submitted by:	tmm
2002-02-23 04:04:30 +00:00