Commit Graph

3016 Commits

Author SHA1 Message Date
Jonathan Lemon
991f976036 Implement multiple low-level console support. 2001-10-23 20:25:50 +00:00
Dag-Erling Smørgrav
1f04261973 [partially forced commit due to pilot error in earlier commit attempt]
{set,fill}_{,fp,db}regs() fixup:

 - Add dummy {set,fill}_dbregs() on architectures that don't have them.

 - KSEfy the powerpc versions (struct proc -> struct thread).

 - Some architectures had the prototypes in md_var.h, some in reg.h, and
   some in both; for consistency, move them to reg.h on all platforms.

These functions aren't really MD (the implementation is MD, but the interface
is MI), so they should move to an MI header, but I haven't figured out which
one yet.

Run-tested on i386, build-tested on Alpha, untested on other platforms.
2001-10-21 22:16:48 +00:00
Bruce Evans
08b00f49c3 MFi386:
- sys/pc98/pc98/npx.c 1.87 (2001/09/15; author: imp)
  I don't think pc98 has acpi at all, so ifdef the acpi attachments for
  now.

This completes merging sys/pc98/pc98/npx.c into sys/i386/isa/npx.c so
that the former can be removed.
2001-10-21 06:05:08 +00:00
Bruce Evans
abfde38316 MFpc98: fundamental differences. The magic numbers for the i/o port
and the irq are different for pc98, and are not very well handled (we
use a historical mess of hard-coded values, values from header files
and values from hints).
2001-10-21 05:56:03 +00:00
Bruce Evans
40d8c8da95 MFpc98: all changes in sys/pc98/pc98/npx.c related to FPU_ERROR_BROKEN.
- 1.58 (2000/09/01; author: kato)
  Fixed FPU_ERROR_BROKEN code.  It had old-isa code.
- 1.33 (1998/03/09; author: kato)
  Make FPU_ERROR_BROKEN a new-style option.
- 1.7 (1996/10/09; author: asami)
  Make sure FPU is recognized for non-Intel CPUs.

The log for rev.1.7 should have said something like:
Added FPU_ERROR_BROKEN option.  This forces a successful probe for
exception 16, so that hardware with a broken FPU error signal can sort
of work.
2001-10-21 05:18:30 +00:00
Matt Jacob
8c7c272c5a Remove wx. 2001-10-20 18:50:31 +00:00
David E. O'Brien
c932615213 Drop support for x87 emulation. Any CPU one would dare to run 5-CURRENT
on would have built-in FP support.
2001-10-20 01:15:54 +00:00
Matt Jacob
aaeac4f6c3 Make SCSI changer and SES devices standard in generic kernels.
Reviewed by:	ken@kdm.org
2001-10-16 22:22:58 +00:00
Bruce Evans
265e95d904 Deleted most of npxprobe(), and merged npxprobe1() back into npxprobe().
Use the normal interrupt handler (npx_intr()) instead of a special
probe-time interrupt handler, although this causes problems due to
the bus_teardown_intr() not actually even tearing down the interrupt
(these problems were avoided by doing interrupt attachment for the
special interrupt handler directly).  Fixed minor bitrot in comments.

The reason for the npxprobe()/npxprobe1() split mostly went away at
about the same time it was made (in 1992 or 1993 just before the
beginning of history).  386BSD ran all probes with interrupts completely
masked, and I didn't want to disturb this when I added an irq probe
to npxprobe().  An irq (not necessarily npx) must be acked for at least
external npx's to take the cpu out of the wait state that it enters
when an npx error occurs, so the probe must be done with a suitable
irq unmasked.  npxprobe() went to great lengths to unmask precisely
the npx irq.

Running probes with all interrupts masked was never really needed in
FreeBSD, since FreeBSD always masked interrupts well enough using
splhigh(), but it wasn't until rev.1.48 (1995/12/12) of autoconf.c
that all probes were run with CPU interrupts enabled.  This permits
npxprobe() to probe its irq using normal interrupt resources.  Note
that most drivers still can't depend on this.  It depends on the
interrupt handler being fast and the irq not being shared.
2001-10-16 14:12:35 +00:00
Bruce Evans
2504f76272 Commit my old fixes for cosmetic bugs in npxprobe() so that they aren't
lost when the buggy code goes away completely:
- don't assume that the npx irq number is >= 8.  Rev.1.73 only reversed
  part of the hard-coding of it to 13 in rev.1.66.
- backed out the part of rev.1.84 that added a highly confused comment
  about an enable_intr() being "highly bogus".  The whole reason for
  existence of npxprobe() (separate from the main probe, npxprobe1())
  is to handle the complications to make this enable_intr() safe.
- backed out the part of rev.1.94 that modified npxprobe().  It mainly
  broke the enable_intr() to restore_intr().  Restoring the interrupt
  state in a nested way is precisely what is not wanted here.  It was
  harmless in practice because npxprobe() is called with interrupts
  enabled, so restoring the interrupt state enables interrupts.  Most
  of npxprobe() is a no-op for the same reason...
2001-10-16 12:55:38 +00:00
Tor Egge
4c8f0aced5 Explicitly initialize the fpu when SSE is enabled since this no
longer happens as a side effect of calling npxsave.

Reviewed by:	peter, bde
2001-10-15 20:18:06 +00:00
Tor Egge
10ad529832 Change vmapbuf() to use pmap_qenter() and vunmapbuf() to use pmap_qremove().
This significantly reduces the number of TLB shootdowns caused by
vmapbuf/vunmapbuf when performing many large reads from raw disk devices.

Reviewed by:	dillon
2001-10-14 21:09:04 +00:00
Tor Egge
2334091845 Reduce the number of TLB shootdowns caused by a call to pmap_qenter()
from number of pages mapped to 1.

Reviewed by:	dillon
2001-10-14 20:56:55 +00:00
John Polstra
215e696b60 Correct the input/output/clobber specifications for the cpuid
instruction.  Stefan Keller <dres@earth.serd.org> noticed that CPU
identification was broken when compiled with -O2, and tracked it
down to the asm statement, which was storing values into memory
without specifying that memory was modified.  He submitted a patch
which added "memory" as a clobber, but I refined it further to
arrive at this version.

MFC after:	3 days
2001-10-12 16:49:28 +00:00
John Baldwin
fa78c35ad2 Oops, these already included sys/lock.h, they just did so after
sys/mutex.h which is too late.
2001-10-11 18:25:57 +00:00
John Baldwin
61d80e90a9 Add missing includes of sys/ktr.h. 2001-10-11 17:53:43 +00:00
John Baldwin
7106ca0d1a Add missing includes of sys/lock.h. 2001-10-11 17:52:20 +00:00
Paul Saab
cbc89bfbfe Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loader
tunable.

Reviewed by:	peter
MFC after:	2 weeks
2001-10-10 23:06:54 +00:00
Ian Dowse
3c7bcedd06 Remove the Xresume* labels from the i386 interrupt handlers; the
code in ipl.s and icu_ipl.s that used them was removed when the
interrupt thread system was committed. Debuggers also knew about
Xresume* because these labels hide the real names of the interrupt
handlers (Xintr*), and debuggers need to special-case interrupt
handlers to get the interrupt frame.

Both gdb and ddb will now use the Xintr* and Xfastintr* symbols to
detect interrupt frames. Fast interrupt frames were never identified
correctly before, so this fixes the problem of the running stack
frame getting lost in a ddb or gdb trace generated from a fast
interrupt - e.g. when debugging a simple infinite loop in the kernel
using a serial console, the frame containing the loop would never
appear in a gdb or ddb trace.

