Commit Graph

432 Commits

Author SHA1 Message Date
John Baldwin
7e1f6dfe9d Modify the critical section API as follows:
- The MD functions critical_enter/exit are renamed to start with a cpu_
  prefix.
- MI wrapper functions critical_enter/exit maintain a per-thread nesting
  count and a per-thread critical section saved state set when entering
  a critical section while at nesting level 0 and restored when exiting
  to nesting level 0.  This moves the saved state out of spin mutexes so
  that interlocking spin mutexes works properly.
- Most low-level MD code that used critical_enter/exit now use
  cpu_critical_enter/exit.  MI code such as device drivers and spin
  mutexes use the MI wrappers.  Note that since the MI wrappers store
  the state in the current thread, they do not have any return values or
  arguments.
- mtx_intr_enable() is replaced with a constant CRITICAL_FORK which is
  assigned to curthread->td_savecrit during fork_exit().

Tested on:	i386, alpha
2001-12-18 00:27:18 +00:00
Ian Dowse
1cb4661d56 Enable UFS_DIRHASH in the GENERIC kernel.
Suggested by:	silby
Reviewed by:	dillon
MFC after:	5 days
2001-12-14 16:27:11 +00:00
John Baldwin
0bbc882680 Overhaul the per-CPU support a bit:
- The MI portions of struct globaldata have been consolidated into a MI
  struct pcpu.  The MD per-CPU data are specified via a macro defined in
  machine/pcpu.h.  A macro was chosen over a struct mdpcpu so that the
  interface would be cleaner (PCPU_GET(my_md_field) vs.
  PCPU_GET(md.md_my_md_field)).
- All references to globaldata are changed to pcpu instead.  In a UP kernel,
  this data was stored as global variables which is where the original name
  came from.  In an SMP world this data is per-CPU and ideally private to each
  CPU outside of the context of debuggers.  This also included combining
  machine/globaldata.h and machine/globals.h into machine/pcpu.h.
- The pointer to the thread using the FPU on i386 was renamed from
  npxthread to fpcurthread to be identical with other architectures.
- Make the show pcpu ddb command MI with a MD callout to display MD
  fields.
- The globaldata_register() function was renamed to pcpu_init() and now
  init's MI fields of a struct pcpu in addition to registering it with
  the internal array and list.
- A pcpu_destroy() function was added to remove a struct pcpu from the
  internal array and list.

Tested on:	alpha, i386
Reviewed by:	peter, jake
2001-12-11 23:33:44 +00:00
David E. O'Brien
6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
David E. O'Brien
acdff873d8 style(9) 2001-12-09 19:12:07 +00:00
Matthew Dillon
66a11b9fb1 Allow maxusers to be specified as 0 in the kernel config, which will
cause the system to auto-size to between 32 and 512 depending on the
amount of memory.

MFC after:	1 week
2001-12-09 01:57:09 +00:00
John Baldwin
aee9d2774f Add multiple inclusion protection. 2001-12-06 18:17:02 +00:00
Dag-Erling Smørgrav
3cdd7aa817 PROCFS requires PSEUDOFS. 2001-12-04 11:17:30 +00:00
Mike Barcroft
de2656d0ed o Stop abusing MD headers with non-MD types.
o Hide nonstandard functions and types in <netinet/in.h> when
  _POSIX_SOURCE is defined.
o Add some missing types (required by POSIX.1-200x) to <netinet/in.h>.
o Restore vendor ID from Rev 1.1 in <netinet/in.h> and make use of new
  __FBSDID() macro.
o Fix some miscellaneous issues in <arpa/inet.h>.
o Correct final argument for the inet_ntop() function (POSIX.1-200x).
o Get rid of the namespace pollution from <sys/types.h> in
  <arpa/inet.h>.