Reviewed by:	jhb, bde
2001-10-09 19:54:52 +00:00
Robert Drehmel
1e8ff53804 Remove an unneeded variable declaration and statement.
Approved by:	jake
2001-10-09 16:06:28 +00:00
John Baldwin
2a89a48fbd Allow atomic ops to be somewhat safely used in userland. We always use
lock prefixes in the userland case so that the binaries will work on both
SMP and UP systems.
2001-10-08 20:58:24 +00:00
Luigi Rizzo
7d4b046991 Export interrupt statistics via sysctl.
MFC-after: 3 days
2001-10-07 17:03:56 +00:00
Yoshihiro Takahashi
f2eeb19063 Rewrite the pc98 bus_space stuff.
The type of bus_space_tag_t is now a pointer to bus_space_tag structure,
and the bus_space_tag structure saves pointers to functions for direct
access and relocate access.

Added bsh_bam member to the bus_space_handle structure, it saves access
method either direct access or relocate access which is called by
bus_space_* functions.

Added the mecia device support. If the bs_da and bs_ra in bus tag are set
NEPC_io_space_tag and NEPC_mem_space_tag respectively, new bus_space stuff
changes the register of mecia automatically for 16bit access.

Obtained from:	NetBSD/pc98
2001-10-07 10:04:18 +00:00
Yoshihiro Takahashi
31b2da2bea - Moved the bus_dma declarations from bus_{at386,pc98}.h into bus_dma.h.
(bus_dma.h is repo-copied from bus_at386.h)
- Added '#include <machine/bus_dma.h>' into bus.h for backward compatibility.
2001-10-06 16:27:21 +00:00
Peter Wemm
5e0f6bc415 Fix a warning. (unused p if not INVARIANTS) 2001-10-06 02:13:58 +00:00
Doug Rabson
9e9ce1b861 In in_cksumdata, len must be a signed type. 2001-10-05 18:58:22 +00:00
Matt Jacob
22883e3c68 Fix problem where a user buffer outside of the area being tested
will be corrupted.

PR:		29194
Obtained from:	Tor.Egge@fast.no
MFC after:	2 weeks
2001-10-02 18:34:20 +00:00
John Baldwin
bf2965ed32 Disable the check in icu_setup() to see if a handler was already used as
the current interrupt thread routines will guarantee the condition this is
checking for at a higher level but inthand_add() and inthand_remove() as
they currently exist don't satisfy this condition.  (Which does need to be
fixed but which will take a bit more work.)  This fixes shared interrupts.
2001-09-27 19:03:52 +00:00
Jonathan Lemon
fe16674a74 Return EINVAL if the passed intr is out of bounds.
PR: 30857
Submitted by: David Xu <davidx@viasoft.com.cn>
MFC: 1 week
2001-09-27 02:46:47 +00:00
Robert Watson
330e78897a o Modify i386_set_ioperm() to use securelevel_gt() instead of
direct securelevel variable checks.

Obtained from:	TrustedBSD Project
2001-09-26 20:08:15 +00:00
Robert Watson
1851c8fd41 o Modify device open access control for /dev/mem and friends to use
securelevel_gt() instead of direct securelevel variable checks.