Reviewed by:		fenner
Partially submitted by:	bde
2001-12-01 03:43:01 +00:00
Doug Rabson
6759374681 * Don't use critical_enter/critical_exit when accessing the VHPT - its
pointless and would be inadequate for SMP systems. We will rely on the
  VM system's locks to serialise this for now.
* Change pmap_remove() so that if the range being removed is larger than
  the number of pages mapped by the pmap, we iterate over the currently
  mapped pages instead of over the virtual address range. This should
  make a difference when removing large virtual address ranges from an
  address space.
2001-11-30 10:07:54 +00:00
Doug Rabson
473ec8790d Minor tweaks to the TLB handling code - avoid movl instructions and add
itc.x instructions to attempt to avoid the little flurry of TLB exceptions
for handling access, dirty etc.
2001-11-27 09:49:53 +00:00
Peter Wemm
d65d6e5e21 s/code/ucode/ (last minute typo) 2001-11-19 08:06:56 +00:00
Peter Wemm
bc11d59b2a Initial cut at calling the EFI-provided FPSWA (Floating Point Software
Assist) driver to handle the "messy" floating point cases which
cause traps to the kernel for handling.
2001-11-19 07:25:42 +00:00
Peter Wemm
1ccc5e6c4e Use some (now) spare space for passing through a pointer to the FPSWA
Interface provided by EFI (Floating Point SoftWare Assist).
2001-11-19 07:07:09 +00:00
Peter Wemm
de76c8189e Remove bootinfo.bi_kernel. It isn't used by the kernel. struct bootinfo
should go away on ia64, we should be loader metadata based since that is
the only way we can boot (loader, skiload).
2001-11-19 07:05:10 +00:00
Peter Wemm
ab29f8765d Oops, I accidently merged a whitespace error from the original commit.
(whitespace at end of line in rev 1.264 pmap.c).  Fix them all.
2001-11-16 02:31:20 +00:00
Peter Wemm
303f52d500 Merge rev 1.264 from i386/pmap.c (tegge via alfred):
Protect against an infinite loop when prefaulting pages.  This can
happen when the vm system maps past the end of an object or tries
to map a zero length object, the pmap layer misses the fact that
offsets wrap into negative numbers and we get stuck.
2001-11-16 02:28:33 +00:00
Peter Wemm
88b5258822 Merge rev 1.202 from i386/pmap.c (back in 1998 by John Dyson):
Make flushing dirty pages work correctly on filesystems that
unexpectedly do not complete writes even with sync I/O requests.
This should help the behavior of mmaped files when using
softupdates (and perhaps in other circumstances also.)
2001-11-16 02:25:29 +00:00
Peter Wemm
79eb7b284f Merge rev 1.293 of i386/pmap.c - skip PG_UNMANAGED in pmap_collect() 2001-11-16 02:20:40 +00:00
Peter Wemm
704be0159c Converge with i386/pmap.c - dont refer to curproc, use curthread. 2001-11-16 02:06:06 +00:00
Peter Wemm
024c3fd9d5 As part of a general cleanup and reconvergence of related pmap code,
start tidying up some loose ends.  The DEBUG_VA stuff has long since
passed its use-by date.  It wasn't used on ia64 but got cut/pasted there.
2001-11-16 01:56:34 +00:00
Peter Wemm
5207c02e45 Implement eficlock_set() to set hardware clock. 2001-11-12 09:29:05 +00:00
Marcel Moolenaar
c35a41320d o os_boot_rendez is responsible for clearing the IRR bit by
reading cr.ivr, as well as writing to cr.eoi.
o  use global variables to pass information to os_boot_rendez
   so that it doesn't have to jump through hoops to find it
   out. This avoids traps on the AP without it even being
   initialized. This fixes SMP configurations.
o  Move the probing of the MADT to the end of cpu_startup,
   instead of at the start of cpu_mp_probe. We need to probe
   the MADT for non-SMP configurations as well. This fixes
   uniprocessor configurations.