Obtained from:	TrustedBSD Project
2001-09-26 20:08:02 +00:00
Brooks Davis
2f65332817 The faith(4) device is no longer a count device so don't specify a count. 2001-09-25 18:56:40 +00:00
David E. O'Brien
090905a55c + Fix misplacement of `txp'
+ Document our -CURRENT debugging bits
2001-09-24 03:23:48 +00:00
Chris D. Faulhaber
22374865a2 Update NFS_ROOT comments to reflect the NFSCLIENT option
instead of the depricated NFS option.

Reviewed by:	peter
2001-09-22 19:02:18 +00:00
Peter Wemm
f83fbaf22d Introduce a new option, KVA_SPACE, which can be used to reconfigure
the size of the kernel virtual address space relatively painlessly.
Userland will adapt via the exported kernbase symbol.  Increasing
this causes the user part of address space to reduce.
2001-09-21 06:23:03 +00:00
Peter Wemm
e5a860ebb4 Reserve an extra 16 bytes in case we have to grow the trapframe into
a vm86trapframe for switching to vm86 [unlikely] while exiting.
I lost this when doing the pcb move that went in with the KSE commit.

Reviewed by: jake
2001-09-19 05:44:12 +00:00
Peter Wemm
2f01a0c097 Fix a mistake I made with the pcb movement relative to the stack in the
KSE patch.  We need to leave the 16 bytes here for enabling the trapframe
to be converted to a vm86trapframe if we're switching *to* a vm86 context.
2001-09-19 05:34:12 +00:00
Peter Wemm
eb25edbda3 Cleanup and split of nfs client and server code.
This builds on the top of several repo-copies.
2001-09-18 23:32:09 +00:00
John Baldwin
fd54558a83 - If we ever do the per-cpu KTR stuff, the index won't be volatile as it
will be private to each CPU.
- Re-style(9) the globaldata structures.  There really needs to be a MI
  struct pcpu that has a MD struct mdpcpu member at some point.
2001-09-18 21:46:26 +00:00
John Baldwin
659209e636 Whitespace fixes. 2001-09-18 21:05:04 +00:00
Doug Rabson
3a0b4f259c Fill out some gaps in ia64 DDB support. This involves generalising DDB's
breakpoint handling slightly to cope with the fact that ia64 instructions
are not located on byte boundaries.
2001-09-15 11:06:07 +00:00
Warner Losh
8b8a72ee71 s/thread'/thread's/ 2001-09-14 04:40:44 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Peter Wemm
eb30c1c0b9 Rip some well duplicated code out of cpu_wait() and cpu_exit() and move
it to the MI area.  KSE touched cpu_wait() which had the same change
replicated five ways for each platform.  Now it can just do it once.
The only MD parts seemed to be dealing with fpu state cleanup and things
like vm86 cleanup on x86.  The rest was identical.

XXX: ia64 and powerpc did not have cpu_throw(), so I've put a functional
stub in place.

Reviewed by:	jake, tmm, dillon
2001-09-10 04:28:58 +00:00
Peter Wemm
e11e07928b gcc-3 has objections about the bluetrap6 and bluetrap13 inline asm
functions.  Apparently multi-line string asm arguments are deprecated.
2001-09-10 04:22:20 +00:00
Peter Wemm
660c5377fd Missing part of dillon's coredump commit. cpu_coredump() was still
passing IO_NODELOCKED to vn_rdwr(), this would cause operations on the
unlocked core vnode and softupdates nastiness if an a.out binary cored.
2001-09-08 22:18:58 +00:00
Mike Smith
42df599f7b Now that this code is MD, we don't need the i386 ifdefs. 2001-09-07 03:00:30 +00:00
John Baldwin
df53e91c18 Call sendsig() with the proc lock held and return with it held. 2001-09-06 22:20:41 +00:00
Jonathan Lemon
cfe6cb9694 Remove superfluous statement. 2001-09-05 17:05:19 +00:00
Kazutaka YOKOTA
c395939120 Rework the ISA PnP driver pnp and the PnP resource parser to fix
the following bugs.

- When constructing a resource configuration, respect the order
  in which resource descriptors are read, in order to establish
  the correct mapping between the descriptors and configuration
  registers.
  "Plug and Play ISA Specification, Version 1.0a", Sec 4.6.1, May 5,
  1994.  "Clarifications to the Plug and Play ISA Specification,
  Version 1.0a", Sec 6.2.1, Dec. 10, 1994.

- Do not ignore null (empty) descriptors; they are valid descriptors
  acting as filler.
  "Clarifications to the Plug and Play ISA Specification, Version 1.0a",
  Sec 6.2.1.

- Correctly set up logical device configuration registers for null
  resources.
  "Clarifications to the Plug and Play ISA Specification, Version 1.0a"

- Handle null resources properly in the resource allocator for the
  ISA bus.
2001-09-05 03:54:33 +00:00
David E. O'Brien
1792335469 style(9) the structure definitions. 2001-09-05 01:36:46 +00:00
Mitsuru IWASAKI
db2077f8e1 Reenable RTC interrupts after wakeup. Some laptops have a problem
with system statistics monitoring tools (such as systat, vmstat...)
because of stopping RTC interrupts generation.
Restore all the timers (RTC and i8254) atomically.

Reviewed by:	bde
MFC after:	1 week
2001-09-04 16:02:06 +00:00
Peter Wemm
25ea330aec Mostly cosmetic. Move various variables from .s files to .c files so that
gdb generates debug info for them.
2001-09-04 11:05:33 +00:00
Peter Wemm
cfbf880deb Zap #if 0'ed map init code that got moved to the MI area.
Convert the powerpc tree to use the common code.
2001-09-04 08:42:35 +00:00
Peter Wemm
b53f9c45f9 Nuke #if 0'ed "setredzone()" stub. We never used it, and probably
never will.  I've implemented an optional redzone as part of the KSE
upage breakup.
2001-09-04 08:36:46 +00:00
Kazutaka YOKOTA
bdaeb9cc90 Fix the argument specifier for the PnP BIOS function 2
(PNP_SET_DEVNODE). The second argument is not a segment:offset
pointer, but a 16 bit short.

MFC after:	4 weeks
2001-09-03 03:43:39 +00:00
Peter Wemm
43295941c4 Do a style cleanup pass for the pmap_{new,dispose,etc}_proc() functions
to get them closer to the KSE tree.  I will do the other $machine/pmap.c
files shortly.
2001-08-31 02:28:01 +00:00
Matthew Dillon
356861db03 Remove the MPSAFE keyword from the parser for syscalls.master.
Instead introduce the [M] prefix to existing keywords.  e.g.
MSTD is the MP SAFE version of STD.  This is prepatory for a
massive Giant lock pushdown.  The old MPSAFE keyword made
syscalls.master too messy.

Begin comments MP-Safe procedures with the comment:
/*
 * MPSAFE
 */
This comments means that the procedure may be called without
Giant held (The procedure itself may still need to obtain
Giant temporarily to do its thing).

sv_prepsyscall() is now MP SAFE and assumed to be MP SAFE
sv_transtrap() is now MP SAFE and assumed to be MP SAFE

ktrsyscall() and ktrsysret() are now MP SAFE (Giant Pushdown)
trapsignal() is now MP SAFE (Giant Pushdown)

Places which used to do the if (mtx_owned(&Giant)) mtx_unlock(&Giant)
test in syscall[2]() in */*/trap.c now do not.  Instead they
explicitly unlock Giant if they previously obtained it, and then
assert that it is no longer held to catch broken system calls.

Rebuild syscall tables.
2001-08-30 18:50:57 +00:00
Mike Smith
5f063c7b09 Add ACPI attachments. 2001-08-30 09:17:03 +00:00
Warner Losh
d3b6477a19 It turns out that while Toshiba laptops don't want to route interrupts
multiple times, others do.  The last strategy, which was to assume
that already routed interrupts were good and just return them doesn't
work for some laptops.  So, instead, we have a new strategy: we notice
that we have an interrupt that's already routed.  We go ahead and try
to route it, none the less.  We will assume that it is correctly
routed, even if the route fails.  We still assume that other failures
in the bios32 call are because the interrupt is NOT routed.

Note: some laptops do not support the bios32 interface to PCI BIOS and
we need to call it via the INT 2A interface.  That is another windmill
to till at later.

Also correct a minor typo and minor whitespace nits.

Strong MFC candidate.
2001-08-28 16:35:01 +00:00
Warner Losh
d626906b0c MFS: IRQ ordering, PRVERB and more whining in pcibios_get_version on failure.
Check return value from bios32.

[[ Yes, I was bad and committed this to stable first.  I should have done
   the commit in the other order. ]]
2001-08-27 20:44:38 +00:00
Peter Wemm
9d170964e4 There is nothing more embarresing than having three goes at correcting
typos in the same paragraph.  s/in in/in/

Submitted by:	iedowse
2001-08-27 05:18:12 +00:00
Peter Wemm
76cb0cadf1 Enable hardwiring of things like tunables from embedded enironments
that do not start from loader(8).
2001-08-27 05:11:53 +00:00
Peter Wemm
d675a0adcc I missed a typo in the last commit: s/whach/which/
Submitted by:	bde
2001-08-26 21:55:54 +00:00
Peter Wemm
359ebc389c Argh! Revert accidental commit. 2001-08-25 07:42:27 +00:00
Peter Wemm
547a9e66fd vm_page_zero_idle() is no longer MD. 2001-08-25 04:54:25 +00:00
Julian Elischer
15dac10b05 Add another comment.
check for 'teh's this time..
2001-08-25 02:44:38 +00:00
Peter Wemm
268bdb43f9 Optionize UPAGES for the i386. As part of this I split some of the low
level implementation stuff out of machine/globaldata.h to avoid exposing
UPAGES to lots more places.  The end result is that we can double
the kernel stack size with 'options UPAGES=4' etc.

This is mainly being done for the benefit of a MFC to RELENG_4 at some
point.  -current doesn't really need this so much since each interrupt
runs on its own kstack.
2001-08-25 02:20:02 +00:00
Peter Wemm
61af199168 s/teh/the/ 2001-08-25 02:06:59 +00:00
Julian Elischer
6a9344d45a Add an explanatory note that would have saved me an hour or two
of confusion had it been there when I started reading the code..
2001-08-25 01:16:47 +00:00
John Baldwin
e5dfa86a70 Axe a commented, unused #define related to the old giant lock. 2001-08-24 16:52:31 +00:00
John Baldwin
a0f831f573 Remove references to the old giant kernel lock in various comments. 2001-08-24 16:46:15 +00:00
Peter Wemm
c1c2006ca7 Export the actual KERNBASE to the symbol table. We can use nlist() to get
this without having to second guess it in userland.
2001-08-24 08:29:54 +00:00
Peter Wemm
5897d41109 Move cpu_fxsr definition to C code (so debug info is generated) and where
it is easily #ifdef'ed so that we dont miss unintentional references to it.
2001-08-24 08:27:24 +00:00
Peter Wemm
66875a2aff Fix a comment error that was fixed in the pc98 version. hw.maxmem is
really hw.physmem.
2001-08-23 01:49:12 +00:00
Peter Wemm
9f9360003f Dont add UPAGES to the %cs segment limit. There is nothing there except
page tables.
2001-08-23 01:25:21 +00:00
Peter Wemm
3b703181e3 Dont compile in SSE fxsave/fxrstor instructions if CPU_ENABLE_SSE isn't
active.
2001-08-23 01:03:56 +00:00
Mitsuru IWASAKI
e4e9098988 Move CR4.PGE enabling code after paging is enabled via CR0.PG based on
the description (2.5. CONTROL REGISTERS) of Intel developer's manual at:
ftp://download.intel.com/design/PentiumII/manuals/24319202.pdf

Reviewed by:	peter, bde, tlambert2@mindspring.com
Pointed-out by:	"Shin'ya Kumabuchi" <kumabu@t3.rim.or.jp>
MFC after:	1 week
2001-08-22 15:41:43 +00:00
Matthew Dillon
219d632c15 Move most of the kernel submap initialization code, including the
timeout callwheel and buffer cache, out of the platform specific areas
and into the machine independant area.  i386 and alpha adjusted here.
Other cpus can be fixed piecemeal.

Reviewed by:    freebsd-smp, jake
2001-08-22 04:07:27 +00:00
Peter Wemm
3d6fde76ed Introduce two new sysctl's.. vm.kvm_size and vm.kvm_free. These are
purely informational and can give some advance indications of tuning
problems.  These are i386 only for now as it seems that the i386 is
the only one suffering kvm pressure.
2001-08-22 00:50:46 +00:00
John Baldwin
3a9e0f5bd1 Push down Giant some in trap_pfault() so we don't grab Giant around
trap_fatal() to make restarting from panic's slightly easier.  Before if
one did 'w 0 0' in ddb, the longjmp in ddb inside of trap_fatal() would
result in Giant being held (or recursed one level deeper) which led to
problems later on.  You can now drop to teh debugger, do 'w 0 0', and
continue w/o a problem.
2001-08-21 23:15:25 +00:00
Warner Losh
0b9427de88 The general conesnsus on irc was that pci bios for config registers
and such was just a bad idea and one that users should be forced to
enable if they want it.  This patch introduces a hw.pci.enable_pcibios
tunable for those people.  This does not impact the pcibios interrupt
routing at all.

Approved by: peter, msmith
2001-08-21 07:53:37 +00:00
Matthew Dillon
6db5812aef Fix bug in physmem_est calculation - the kernel_map size was not being
converted into pages.

Fix bug in maxbcache calculation, nbuf must be tested against maxbcache
rather then physmem_est.

Obtained from:	bde
2001-08-21 07:20:06 +00:00
Peter Wemm
573be82757 Detect a certain type of PCIBIOS brain damage. For some reason,
some bios vendors took it apon themselves to "censor" the
host->pci bridges from PCIBIOS callers, even when the caller
explicitly asks for them.  This includes certain Compaq machines
(eg: DL360) and some laptops.

If we detect this, shut down pcibios and revert to using IO
port bashing.

Under -current, apcica does a better job anyway.
2001-08-21 03:10:55 +00:00
Peter Wemm
e8ebc08f80 Make COMPAT_43 optional again. XXX we need COMPAT_FBSD3 etc for this
stuff.
2001-08-21 02:32:59 +00:00
Matthew Dillon
2f9e4e8025 Limit the amount of KVM reserved for the buffer cache and for swap-meta
information.  The default limits only effect machines with > 1GB of ram
and can be overriden with two new kernel conf variables VM_SWZONE_SIZE_MAX
and VM_BCACHE_SIZE_MAX, or with loader variables kern.maxswzone and
kern.maxbcache.  This has the effect of leaving more KVM available for
sizing NMBCLUSTERS and 'maxusers' and should avoid tripups where a sysad
adds memory to a machine and then sees the kernel panic on boot due to
running out of KVM.

Also change the default swap-meta auto-sizing calculation to allocate half
of what it was previously allocating.  The prior defaults were way too high.
Note that we cannot afford to run out of swap-meta structures so we still
stay somewhat conservative here.
2001-08-20 00:41:12 +00:00
Peter Wemm
4faa812afa There is nothing special that requires SSE to be only on 686 class cpus.
This enables 586-only SMP kernels to compile again.

Problem reported by:  Jacek Jedrzejczak <jacol@ids.gda.pl>
2001-08-18 04:04:45 +00:00
David E. O'Brien
589278dbae style(9) and make consistent across platforms 2001-08-16 09:29:35 +00:00
Bill Paul
3708f8da9c Teach bus_dmamem_free() about contigfree(). This is a bit of a hack,
but it's better than the buggy behavior we have now. If we contigmalloc()
buffers in bus_dmamem_alloc(), then we must configfree() them in
bus_dmamem_free(). Trying to free() them is wrong, and will cause
a panic (at least, it does on the alpha.)

I tripped over this when trying to kldunload my busdma-ified if_rl
driver.
2001-08-15 17:26:54 +00:00
John Baldwin
2be7b27a41 Whitespace fixes to make this mostly fit in 80 columns. 2001-08-15 16:57:12 +00:00
Bruce Evans
3d66f80905 Use interrupt gates instead of trap gates for breakpoint and trace
traps, so that ddb can keep control (almost) no matter how it is
entered.  This breaks time-critical interrupts while the system is
stopped in ddb, but I haven't noticed any significant problems except
that applications become confused about the time.  Lost time will be
adjusted for later.  Anyway, the half-baked disabling of interrupts in
Debugger() gives the same problems for the usual way of entering ddb.
2001-08-13 13:22:50 +00:00
Bruce Evans
d072acf902 Removed he BPTTRAP() macro and its use. It was intended for restoring
bug for bug compatibility to ddb trap handlers after fixing the debugger
trap gates to be interrupt gates, but the fix was never committed.  Now
I want the fix to apply to ddb.
2001-08-13 12:42:13 +00:00
Mitsuru IWASAKI
dfc356335a Fix some trivial bugs.
- fix segment limit mis-calculation for GCODE_SEL, GDATA_SEL, GPRIV_SEL,
   LUCODE_SEL and LUDATA_SEL.
 - move `loader(8) metadata' related printf() after cninit().
 - use atop macro (address to pages) for segment limit calculation
   instead of i386_btop macro (bytes to pages).
 - fix style bugs for the declarations of ints.

Reviewed by:    bde, msmith (and arch & audit ML)
2001-08-12 08:37:39 +00:00
John Baldwin
688ebe120c - Close races with signals and other AST's being triggered while we are in
the process of exiting the kernel.  The ast() function now loops as long
  as the PS_ASTPENDING or PS_NEEDRESCHED flags are set.  It returns with
  preemption disabled so that any further AST's that arrive via an
  interrupt will be delayed until the low-level MD code returns to user
  mode.
- Use u_int's to store the tick counts for profiling purposes so that we
  do not need sched_lock just to read p_sticks.  This also closes a
  problem where the call to addupc_task() could screw up the arithmetic
  due to non-atomic reads of p_sticks.
- Axe need_proftick(), aston(), astoff(), astpending(), need_resched(),
  clear_resched(), and resched_wanted() in favor of direct bit operations
  on p_sflag.
- Fix up locking with sched_lock some.  In addupc_intr(), use sched_lock
  to ensure pr_addr and pr_ticks are updated atomically with setting
  PS_OWEUPC.  In ast() we clear pr_ticks atomically with clearing
  PS_OWEUPC.  We also do not grab the lock just to test a flag.
- Simplify the handling of Giant in ast() slightly.

Reviewed by:	bde (mostly)
2001-08-10 22:53:32 +00:00
Peter Wemm
2aca0c28d3 Zap 'ptrace(PT_READ_U, ...)' and 'ptrace(PT_WRITE_U, ...)' since they
are a really nasty interface that should have been killed long ago
when 'ptrace(PT_[SG]ETREGS' etc came along.  The entity that they
operate on (struct user) will not be around much longer since it
is part-per-process and part-per-thread in a post-KSE world.

gdb does not actually use this except for the obscure 'info udot'
command which does a hexdump of as much of the child's 'struct user'
as it can get.  It carries its own #defines so it doesn't break
compiles.
2001-08-08 05:25:15 +00:00
Nate Williams
3633ea98d7 - Removed comment about ThinkPad keyboards from the PCVT line. Any ThinkPad
that needs this probably won't run -current, as it's at least 5 years old.
2001-08-05 21:56:11 +00:00
Jake Burkholder
7e5102989e Use a machine dependent type, Elf_Hashelt, for the elements of the elf
dynamic symbol table buckets and chains.  The sparc64 toolchain uses 32
bit .hash entries, unlike other 64 bits architectures (alpha), which use
64 bit entries.

Discussed with: dfr, jdp
2001-07-31 03:46:39 +00:00
Peter Wemm
0b27d7104f Make PMAP_SHPGPERPROC tunable. One shouldn't need to recompile a kernel
for this, since it is easy to run into with large systems with lots of
shared mmap space.

Obtained from:	yahoo
2001-07-27 01:08:59 +00:00
Peter Wemm
3e02a8711a MASK_FPU_SW didn't do what it was expected to do. 2001-07-26 23:47:04 +00:00
Peter Wemm
bd40659f85 Call the early tunable setup functions as soon as kern_envp is available.
Some things depend on hz being set not long after this.
2001-07-26 23:06:44 +00:00
Bosko Milekic
49f854f926 - Do not handle the per-CPU containers in mbuf code as though the cpuids
were indices in a dense array. The cpuids are a sparse set and treat
  them as such, setting up containers only for CPUs activated during
  mb_init().