o  Serialize AP wake-up by waiting for the AP. We need to do
   this since we use global variables to for the AP to use.
   As a side-effect, we can use printf() more easily to see
   what's going on.
2001-11-12 07:18:16 +00:00
Marcel Moolenaar
3ea7ef6aa3 Invoke trap() for the alt. ITLB and alt. DTLB interrrupts when
the region is not 6 or 7. This changes the behaviour from
inserting a bogus region 6 mapping to a kernel panic.
2001-11-12 07:08:45 +00:00
Peter Wemm
e16c208887 Remove #if 0'ed code that was replaced by vm_ksubmap_init() and GC'ed
on other platforms.
2001-11-12 04:14:04 +00:00
Marcel Moolenaar
da995dc92b Avoid using the .align directive to skip to the next vector offset.
It doesn't help us catch overflowing vector entries at compile time.
Instead use the .org directive. The last entry in the IVT doesn't
strictly need to be limited to 256 bytes, but doing so allows the
the VHPT to be placed immediately following the IVT without wasting
any space due to alignment.
2001-11-10 07:24:09 +00:00
Doug Rabson
3fc4a53e7a * Make sure we increment pm_stats.resident_count in pmap_enter_quick
* Re-organise RID allocation so that we don't accidentally give a RID
  to two different processes. Also randomise the order to try to reduce
  collisions in VHPT and TLB. Don't allocate RIDs for regions which are
  unused.
* Allocate space for VHPT based on the size of physical memory. More
  tuning is needed here.
* Add sysctl instrumentation for VHPT - see sysctl vm.stats.vhpt
* Fix a bug in pmap_prefault() which prevented it from actually adding
  pages to the pmap.
* Remove ancient dead debugging code.
* Add DDB commands for examining translation registers and region
  registers.

The first change fixes the 'free/cache page %p was dirty' panic which I
have been seeing when the system is put under moderate load. It also
fixes the negative RSS values in ps which have been confusing me for a
while.

With this set of changes the ia64 port is reliable enough to build its
own kernels, even with a 20-way parallel build. Next stop buildworld.
2001-11-09 13:25:14 +00:00
Doug Rabson
412fcd9856 Raise SIGILL for General Exceptions - its closer to the correct meaning. 2001-11-09 13:11:17 +00:00
Doug Rabson
3930f05aca Reserve more space for phys_avail. Really need to be more careful about
overflowing phys_avail.
2001-11-09 13:09:57 +00:00
Doug Rabson
22cbbdd047 Teach DDB about branch registers. 2001-11-09 13:08:25 +00:00
Doug Rabson
06d0801163 Define PS and VE fields of region register correctly. 2001-11-09 13:07:44 +00:00
Marcel Moolenaar
d761b0550a Implement os_boot_rendez. Application processors are initialized
and brought to a point where kernel specific initializations can
be done. That will be the next step...
2001-11-09 05:18:45 +00:00
Marcel Moolenaar
7ce535925c Don't pass os_boot_rendez directly to SAL_SET_VECTORS, because it's
actually the address of the function descriptor. The fdesc has both
the address of the function and it's corresponding gp value. Now
that we have a gp value, use it instead of passing 0.
2001-11-05 05:55:33 +00:00
Doug Rabson
ad54a36999 Implement <machine/ieeefp.h> 2001-11-03 15:51:14 +00:00
Matthew Dillon
5d339e3d47 Implement i386/i386/pmap.c 1.292 for alpha, ia64 (avoid free
page exhaustion / kernel panic for certain madvise() scenarios)
2001-11-03 01:08:55 +00:00
Mike Barcroft
0ac2d551f2 o Add new header <sys/stdint.h>.
o Make <stdint.h> a symbolic link to <sys/stdint.h>.
o Move most of <sys/inttypes.h> into <sys/stdint.h>, as per C99.
o Remove <sys/inttypes.h>.
o Adjust includes in sys/types.h and boot/efi/include/ia64/efibind.h
  to reflect new location of integer types in <sys/stdint.h>.