- Fix netstat(1) and systat(1) to treat the per-CPU stats area as a sparse
  map, in accordance with the above.

This allows us to properly boot with certain CPUs disactivated. However, if
we later decide to re-activate said CPUs, we will barf until we decide to
implement CPU spinon/spinoff callback hooks to allow for said CPUs' per-CPU
containers to get configured on their activation.

Reported by: mjacob
Partially (sys/ diffs) Submitted by: mjacob
2001-07-26 18:47:46 +00:00
Bill Paul
362c5c1e02 You were knocked senseless by the Boomerang, spun around by the Cyclone,
blown over by the Hurricane and had a house dropped on you by the Tornado.
Now it's time to have your parade rained on by... the Typhoon!

This commit adds driver support for 3Com 3cR990 10/100 ethernet
adapters based on the Typhoon I and Typhoon II chipsets. This is actually
a port of the OpenBSD driver with many hacks by me.

No Virginia, there isn't any support for the hardware crypto yet. However
there is support for TCP/IP checksum offload and VLANs.

Special thanks go to Jason Wright, Aaron Campbell and Theo de Raadt for
squeezing enough info out of 3Com to get this written, and for doing
most of the hard work.

Manual page is included. Compiled as a module and included in GENERIC.
2001-07-23 20:44:54 +00:00
Mitsuru IWASAKI
56d8cb57b9 Don't do sleep state transition if specified sleep state is not
supported by the system.
2001-07-22 19:13:54 +00:00
Mike Smith
bfae45aa43 Convert from acpi_strerror() to AcpiFormatException()
Fix dangling include of the dear departed acpi_ecreg.h
2001-07-21 10:24:37 +00:00
Mike Smith
9d839ea8e4 Update the OSD module to match the ACPI CA 20010717 import.
Submitted by:	"Grover, Andrew" <andrew.grover@intel.com> (OsdHardware.c)
2001-07-21 04:10:01 +00:00
Takanori Watanabe
6161544ca7 Add ACPI S2-S4BIOS Suspend/Resume code.
Some problems may remain.

Reviewed by:iwasaki
2001-07-20 06:07:34 +00:00
Brian S. Dean
3ad234d4ef swtch.s: During context save, use the correct bit mask for clearing
the non-reserved bits of dr7.

         During context restore, load dr7 in such a way as to not
         disturb reserved bits.

machdep.c: Don't explicitly disallow the setting of the reserved bits
           in dr7 since we now keep from setting them when we load dr7
           from the PCB.

           This allows one to write back the dr7 value obtained from
           the system without triggering an EINVAL (one of the
           reserved bits always seems to be set after taking a trace
           trap).

MFC after:	7 days
2001-07-19 04:37:27 +00:00
Kris Kennaway
a081aa7d72 Quiet a variable format-string warning.
MFC after:    1 week
2001-07-19 02:16:24 +00:00
Tor Egge
e55bc0a096 The per-cpu temporary buffers are not needed since the pcb_save areas have
the proper alignment.  Change dummy variable in npxinit from stack to bss
to ensure proper alignment.

Reviewed by:	bde
2001-07-17 13:06:47 +00:00
Tor Egge
a5d00fe997 Use PCPU_GET(cpuid) instead of curproc->p_oncpu.
Reviewed by:	peter
2001-07-16 06:00:23 +00:00
John Baldwin
ce11a18f0e Fix MCOUNT_ENTER() so it actually compiles in the profiling case.
Pointy hat to:	me
Submitted by:	Danny J. Zerkel <dzerkel@columbus.rr.com>
2001-07-14 21:40:53 +00:00
Dima Dorfman
2e1b1231fc `pcn' supports AMD Am79C97x cards, not Am79C79x cards.
PR:		28946
Submitted by:	Ryuichiro Imura <imura@ryu16.org>
2001-07-13 13:34:08 +00:00
Maxim Sobolev
2ac3543b03 Unbroke kernel if I686_CPU is not defined. 2001-07-13 11:23:06 +00:00
Peter Wemm
28f74b2003 The #define for pcb_savefpu seems to do more harm than good. 2001-07-12 12:48:08 +00:00
Peter Wemm
ad1b7ffaee Fix another missed pcb_savefpu reference (inside NPX_DEBUG) 2001-07-12 12:21:53 +00:00
Peter Wemm
6a25c625b2 Forgot this fix from another tree. make enable_sse() a real prototype. 2001-07-12 11:54:11 +00:00
Peter Wemm
aa32e9a994 Move init_sse() out of the "GenuineIntel" section, my AthlonMP system
has it, for example, and it works fine.
2001-07-12 06:36:03 +00:00
Peter Wemm
9d146ac5d1 Activate SSE/SIMD. This is the extra context switching support that
we are required to do if we let user processes use the extra 128 bit
registers etc.

This is the base part of the diff I got from:
  http://www.issei.org/issei/FreeBSD/sse.html
I believe this is by:  Mr. SUZUKI Issei <issei@issei.org>
SMP support apparently by: Takekazu KATO <kato@chino.it.okayama-u.ac.jp>
Test code by: NAKAMURA Kazushi <kaz@kobe1995.net>, see
  http://kobe1995.net/~kaz/FreeBSD/SSE.en.html

I have fixed a couple of style(9) deviations.  I have some followup
commits to fix a couple of non-style things.
2001-07-12 06:32:51 +00:00
Brian S. Dean
17bbfb5897 Add 'hwatch' and 'dhwatch' ddb commands analogous to 'watch' and
'dwatch'.  The new commands install hardware watchpoints if supported
by the architecture and if there are enough registers to cover the
desired memory area.

No objection by: audit@, hackers@

MFC after: 2 weeks
2001-07-11 03:15:25 +00:00
Julian Elischer
0b1ae8097d A set of changes to reduce the number of include files the kernel
takes from /usr/include. I cannot check them on alpha.. (will try beast)

Briefly looked at by: Warner Losh <imp@harmony.village.org>
2001-07-08 04:56:07 +00:00
Matthew Dillon
7197571105 Move vm_page_zero_idle() from machine-dependant sections to a
machine-independant source file, vm/vm_zeroidle.c.  It was exactly the
same for all platforms and updating them all was getting annoying.
2001-07-05 01:32:42 +00:00
Matthew Dillon
6d03d577a5 Reorg vm_page.c into vm_page.c, vm_pageq.c, and vm_contig.c (for contigmalloc).
Also removed some spl's and added some VM mutexes, but they are not actually
used yet, so this commit does not really make any operational changes
to the system.

vm_page.c relates to vm_page_t manipulation, including high level deactivation,
activation, etc...  vm_pageq.c relates to finding free pages and aquiring
exclusive access to a page queue (exclusivity part not yet implemented).
And the world still builds... :-)
2001-07-04 23:27:09 +00:00
Matthew Dillon
0cddd8f023 With Alfred's permission, remove vm_mtx in favor of a fine-grained approach
(this commit is just the first stage).  Also add various GIANT_ macros to
formalize the removal of Giant, making it easy to test in a more piecemeal
fashion. These macros will allow us to test fine-grained locks to a degree
before removing Giant, and also after, and to remove Giant in a piecemeal
fashion via sysctl's on those subsystems which the authors believe can
operate without Giant.
2001-07-04 16:20:28 +00:00
Thomas Moestl
948d3d9484 Make the code to read the kernel message buffer via sysctl machine-
independent and rename the corresponding sysctls from machdep.msgbuf and
machdep.msgbuf_clear (i386 only) to kern.msgbuf and kern.msgbuf_clear.
2001-07-03 19:44:07 +00:00
Mitsuru IWASAKI
6cee406625 Add Transmeta Crusoe LongRun support.
Submitted by:	Tamotsu HATTORI <athlete@kta.att.ne.jp>
Reviewed by:	arch@ folks
MFC after:	1 week
2001-07-03 10:03:24 +00:00
John Baldwin
aa5d2a75d8 Quiet warning by removing ast() prototype.
Forgotten by:	jhb (me)
2001-07-03 05:11:55 +00:00
John Baldwin
d2a5bcc3d3 Allow Giant to be recursed when a process terminates. 2001-07-03 05:09:48 +00:00
Brooks Davis
53dab5fe7b gif(4) and stf(4) modernization:
- Remove gif dependencies from stf.
 - Make gif and stf into modules
 - Make gif cloneable.

PR:		kern/27983
Reviewed by:	ru, ume
Obtained from:	NetBSD
MFC after:	1 week
2001-07-02 21:02:09 +00:00
Warner Losh
1b0a8621e6 Repo copy i8237.h to dev/ic so we can get rid of some of the final vestiges
of includes of i386 files from non-i386 ports.
2001-06-30 05:29:11 +00:00
John Baldwin
7aa7260e4a Move ast() and userret() to sys/kern/subr_trap.c now that they are MI. 2001-06-29 19:51:37 +00:00
Warner Losh
9a44bb7681 Remove cruft from old bus. 2001-06-29 18:13:30 +00:00
John Baldwin
6be523bca7 Add a new MI pointer to the process' trapframe p_frame instead of using
various differently named pointers buried under p_md.

Reviewed by:	jake (in principle)
2001-06-29 11:10:41 +00:00
John Baldwin
92809bc001 Grab Giant around trap_pfault() for now. 2001-06-29 04:18:10 +00:00
John Baldwin
25142c5ea1 Get kernel profiling on SMP systems closer to working by replacing the
mcount spin mutex with a very simple non-recursive spinlock implemented
using atomic operations.
2001-06-28 04:03:29 +00:00
Brian S. Dean
6eda157eaa Provide access to the IA32 hardware debug registers from the ddb
kernel debugger.  Proper use of these registers allows setting
hardware watchpoints for use in kernel debugging.

MFC after: 2 weeks
2001-06-28 02:08:13 +00:00
KATO Takenori
5d2f190a3b Recognize FC-PGA2 Pentium III (Tualatin). 2001-06-26 03:02:30 +00:00
Doug Rabson
b5da4ce935 Add code to detect Transmeta Crusoe cpus. 2001-06-25 15:11:33 +00:00
John Baldwin
06c836bbca - Grab the proc lock around CURSIG and postsig(). Don't release the proc
lock until after grabbing the sched_lock to avoid CURSIG racing with
  psignal.
- Don't grab Giant for addupc_task() as it isn't needed.

Reported by:	tegge (signal race), bde (addupc_task a while back)
2001-06-22 23:05:11 +00:00
Peter Wemm
1a6d55cecd Make the hw.physmem and hw.usermem variables unsigned so that they dont
come up as negative on machines with >2GB ram.
2001-06-22 22:07:01 +00:00
John Baldwin
ce1a1f42fb Initialize mutexes needed early on all in the same place so that the
startup routine more closely matches that of alpha and ia64.  At some
point the common mutexes shared across all platforms probably should move
into sys/kern_mutex.c.
2001-06-18 19:19:38 +00:00
John Baldwin
0865563a93 - Add support for decoding syscall names. (Brought over from the new alpha
trace code that was brought over from NetBSD.)
- Check for "syscall_with_err_pushed" as the label prior to a syscall trap
  frame rather than "Xlcall_syscall" and "Xint0x80_syscall".  We don't
  have a valid trapframe during the short range of code that those two
  symbols now cover.
- Simplify db_next_frame() to avoid duplicating the code for the different
  trap frame types.
- Don't try to trace a swapped-out process.  (Brought over from NetBSD via
  the new alpha trace code.)
2001-06-18 19:17:30 +00:00
John Baldwin
3128cdd847 Include sys/pcpu.h to get the prototype for globaldata_register() to quiet
a warning.
2001-06-18 19:06:14 +00:00
Yoshihiro Takahashi
6c551e8d24 Don't assume that resource type is ioport and rid equal 0. 2001-06-17 13:33:59 +00:00
Alexander Langer
90f76f2df0 Fix "alignemnt" typo. 2001-06-16 15:28:28 +00:00
Peter Wemm
17e904e08d Fix warnings:
908: warning: long unsigned int format, unsigned int arg (arg 3)
887: warning: `timezero' defined but not used
2001-06-15 07:53:20 +00:00
Peter Wemm
2398f0cd1d Hints overhaul:
- Replace some very poorly thought out API hacks that should have been
  fixed a long while ago.
- Provide some much more flexible search functions (resource_find_*())
- Use strings for storage instead of an outgrowth of the rather
  inconvenient temporary ioconf table from config().  We already had a
  fallback to using strings before malloc/vm was running anyway.
2001-06-12 09:40:04 +00:00
David E. O'Brien
f9b58b41a3 Fix style of defines. 2001-06-09 05:21:17 +00:00
John Baldwin
262c9f8a3b Don't hold sched_lock across addupc_task().
Reported by:	David Taylor <davidt@yadt.co.uk>
Submitted by:	bde
2001-06-06 00:57:24 +00:00
Poul-Henning Kamp
0d31cbfab7 Properly wrap mtx_intr_enable() macro in "do $bla while (0)" 2001-06-02 08:17:42 +00:00
Thomas Moestl
d279178df7 Clean up the code exporting interrupt statistics via sysctl a bit:
- move the sysctl code to kern_intr.c
- do not use INTRCNT_COUNT, but rather eintrcnt - intrcnt to determine
  the length of the intrcnt array
- move the declarations of intrnames, eintrnames, intrcnt and eintrcnt
  from machine-dependent include files to sys/interrupt.h
- remove the hw.nintr sysctl, it is not needed.
- fix various style bugs

Requested by:	bde
Reviewed by:	bde (some time ago)
2001-06-01 13:23:28 +00:00
John Baldwin
5eb6e27905 Quiet warnings by adding a prototype for set_user_ldt_rv() and making it
conditional on #ifdef SMP.
2001-05-30 21:57:52 +00:00
John Baldwin
1acf256d96 We can't grab the sched_lock in set_user_ldt() because when it is called
from cpu_switch(), curproc has been changed, but the sched_lock owner will
not be updated until we return to mi_switch(), thus we deadlock against
ourselves.  As a workaround, push the acquire and release of sched_lock out
to the callers of set_user_ldt().  Note that we can't use a mtx_assert() in
set_user_ldt for the same reason.

Sleuting by:	tmm
Tested by:	tmm, dougb
2001-05-30 14:35:22 +00:00
Matt Jacob
ecf33dd4c4 move wx to be part of miibus requiring chipsets 2001-05-30 03:20:52 +00:00
Poul-Henning Kamp
888a8e3567 Remove MFS options from all example kernel configs. 2001-05-29 18:49:06 +00:00
Jordan K. Hubbard
caff01c276 Remove pcm hints here now that it's gone from GENERIC.
Reminded-by:	bde
2001-05-26 08:04:34 +00:00
Jordan K. Hubbard
62d1937cec Take pcm (audio) back out of GENERIC; there appears to be some
concensus, most notably among the maintainers, that it's better
loaded as a module.