o Remove previously symbolicly linked <inttypes.h>, instead create a
  new file.
o Add MD headers <machine/_inttypes.h> from NetBSD.
o Include <sys/stdint.h> in <inttypes.h>, as required by C99; and
  include <machine/_inttypes.h> in <inttypes.h>, to fill in the
  remaining requirements for <inttypes.h>.
o Add additional integer types in <machine/ansi.h> and
  <machine/limits.h> which are included via <sys/stdint.h>.

Partially obtain from:	NetBSD
Tested on:		alpha, i386
Discussed on:		freebsd-standards@bostonradio.org
Reviewed by:		bde, fenner, obrien, wollman
2001-11-02 18:05:43 +00:00
Doug Rabson
60e11469dd Call ast() from exception_restore when we are restoring to user mode. 2001-11-02 10:24:44 +00:00
Doug Rabson
721d1e2149 Use static storage for the unwind state so that we can still get backtraces
when the VM system is hosed.
2001-11-02 10:04:22 +00:00
Doug Rabson
27dfd0caa3 Remember to actually free the pv_entry in pmap_remove_entry(). 2001-11-02 08:56:58 +00:00
Peter Wemm
18081136cc argh! cut/paste typo. :-(
(committed on a different machine to what I was testing it on)
2001-11-02 01:45:11 +00:00
Peter Wemm
97c97bb16b "Fix" a problem that got copied from alpha to ia64 and broke there.
When we truncate the msgbuf size because the last chunk is too small,
correctly terminate the phys_avail[] array - the VM system tests
the *end* for zero, not the start.  This leads the VM startup to
attempt to recreate a duplicate set of pages for all physical memory.

XXX the msgbuf handling is suspiciously different on i386 vs
alpha/ia64...
2001-11-02 00:41:00 +00:00
Doug Rabson
57d9a492bb Experiment with rewriting the syscall() wrapper using explicit bundling
and trying to reduce stalls from reading certain high latency registers.
This should be faster than the old syscall code. Its certainly a lot
smaller.
2001-10-31 20:02:28 +00:00
Doug Rabson
a3afc63358 Add TF_AR_FPSR, the offset of ar.fpsr in a trapframe. 2001-10-31 18:06:38 +00:00
Doug Rabson
033e93a942 Print the bundle template name on the first slot of the bundle. 2001-10-31 11:52:29 +00:00
Doug Rabson
d57b94ba65 * Factor out common code for manipulating the RSE backing store.
* Implement a fairly simplistic parser for unwinding stack frames.
* Use unwind records for DDB's 'trace' command. Also add support for
  tracing past exceptions to the context which generated the exception.

The stack unwind code requires a toolchain based on binutils-2.11.2 or
later and gcc-3.0.1 or later.
2001-10-29 12:04:23 +00:00
Doug Rabson
c3338474b9 Make the various bits of SMP code conditional on SMP so that I can still
build non-SMP kernels.
2001-10-29 11:57:12 +00:00
Doug Rabson
c543113849 Various fixes to make stack traces using the unwind tables work properly. 2001-10-29 11:30:54 +00:00
Doug Rabson
15b209a6f5 Fix disassembly of 'add a=b,c,1' and make the disassembly of the various
break and nops consistent.
2001-10-29 11:26:10 +00:00
Peter Wemm
0050cf3e5d The size of the ELF hash table changed from 64 bits in the prototype
toolchains to 32 bits in 2.11.2.

Obtained from:	dfr
2001-10-29 10:20:19 +00:00
Marcel Moolenaar
256e103fcf o Send a test IPI from the BSP to itself at the same time APs
are woken up.
o  Make IPIs synchronuous by default. If we want asynchronuous
   IPIs, we may want to make the memory fence controllable.
2001-10-29 07:34:48 +00:00