Finally-pushed-over-the-edge-by-the-anguished-cries-of:	rwatson
2001-05-25 17:55:39 +00:00
John Baldwin
0dfefe6829 Don't acquire Giant just to call trap_fatal(), we are about to panic
anyway so we'd rather see the printf's then block if the system is
hosed.
2001-05-23 22:58:09 +00:00
Alfred Perlstein
1f50e112b6 pmap_mapdev needs the vm_mtx, aquire it if not already locked 2001-05-23 22:17:28 +00:00
Alfred Perlstein
b99c886a7f lock vm while playing with pmap 2001-05-23 22:13:58 +00:00
Bruce Evans
1c1771cb5b Convert npx interrupts into traps instead of vice versa. This is much
simpler for npx exceptions that start as traps (no assembly required...)
and works better for npx exceptions that start as interrupts (there is
no longer a problem for nested interrupts).

Submitted by:	original (pre-SMPng) version by luoqi
2001-05-22 21:20:49 +00:00
John Baldwin
c4f96c5f83 Remove a few more spl's I missed earlier.
Reported by:	Michael Harnois <mdharnois@home.com>
Pointy hat:	me
2001-05-22 00:09:26 +00:00
John Baldwin
9dceb26b23 Sort includes. 2001-05-21 18:52:02 +00:00
John Baldwin
d8aad40c88 Axe unneeded spl()'s. 2001-05-21 18:30:50 +00:00
Bruce Evans
17008f5343 Throw away the complications in npxsave() and their infrastructure.
npxsave() went to great lengths to excecute fnsave with interrupts
enabled in case executing it froze the CPU.  This case can't happen,
at least for Intel CPU/NPX's.  Spurious IRQ13's don't imply spurious
freezes.  Anyway, the complications were usually no-ops because IRQ13
is not used on i486's and newer CPUs, and because SMPng broke them in
rev.1.84.  Forcible enabling of interrupts was changed to
write_eflags(old_eflags), but since SMPng usually calls npxsave() from
cpu_switch() with interrupts disabled, write_eflags() usually just
kept interrupts disabled.
2001-05-20 20:04:40 +00:00
Bruce Evans
7010278935 Use a critical region to protect almost everything in npxinit().
npxinit() didn't have the usual race because it doesn't save to curpcb,
but it may have had a worse form of it since it uses the npx when it
doesn't "own" it.  I'm not sure if locking prevented this.  npxinit()
is normally caled with the proc lock but not sched_lock.

Use a critical region to protect pushing of curproc's npx state to
curpcb in npxexit().  Not doing so was harmless since it at worst
saved a wrong state to a dieing pcb.
2001-05-20 18:05:44 +00:00
Bruce Evans
c2b095ab72 Use a critical region to protect saving of the npx state in savectx().
Not doing this was fairly harmless because savectx() is only called
for panic dumps and the bug could at worse reset the state.

savectx() is still missing saving of (volatile) debug registers, and
still isn't called for core dumps.
2001-05-20 16:51:08 +00:00
Alfred Perlstein
2395531439 Introduce a global lock for the vm subsystem (vm_mtx).
vm_mtx does not recurse and is required for most low level
vm operations.

faults can not be taken without holding Giant.

Memory subsystems can now call the base page allocators safely.

Almost all atomic ops were removed as they are covered under the
vm mutex.

Alpha and ia64 now need to catch up to i386's trap handlers.

FFS and NFS have been tested, other filesystems will need minor
changes (grabbing the vm lock when twiddling page properties).

Reviewed (partially) by: jake, jhb
2001-05-19 01:28:09 +00:00
John Baldwin
7a08bae6ec - Move the setting of bootverbose to a MI SI_SUB_TUNABLES SYSINIT.
- Attach a writable sysctl to bootverbose (debug.bootverbose) so it can be
  toggled after boot.
- Move the printf of the version string to a SI_SUB_COPYRIGHT SYSINIT just
  afer the display of the copyright message instead of doing it by hand in
  three MD places.
2001-05-17 22:28:46 +00:00
John Baldwin
ddfbf9d259 - Axe the IMEN_BITS and APIC_IMEN_BITS constants.
- Add back in a definition of NHWI which is preferred over ICU_LEN.

Submitted by:	bde
2001-05-17 22:24:17 +00:00
John Baldwin
8bd57f8fc2 Remove unneeded includes of sys/ipl.h and machine/ipl.h. 2001-05-15 23:22:29 +00:00
John Baldwin
4966b0e91c Move the definition of HWI_MASK to the i386/isa/icu.h header right next to
the definition of ICU_LEN.
2001-05-15 23:11:48 +00:00
John Baldwin
d008c720b6 - Use ICU_LEN rather than NHWI for the size of the array of ithreads.
- Remove unneeded include of sys/ipl.h.
2001-05-15 22:31:08 +00:00
Poul-Henning Kamp
ab9f3b292e Convert DEVFS from an "opt-in" to an "opt-out" option.
If for some reason DEVFS is undesired, the "NODEVFS" option is
needed now.

Pending any significant issues, DEVFS will be made mandatory in
-current on july 1st so that we can start reaping the full
benefits of having it.
2001-05-13 20:52:40 +00:00
Bruce Evans
a4b8c657a3 Use a critical region to protect pushing of the parent's npx state to the
pcb for fork().  It was possible for the state to be saved twice when an
interrupt handler saved it concurrently.  This corrupted (reset) the state
because fnsave has the (in)convenient side effect of doing an implicit
fninit.  Mundane null pointer bugs were not possible, because we save to
an "arbitrary" process's pcb and not to the "right" place (npxproc).

Push the parent's %gs to the pcb for fork().  Changes to %gs before
fork() were not preserved in the child unless an accidental context
switch did the pushing.  Updated the list of pcb contents which is
supposed to inhibit bugs like this.  pcb_dr*, pcb_gs and pcb_ext were
missing.  Copying is correct for pcb_dr*, and pcb_ext is already
handled specially (although XXX'ly).

Reducing the savectx() call to an npxsave() call in rev.1.80 was a
mistake.  The above bugs are duplicated in many places, including in
savectx() itself.

The arbitraryness of the parent process pointer for the fork()
subroutines, the pcb pointer for savectx(), and the save87 pointer
for npxsave(), is illusory.  These functions don't work "right" unless
the pointers are precisely curproc, curpcb, and the address of npxproc's
save87 area, respectively, although the special context in which they
are called allows savectx(&dumppcb) to sort of work and npxsave(&dummy)
to work.  cpu_fork() just doesn't work unless the parent process
pointer is curproc, or the caller has pushed %gs to the pcb, or %gs
happens to already be in the pcb.
2001-05-13 07:44:14 +00:00
Daniel Eischen
10c90bba3b Revert part of last commit. Instead of using %fs for KSD/TSD, we'll
follow Linux' convention and use %gs.  This adds back the setting of
%fs to a sane value in sendsig().  The value of %gs remains preserved
to whatever it was in user context.
2001-05-12 22:54:53 +00:00
John Baldwin
1efb92b7ca Simplify the vm fault trap handling code a bit by using if-else instead of
duplicating code in the then case and then using a goto to jump around
the else case.
2001-05-11 23:50:08 +00:00
Mike Smith
85fab96387 Un-swap irq/link byte values so that printf works. 2001-05-11 04:52:29 +00:00
John Baldwin
ba228f6d96 - Split out the support for per-CPU data from the SMP code. UP kernels
have per-CPU data and gdb on the i386 at least needs access to it.
- Clean up includes in kern_idle.c and subr_smp.c.

Reviewed by:	jake
2001-05-10 17:45:49 +00:00
John Baldwin
df4d012b9a - Use sched_lock and critical regions to ensure that LDT updates are thread
safe from preemption and concurrent access to the LDT.
- Move the prototype for i386_extend_pcb() to <machine/pcb_ext.h>.

Reviewed by:	silence on -hackers
2001-05-10 17:03:03 +00:00
Daniel Eischen
46022f276b When setting up the frame to invoke a signal handler, preserve the
%fs and %gs registers instead of setting them to known sane values.
%fs is going to be used for thread/KSE specific data by the new
threads library; we'll want it to be valid inside of signal handlers.

According to bde, Linux preserves the state of %fs and %gs when setting
up signal handlers, so there is precedent for doing this.

The same changes should be made in the Linux emulator, but when made,
they seem to break (at least one version of) the IBM JDK for Linux
(reported by drew).

Approved by:	bde
2001-05-06 02:13:12 +00:00
Bruce Evans
79d4e25bea Fixed panics in npx exception handling. When using IRQ13 exception
handling, SMPng always switches the npx context away from curproc
before calling the handler, so the handler always paniced.  When using
exception 16 exception handling, SMPng sometimes switches the npx
context away from curproc before calling the handler, so the handler
sometimes paniced.  Also, we didn't lock the context while using it,
so we sometimes didn't detect the switch and then paniced in a less
controlled way.

Just lock the context while using it, and return without doing anything
except clearing the busy latch if the context is not for curproc.  This
fixes the exception 16 case and makes the IRQ13 case harmless.  In both
cases, the instruction that caused the exception is restarted and the
exception repeats.  In the exception 16 case, we soon get an exception
that can be handled without doing anything special.  In the IRQ13 case,
we get an easy to kill hung process.
2001-05-02 13:06:58 +00:00
Mark Murray
fb919e4d5a Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
other "system" header files.

Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.

Sort sys/*.h includes where possible in affected files.

OK'ed by:	bde (with reservations)
2001-05-01 08:13:21 +00:00
Greg Lehey
60fb0ce365 Revert consequences of changes to mount.h, part 2.
Requested by:	bde
2001-04-29 02:45:39 +00:00
John Baldwin
4d4bc9acc6 Add in a missing call to forward_hardclock() in the SMP case.
Submitted by:	bde
2001-04-28 01:37:44 +00:00
John Baldwin
6caa8a1501 Overhaul of the SMP code. Several portions of the SMP kernel support have
been made machine independent and various other adjustments have been made
to support Alpha SMP.

- It splits the per-process portions of hardclock() and statclock() off
  into hardclock_process() and statclock_process() respectively.  hardclock()
  and statclock() call the *_process() functions for the current process so
  that UP systems will run as before.  For SMP systems, it is simply necessary
  to ensure that all other processors execute the *_process() functions when the
  main clock functions are triggered on one CPU by an interrupt.  For the alpha
  4100, clock interrupts are delievered in a staggered broadcast fashion, so
  we simply call hardclock/statclock on the boot CPU and call the *_process()
  functions on the secondaries.  For x86, we call statclock and hardclock as
  usual and then call forward_hardclock/statclock in the MD code to send an IPI
  to cause the AP's to execute forwared_hardclock/statclock which then call the
  *_process() functions.
- forward_signal() and forward_roundrobin() have been reworked to be MI and to
  involve less hackery.  Now the cpu doing the forward sets any flags, etc. and
  sends a very simple IPI_AST to the other cpu(s).  AST IPIs now just basically
  return so that they can execute ast() and don't bother with setting the
  astpending or needresched flags themselves.  This also removes the loop in
  forward_signal() as sched_lock closes the race condition that the loop worked
  around.
- need_resched(), resched_wanted() and clear_resched() have been changed to take
  a process to act on rather than assuming curproc so that they can be used to
  implement forward_roundrobin() as described above.
- Various other SMP variables have been moved to a MI subr_smp.c and a new
  header sys/smp.h declares MI SMP variables and API's.   The IPI API's from
  machine/ipl.h have moved to machine/smp.h which is included by sys/smp.h.
- The globaldata_register() and globaldata_find() functions as well as the
  SLIST of globaldata structures has become MI and moved into subr_smp.c.
  Also, the globaldata list is only available if SMP support is compiled in.

Reviewed by:	jake, peter
Looked over by:	eivind
2001-04-27 19:28:25 +00:00
Jake Burkholder
7a72decc2e Remove a leading underscore that prevented I386_CPU kernels from
compiling.

Submitted by:	Alexander N. Kabaev <ak03@gte.com>
PR:		kern/26858
2001-04-26 13:57:03 +00:00
Greg Lehey
d98dc34f52 Correct #includes to work with fixed sys/mount.h. 2001-04-23 09:05:15 +00:00
John Baldwin
242d02a13f Make the ap_boot_mtx mutex static. 2001-04-20 01:09:05 +00:00
John Baldwin
882796f8c2 Split up the db_printf's for 'show pcpu' so that we only output at most one
line for each db_printf().  Also, just use spaces to line the columns up
rather than trying to be fancy with tabs.
2001-04-20 01:08:27 +00:00
Warner Losh
a5e25da40d Back out 1.103. It wasn't approved by the owner of the file and
introduced style bugs.

Submited by: bde
2001-04-18 20:57:43 +00:00
John Baldwin
abd9053ee4 Blow away the panic mutex in favor of using a single atomic_cmpset() on a
panic_cpu shared variable.  I used a simple atomic operation here instead
of a spin lock as it seemed to be excessive overhead.  Also, this can avoid
recursive panics if, for example, witness is broken.
2001-04-17 04:18:08 +00:00
David E. O'Brien
c5e70d92ce Turn on kernel debugging support (DDB, INVARIANTS, INVARIANT_SUPPORT, WITNESS)
by default while SMPng is still being developed.

Submitted by:	jhb
2001-04-15 19:37:28 +00:00
John Baldwin
adccbaa77d People are still having problems with i586_* on UP machines and SMP
machines, so just hack it to disable them for now until it can be fixed.

Inspired by hair pulling of:	asmodai
2001-04-13 17:14:53 +00:00
John Baldwin
2fea957dc5 Rename the IPI API from smp_ipi_* to ipi_* since the smp_ prefix is just
"redundant noise" and to match the IPI constant namespace (IPI_*).

Requested by:	bde
2001-04-11 17:06:02 +00:00
John Baldwin
5f76d89870 Remove constants defining the bitmasks of the old giant kernel lock. 2001-04-10 22:22:01 +00:00
John Baldwin
8f3b4b873c Remove the old APIC I/O higher level IPI API in favor of the newer MI
API for IPI's that isn't tied to the Intel APIC.  MD code can still use
the apic_ipi() function or dink with the apic directly if needed to send
MD IPI's.
2001-04-10 22:18:21 +00:00
John Baldwin
ca7ef17c08 Remove the BETTER_CLOCK #ifdef's. The code is on by default and is here
to stay for the foreseeable future.

OK'd by:	peter (the idea)
2001-04-10 21:34:13 +00:00
John Baldwin
6a0fa9a023 Add an MI API for sending IPI's. I used the same API present on the alpha
because:
 - it used a better namespace (smp_ipi_* rather than *_ipi),
 - it used better constant names for the IPI's (IPI_* rather than
   X*_OFFSET), and
 - this API also somewhat exists for both alpha and ia64 already.
2001-04-10 21:04:32 +00:00
John Baldwin
7d8e84e364 - One can now specify the decimal pid of a process to trace as a parameter.
Since pid's are not in the kernel address space, this doesn't conflict
  with the funcionality of specifying an arbitrary frame pointer to the
  trace command.
- If the first function of a backtrace maps to fork_trampoline, then this
  is a newly fork'd process that has not been executed yet, so just print
  out the first frame and then return for that case.
- Lower the default count from 65535 to 1024.  ddb doesn't trace into
  userland, and if the stack gets hosed and starts looping it's less
  annoying.
2001-04-09 21:43:45 +00:00
John Baldwin
ed55a19f67 Add a new ddb command 'show pcpu' which lists some of the per-cpu data.
Specifically, the cpuid, curproc, curpcb, npxproc, and idleproc members.
Also, if witness is compiled into the kernel, then a list of all the spin
locks held by this CPU is displayed.  By default the information for the
current CPU is displayed, but a decimal cpu id may be specified as a
parameter to obtain information on a specific CPU.
2001-04-06 21:41:52 +00:00