Commit Graph

640 Commits

Author SHA1 Message Date
Alan Cox
1f54526952 o Complete the locking of page queue accesses by vm_page_unwire().
o Assert that the page queues lock is held in vm_page_unwire().
 o Make vm_page_lock_queues() and vm_page_unlock_queues() visible
   to kernel loadable modules.
2002-07-13 20:55:21 +00:00
Jonathan Mini
08b38412c8 Add additional cred_free_thread() calls that I had missed the first time.
Pointed out by:	jhb
2002-07-13 04:36:50 +00:00
Jake Burkholder
d73b19ef9d Use a fixed address for KERNBASE, so it doesn't change if the size of KVA
is increased.  Its confusing for all the kernel addresses to change, and
doesn't serve much purpose as far as conserving address space.
2002-07-13 03:29:10 +00:00
Jake Burkholder
5d5d3157fb Identify UltraSPARC-III and UltraSPARC-III+ cpus. 2002-07-13 03:23:29 +00:00
John Baldwin
33d7ad1abe Set the thread state of the newly chosen to run thread to TDS_RUNNING in
choosethread() in MI C code instead of doing it in in assembly in all the
various cpu_switch() functions.  This fixes problems on ia64 and sparc64.

Reviewed by:	julian, peter, benno
Tested on:	i386, alpha, sparc64
2002-07-12 18:34:22 +00:00
Thomas Moestl
a935ed4fae When sending cache flushing IPIs, don't try to IPI the triggering CPU
itself; this causes undefined behaviour on UltraSPARCs. In particular,
the interrupt packet data words will not necessarily be delivered
correctly, which would result in a crash.
This bug also caused the cache-flushing work to be done twice on the
triggering CPU (when it did not cause crashes).

Reviewed by:	jake
2002-07-12 16:26:49 +00:00
John Baldwin
78dee2638a thread_exit() requires PROC_LOCK to be held, so lock it. 2002-07-11 22:13:33 +00:00
Mike Barcroft
f889202ba4 Remove label_t and physadr, which seem to have never been used in
FreeBSD.

Submitted by:	bde
2002-07-10 15:47:59 +00:00
Mike Barcroft
ba5fe51088 Move __offsetof() macro from <machine/ansi.h> to <sys/cdefs.h>. It's
hardly MD, since all our platforms share the same macro.  It's not
really compiler dependent either, but this helps in reducing
<machine/ansi.h> to only type definitions.
2002-07-08 16:43:35 +00:00
Peter Wemm
a58b3a6878 Add a special page zero entry point intended to be called via the single
threaded VM pagezero kthread outside of Giant.  For some platforms, this
is really easy since it can just use the direct mapped region.  For others,
IPI sending is involved or there are other issues, so grab Giant when
needed.

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

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

Turn the idle zeroing back on since it can now actually do something useful
outside of Giant in many cases.
2002-07-08 04:24:26 +00:00
Peter Wemm
a136efe9b6 Collect all the (now equivalent) pmap_new_proc/pmap_dispose_proc/
pmap_swapin_proc/pmap_swapout_proc functions from the MD pmap code
and use a single equivalent MI version.  There are other cleanups
needed still.

While here, use the UMA zone hooks to keep a cache of preinitialized
proc structures handy, just like the thread system does.  This eliminates
one dependency on 'struct proc' being persistent even after being freed.
There are some comments about things that can be factored out into
ctor/dtor functions if it is worth it.  For now they are mostly just
doing statistics to get a feel of how it is working.
2002-07-07 23:05:27 +00:00
Peter Wemm
61695d7ac8 Fix (s/proc/thread/) some typos in two panic messages. 2002-07-07 22:50:41 +00:00
Peter Wemm
7b719ec324 Back out proc part of last commit. UMA manages the thread cache only, and
we just have to deal with the kstack when told to.  We do not have a
UMA-managed cache for the proc struct and its associated upage yet.  So,
go back to the old lazy mechanism.  Note that if UMA destroys pages that
used to contain proc structures, we'll lose the corresponding upage
forever.  (zones never did this - once a page was allocated, it stayed
attached to the proc zone forever)
2002-07-05 01:27:35 +00:00
Peter Wemm
0b306e55c6 Take a shot at implementing changes from i386/pmap.c rev 1.328-1.331. 2002-07-05 00:38:43 +00:00
Mike Barcroft
a19d429398 Since printf(3) now supports the `j' conversion specifier, use that
when printing intmax_t and uintmax_t.

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

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

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

	NOTE: this is still Beta code, and contains lots of debugging stuff.
	expect slight instability in signals..
2002-06-29 17:26:22 +00:00
Julian Elischer
44990b8cb8 Add files that are new for KSE. 2002-06-29 07:04:59 +00:00
Jake Burkholder
eecc66a7d2 Fix a deletion during traversal tailq bug. 2002-06-29 06:37:24 +00:00
David E. O'Brien
4f1daba8df Do NOT enable ATA_STATIC_ID -- cmd646 controller will be !ata2!,
and you will not mount an ATA /:
	mountroot> ufs:/ad0a
	Mounting root from ufs:/ad0a
	setrootbyname failed
	ffs_mountroot: can't find rootvp
2002-06-29 04:42:03 +00:00
Peter Wemm
160554fbf4 Remove a couple of __P() stragglers. 2002-06-29 02:32:34 +00:00
Maxime Henrion
0dc658c141 GENERIC now builds with -Werror, so remove NO_WERROR.
Approved by:	jake
2002-06-27 14:43:27 +00:00
Jake Burkholder
218fd301cd pmap_kremove can no longer be used to remove the magic device mappings
installed with pmap_kenter_flags, since the physical addresses may not
have an associated vm_page.  Add a function to do this.

Tested by:	Tomi Vainio <Tomi.Vainio@Sun.COM>
2002-06-25 15:13:09 +00:00
Jake Burkholder
8ba3d077ff Add an MD callout like cpu_exit, but which is called after sched_lock is
obtained, when all other scheduling activity is suspended.  This is needed
on sparc64 to deactivate the vmspace of the exiting process on all cpus.
Otherwise if another unrelated process gets the exact same vmspace structure
allocated to it (same address), its address space will not be activated
properly.  This seems to fix some spontaneous signal 11 problems with smp
on sparc64.
2002-06-24 15:48:02 +00:00
Jonathan Mini
01ad8a53db Remove unused diagnostic function cread_free_thread().
Approved by:	alfred
2002-06-24 06:22:00 +00:00
Maxime Henrion
584884ca0c Add a missing prototype to fix a warning. 2002-06-23 21:29:00 +00:00
Maxime Henrion
a3dc999469 Include machine/critical.h to get missing prototypes.
Reviewed by:	tmm
2002-06-23 14:38:41 +00:00
Jake Burkholder
f5885ad905 Fix a bug related to marking pages virtually uncacheable due to illegal
dcache aliasing.  A page that already had more than 1 mapping of the
same virtual colour would not be correctly uncached.

Noticed by:	Artur Grabowski <art@openbsd.org>
2002-06-22 23:55:15 +00:00
Maxime Henrion
ea8be05a6f Warning fix.
Reviewed by:	peter
2002-06-22 20:46:59 +00:00
Jake Burkholder
4e4c1993b9 {f,s}usword -> {f,s}uword16. Implement {f,s}uword32.
Requested by:	peter
2002-06-20 20:41:57 +00:00
Peter Wemm
b23619e02a Deorbit suibyte(). It was only used for split address space systems
for supporting UIO_USERISPACE (ie: it wasn't used).
2002-06-20 07:13:35 +00:00
Peter Wemm
2f9267ec23 Move the "- 1" into the RQB_FFS(mask) macro itself so that
implementations can provide a base zero ffs function if they wish.
This changes
  #define RQB_FFS(mask) (ffs64(mask))
  foo = RQB_FFS(mask) - 1;
to
  #define RQB_FFS(mask) (ffs64(mask) - 1)
  foo = RQB_FFS(mask);
On some platforms we can get the "- 1" for free, eg: those that use the
C code for ffs64().

Reviewed by:	jake (in principle)
2002-06-20 06:21:20 +00:00
David E. O'Brien
10f80f494c Sync with i386. 2002-06-18 01:11:04 +00:00
Jake Burkholder
e3957e9d67 Add constants for the min and max prom addresses. Use these instead of
magic numbers.  Use stxa_sync instead of stxa; membar #Sync; to ensure
that no instruction is placed between the two.  This can cause random
corruption even though interrupts are already disabled.
2002-06-17 15:44:10 +00:00
Thomas Moestl
5fb49f9fd6 Add PCI bus enumeration and latency timer setup to the sparc64 MD PCI
code. Both tasks are not always performed completely by the firmware.
The former is required to get some e450 models to boot; the latter fixes
the repeated fifo underruns with hme(4)s and gem(4)s observed on some
machines (and probably performance problems with other peripherals as
well).
2002-06-12 19:20:57 +00:00
Jake Burkholder
25be55bdc3 Add code to drop to ddb when a process gets a fatal signal that usually
suggests kernel bugs (4, 10, 11).  Add a sysctl debug.debugger_on_signal
which turns this on and off, default off.
2002-06-08 07:36:28 +00:00
Jake Burkholder
1b5e0369d7 Re-enable SMP by default. 2002-06-08 07:22:36 +00:00
Jake Burkholder
6b3d95e2cf Remove test code. 2002-06-08 07:21:52 +00:00
Jake Burkholder
f5ee661c9b Remove code from trap which is handled in userland now. 2002-06-08 07:17:19 +00:00
Jake Burkholder
acb941ef8f Fix bizarre SMP problems. The secondary cpus sometimes start up with junk
in their tlb which the prom doesn't clear out, so we have to do so manually
before mapping the kernel page table or the cpu can hang due various
conditions which cause undefined behaviour from the tlb.
2002-06-08 07:10:28 +00:00
Jake Burkholder
a682b4e6e7 Comment out options SMP for now until I figure out what's going on. 2002-06-07 15:36:42 +00:00
John Baldwin
99cca534f3 - Fixup / remove obsolete comments.
- ktrace no longer requires Giant so do ktrace syscall events before and
  after acquiring and releasing Giant, respectively.
- For i386, ia32 syscalls on ia64, powerpc, and sparc64, get rid of the
  goto bad hack and instead use the model on ia64 and alpha were we
  skip the actual syscall invocation if error != 0.  This fixes a bug
  where if we the copyin() of the arguments failed for a syscall that
  was not marked MP safe, we would try to release Giant when we had
  not acquired it.
2002-06-07 05:47:35 +00:00
Jake Burkholder
a41c3573fa Use pmap_map instead of pmap_kenter to map the message buffer. Its too
early for pmap_kenter.
2002-06-05 15:36:57 +00:00
Jake Burkholder
e7dc92f0f9 Bump TSB_PAGES_SHIFT to 4. Less sucks too much. 2002-06-04 19:40:45 +00:00
Doug Rabson
99bd783419 Move the definition of ElfN_Hashelt to common headers. The only platform
which has a different definition for this is alpha.
2002-05-30 08:32:18 +00:00
Jake Burkholder
626d38b529 Forgot to commit this file. Catch up to loader->kernel abi changes. 2002-05-29 19:48:03 +00:00
Jake Burkholder
f7e0360261 Forward declare struct trapframe. 2002-05-29 19:25:14 +00:00
Jake Burkholder
819c7d570b Remove BOOTP_WIRED_TO= since I keep forgetting to take this out and screwing
over people with gems.
2002-05-29 19:22:17 +00:00
Jake Burkholder
a2b4810ee7 Don't try to flush illegal alises from the data cache in vmapbuf and
vunmapbuf, this is handled by pmap now.
2002-05-29 06:16:47 +00:00
Jake Burkholder
20bd6675fb Add an MD page flag for tracking if a page is cacheable or not, so that
we don't flush all mappings of a physical page in order to make it
virtually cachable again, if it is already cachable.
2002-05-29 06:12:13 +00:00
Jake Burkholder
468303c500 Remove an unused variable. 2002-05-29 06:10:37 +00:00
Jake Burkholder
1982efc5c2 Merge the code in pv.c into pmap.c directly. Place all page mappings onto
the pv lists in the vm_page, even unmanaged kernel mappings.  This is so
that the virtual cachability of these mappings can be tracked when a page
is mapped to more than one virtual address.  All virtually cachable
mappings of a physical page must have the same virtual colour, or illegal
alises can be created in the data cache.  This is a bit tricky because we
still have to recognize managed and unmanaged mappings, even though they
are all on the pv lists.
2002-05-29 06:08:45 +00:00
Jake Burkholder
e793e4d0b3 Add pv list linkage and a pmap pointer to struct tte. Remove separately
allocated pv entries and use the linkage in the tte for pv operations.
2002-05-29 05:56:05 +00:00
Jake Burkholder
35738638d6 Use a contrived 'tlb_entry' structure for passing the mappings for the
kernel text and data from the loader to the kernel, so that the tte format
is not part of the loader->kernel ABI.
2002-05-29 05:49:59 +00:00
Jake Burkholder
b08270ba0f Remove pmap.pm_pvlist and make the functions that use it no-ops. These are
all optimizations for architectures which have large sparse page tables,
and/or can't put the pv linkage inside of the page table entries.
2002-05-29 05:24:16 +00:00
Doug Rabson
396a429cfd Add declarations of suword32 and suword64. Add implementations of one or
the other (or both) to all the platforms. Similar for fuword32 and
fuword64.
2002-05-26 16:03:13 +00:00
Jake Burkholder
4d574756ac Convert the interrupt queue from an array to a linked list. Implement
intr_dequeue in asm so that it can easily be modified to do light weight
context switching.
2002-05-25 02:39:28 +00:00
Jake Burkholder
0679dc5f91 Try to handle "double faults" occuring at more trap levels (ie 4 :)). 2002-05-25 01:45:11 +00:00
Jake Burkholder
597e13d8c5 Minor style. 2002-05-25 01:44:08 +00:00
Jake Burkholder
d2ac231616 Make the run queue parameters machine dependent. Optimize 64 bit
architectures by using a 64 bit word for the bit array which keeps
track of non-empty queues.

Reviewed by:	peter
2002-05-25 01:12:23 +00:00
Jake Burkholder
2dbb68a495 Update tsb_tte_enter prototype per tsb.c rev 1.20. 2002-05-21 02:15:37 +00:00
Jake Burkholder
38c04dc163 Rewrite pmap_enter to avoid copying ttes in all cases.
Pass the tte data to tsb_tte_enter instead of a whole tte, also to avoid
copying.
2002-05-21 02:14:11 +00:00
Jake Burkholder
f631b588f5 Redefine the tte accessor macros to take a pointer to a tte, instead of the
value of the tag or data field.
Add macros for getting the page shift, size and mask for the physical page
that a tte maps (which may be one of several sizes).
Use the new cache functions for invalidating single pages.
2002-05-21 00:29:02 +00:00
Jake Burkholder
b78213fb0b Add SMP aware cache flushing functions, which operate on a single physical
page.  These send IPIs if necessary in order to keep the caches in sync on
all cpus.
2002-05-20 16:30:47 +00:00
Jake Burkholder
856316e9c6 Forward declare struct trapframe. 2002-05-20 16:12:35 +00:00
Jake Burkholder
f7c81a5182 De-inline the tlb demap functions. These were so big that gcc3.1 refused
to inline them anyway.  ;)
2002-05-20 16:10:17 +00:00
Eric Melville
13d362233e Banish "priviledged" from kernel source. 2002-05-16 22:41:48 +00:00
David E. O'Brien
5aecc48bb0 style sync with other platforms. 2002-05-15 16:40:25 +00:00
Poul-Henning Kamp
6380601f64 Move MI stuff out of MD param.h files.
It can all still be overridden in the MD files should need suddenly arise.
2002-05-14 20:35:29 +00:00
Jake Burkholder
20409ddf22 Fix IF_SEXT(val, 32). The constants need to have type long to
handle size > 16.
2002-05-13 04:26:38 +00:00
Jake Burkholder
c0db03795f Add another copy of the ia64 dump_machdep.c. 2002-05-13 02:39:19 +00:00
Jake Burkholder
63fd3b0af9 Enable KTR_TRAP by default. 2002-05-12 18:10:48 +00:00
Jake Burkholder
025c284b8d Add a support macro to convert the 5-bit packed register field of
a floating point instruction into a 6-bit register number for
double and quad arguments.
Make use of the new INSFPdq_RN macro where apporpriate; this
is required for correctly handling the "high" fp registers
(>= %f32).
Fix a number of bugs related to the handling of the high registers
which were caused by using __fpu_[gs]etreg() where __fpu_[gs]etreg64()
should be used (the former can only access the low, single-precision,
registers).

Submitted by:	tmm
2002-05-11 21:20:05 +00:00
David E. O'Brien
fc336fdfbb Gcc 3.1 varargs support. 2002-05-10 02:02:54 +00:00
David E. O'Brien
3393d027da Comment two values I was looking at for GDB. 2002-05-09 02:07:51 +00:00
Jake Burkholder
51ceaefac4 Remove unneeded include. 2002-05-08 04:21:58 +00:00
Jake Burkholder
ea4ad4bb29 Make a macro for the guts of tl0_immu_miss, like dmmu_miss and prot.
Rearrange things slightly so that the contents of the tag access
register are read and restored outside of the macros.  The intention
is to pass the page size to look up as an argument to the macros.
2002-05-08 04:14:16 +00:00
Juli Mallett
ea0b7a7699 Typo fix: detects -> detect.
Reviewed by:	phk
2002-05-03 17:59:25 +00:00
Jake Burkholder
e289cb8fe7 Add support for an alternate signal trampoline; add a sysarch call to register
an alternate trampoling with the kernel.
2002-04-29 18:08:26 +00:00
Peter Wemm
db17c6fc07 Tidy up some loose ends.
i386/ia64/alpha - catch up to sparc64/ppc:
- replace pmap_kernel() with refs to kernel_pmap
- change kernel_pmap pointer to (&kernel_pmap_store)
  (this is a speedup since ld can set these at compile/link time)
all platforms (as suggested by jake):
- gc unused pmap_reference
- gc unused pmap_destroy
- gc unused struct pmap.pm_count
(we never used pm_count - we track address space sharing at the vmspace)
2002-04-29 07:43:16 +00:00
Marcel Moolenaar
d297ad160e Don't use the symbol name to lookup the symbol value when we can use
the symbol index defined by the relocation. The elf_lookup() support
function is to be used by elf_reloc() when symbol lookups need to be
done. The elf_lookup() function operates on the symbol index and
will do a symbol name based lookup when such is required, otherwise
it uses the symbol index directly. This solves the problem seen on
ia64 where the symbol hash table does not contain local symbols and
a symbol name based lookup would fail for those symbols.

Don't pass the symbol name to elf_reloc(), as it isn't used any more.
2002-04-25 01:22:16 +00:00
Jake Burkholder
11dcdc976b Avoid using pmap_kenter "early", since it may need to dink with vm_page
structures, which may not be setup yet.  Minor cleanups.
2002-04-21 22:57:42 +00:00
Jake Burkholder
9ba847abf3 MFi386 1.222. Remove vm_map_growstack and acquisition and release of Giant
from trap_pfault.
2002-04-20 17:28:08 +00:00
Jake Burkholder
d1fef1792c Check the alignment of the stack pointer before copying in windows from the
user stack in response to a failed window fill, allowing the process to be
killed if its wrong.  This caused user programs which misalign their stack
pointer to get stuck in an infinite loop at the kernel-userland boundary,
which is mostly harmless.

The same thing causes a fatal RED state exception on OpenBSD and probably
NetBSD.

Inspired by:	art@openbsd.org
2002-04-20 16:23:52 +00:00
Jake Burkholder
bb52b4f3fc Fix off by one errors in cache flush calls (mostly harmless). 2002-04-20 15:58:40 +00:00
Jake Burkholder
26956cba94 Add needed include of tick.h. 2002-04-20 15:52:53 +00:00
Robert Watson
91e007dc70 Since WITNESS doesn't just do mutexes, remove "mutex" from the WITNESS
comment in GENERIC config files of appropriate platforms.  For whatever
reason, powerpc didn't use WITNESS in GENERIC.
2002-04-18 03:44:44 +00:00
Peter Wemm
1a87a0da66 Pass vm_page_t instead of physical addresses to pmap_zero_page[_area]()
and pmap_copy_page().  This gets rid of a couple more physical addresses
in upper layers, with the eventual aim of supporting PAE and dealing with
the physical addressing mostly within pmap.  (We will need either 64 bit
physical addresses or page indexes, possibly both depending on the
circumstances.  Leaving this to pmap itself gives more flexibilitly.)

Reviewed by:	jake
Tested on:	i386, ia64 and (I believe) sparc64. (my alpha was hosed)
2002-04-15 16:00:03 +00:00
David E. O'Brien
9b019189c4 option<space><tab> 2002-04-15 09:21:51 +00:00
Alan Cox
80eef17ba9 o Remove vm_map_growstack() and useracc() from sendsig(). Copyout() and
suword() will automatically grow the stack if needed.
 o Add a comment that osigreturn() and sigreturn() are MPSAFE.
2002-04-13 19:17:49 +00:00
Mike Barcroft
795aff0ed9 Include <sys/cdefs.h> for definition of __BSD_VISIBLE.
Pointy hat to:	mike
2002-04-12 15:56:45 +00:00
Mike Barcroft
49285705cc Remove the hack for segsz_t from <sys/types.h>; use the normal
_BSD_FOO_T_ method for defining segsz_t.
2002-04-10 15:58:13 +00:00
Mike Barcroft
7f0f1cfd57 Add manifest constants: _LITTLE_ENDIAN, _BIG_ENDIAN, _PDP_ENDIAN, and
_BYTE_ORDER.  These are far more useful than their non-underscored
equivalents as these can be used in restricted namespace environments.
Mark the non-underscored variants as deprecated.
2002-04-10 14:39:14 +00:00
Jake Burkholder
22d67801e6 Forgot these files in previous commit to frame.h. Also add needed include
of machine/emul.h.
2002-04-09 01:43:07 +00:00
Jake Burkholder
d134a05e90 Oops. machine/emul.h didn't exist yet. 2002-04-09 01:42:19 +00:00
Jake Burkholder
82436f1067 Rename some fields in struct frame to be compatible with NetBSD/OpenBSD,
and add some compatibility defines.  Add fields for ins and locals to
struct reg also for the same reason; these aren't filled in yet because
getting at those registers sucks and I'd rather not save them in the
trapframe just for this.  Reorder struct reg to be ABI compatible as
well.  Add needed include of machine/emul.h.

This gets pmdb (poor man's debugger) from OpenBSD mostly compiling but it
doesn't work yet :(
2002-04-09 00:57:23 +00:00
Jake Burkholder
530faa0f9e Add device se (commented out, most people won't find this useful yet). 2002-04-09 00:37:33 +00:00
Jake Burkholder
16b7e738de Enable device pass. 2002-04-08 23:21:31 +00:00
Poul-Henning Kamp
67ec58a802 GC the "dumplo" variable, which is no longer used.
A lot of sys/*/*/machdep.c seems not to be.
2002-04-07 21:01:37 +00:00
Jake Burkholder
c8eabf779c Enable isp and ispfw. Remove the nonexistant SUN_DISKLABEL and
ATA_ENABLE_BUSMATER.
2002-04-06 09:33:24 +00:00
Jake Burkholder
274ae7b653 Provide an implementation of KTR_CPU that doesn't use pcpu, so we don't
crash and burn if its not setup yet.  Add timestamp, cpu, and (fake) file
and line recording to the asm version of CTR.
2002-04-06 08:40:59 +00:00
Jake Burkholder
c4c03d1766 Remove invalid KASSERTS. 2002-04-06 08:21:43 +00:00
Thomas Moestl
6ed31e9112 Add missing header for the eeprom driver frontents. 2002-04-05 02:40:54 +00:00
Thomas Moestl
36c009a428 Add MD frontents for the mk48txx driver, ported from NetBSD, and remove
stub implementations of inittodr() and resettodr(), now that the MI ones
are used.
2002-04-04 23:58:50 +00:00
John Baldwin
6008862bc2 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
Bruce Evans
79065dba2a Moved signal handling and rescheduling from userret() to ast() so that
they aren't in the usual path of execution for syscalls and traps.
The main complication for this is that we have to set flags to control
ast() everywhere that changes the signal mask.

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

Submitted by:	luoqi (first part only, long ago, reorganized by me)
Reminded by:	dillon
2002-04-04 17:49:48 +00:00
Ruslan Ermilov
12c79eb288 Dike out a highly insecure UCONSOLE option.
TIOCCONS must be able to VOP_ACCESS() /dev/console to succeed.

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

Tested on:	alpha, i386
2002-04-02 22:19:16 +00:00
Thomas Moestl
816663a0b3 Fix crashes that would happen when more than one 4MB page was used to
hold the kernel text, data and loader metadata by not using a fixed slot
to store the TSB page(s) into. Enter fake 8k page entries into the kernel
TSB that cover the 4M kernel page(s), sot that pmap_kenter() will work
without having to treat these pages as a special case.

Problem reported by:	mjacob, obrien
Problem spotted and 4M page handling proposed by:       jake
2002-04-02 17:50:13 +00:00
Thomas Moestl
5320165b09 Remove the superfluous second argument from the IOTSBSLOT() macro. 2002-04-02 17:41:06 +00:00
Thomas Moestl
910d801895 Lower UPA_MEMSTART to 0x1c000000000. This is required for some larger
Enterprise machines.
2002-04-02 17:38:52 +00:00
Thomas Moestl
bca61dd95d Set mp_maxid so that UMA works with SMP.
Submitted by:	jake
2002-04-02 17:37:06 +00:00
Thomas Moestl
3191e556ea Do not try to set up the PCI bus B error interrupt on "sabre"s, since
it is only available on "psycho"s. The same applies to the power
management interrupt, which is not enabled by default though.
2002-04-02 17:27:35 +00:00
Thomas Moestl
3d6d9df323 Remove a debugging panic that was triggered when a resource that was out
of range was tried to be allocated; just return failure instead.
2002-04-02 17:23:45 +00:00
Matthew Dillon
182da8209d Stage-2 commit of the critical*() code. This re-inlines cpu_critical_enter()
and cpu_critical_exit() and moves associated critical prototypes into their
own header file, <arch>/<arch>/critical.h, which is only included by the
three MI source files that need it.

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

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

Reviewed by:	jake
2002-04-01 23:51:23 +00:00
Jake Burkholder
d86b2422b9 Move the CTASSERT macro from MD code to systm.h alongside KASSERT so other
code can use it.  This takes a single constant argument and fails to compile
if it is 0 (false).  The main application of this is to make assertions about
structure sizes at compile time, in order to validate assumptions made in
other code.  Examples:

CTASSERT(sizeof(struct foo) == FOO_SIZEOF);
CTASSERT(sizeof(struct foo) == (1 << FOO_SHIFT));

Requested by:	jhb, phk
2002-04-01 21:55:00 +00:00
Jake Burkholder
60a57b73ef ktr changes to improve performance and make writing a userland utility to
dump the trace buffer feasible.
- Remove KTR_EXTEND.  This changes the format of the trace entries when
  activated, making writing a userland tool which is not tied to a specific
  kernel configuration difficult.
- Use get_cyclecount() for timestamps.  nanotime() is much too heavy weight
  and requires recursion protection due to ktr traces occuring as a result
  of ktr traces.  KTR_VERBOSE may still require recursion protection, which
  is now conditional on it.
- Allow KTR_CPU to be overridden by MD code.  This is so that it is possible
  to trace early in startup before pcpu and/or curthread are setup.
- Add a version number for the ktr interface.  A userland tool can check this
  to detect mismatches.
- Use an array for the parameters to make decoding in userland easier.
- Add file and line recording to the non-extended traces now that the extended
  version is no more.

These changes will break gdb macros to decode the extended version of the
trace buffer which are floating around.  Users of these macros should either
use the show ktr command in ddb, or use the userland utility which can be run
on a core dump.

Approved by:	jhb
Tested on:	i386, sparc64
2002-04-01 05:35:26 +00:00
Poul-Henning Kamp
8d19a26558 Centralize the "bootdev" and "dumpdev" variables. They are still pretty
bogus all things considered, but at least now they don't camouflage as
being MD variables.
2002-03-31 07:15:28 +00:00
Alan Cox
af3e811fd3 Correct a comment: sendsig() calls the MI vm_map_growstack() but
the corresponding comment refers to a MD grow_stack() that doesn't exist.
2002-03-30 20:58:08 +00:00
Jake Burkholder
d0ce9a7e07 Remove abuse of intr_disable/restore in MI code by moving the loop in ast()
back into the calling MD code.  The MD code must ensure no races between
checking the astpening flag and returning to usermode.

Submitted by:	peter (ia64 bits)
Tested on:	alpha (peter, jeff), i386, ia64 (peter), sparc64
2002-03-29 16:35:26 +00:00
David E. O'Brien
d8738722bd Don't be too fancy with null'ed out functions.
Requested by:	jake
2002-03-28 04:33:51 +00:00
David E. O'Brien
838e4a7d9d Add sysbeep() for the msmith RAID drivers. 2002-03-28 04:19:16 +00:00
David E. O'Brien
ae7c70d595 style(9)
Approved by:	jake
2002-03-28 02:54:44 +00:00
Jeff Roberson
f22a4b62f5 Add a new mtx_init option "MTX_DUPOK" which allows duplicate acquires of locks
with this flag.  Remove the dup_list and dup_ok code from subr_witness.  Now
we just check for the flag instead of doing string compares.

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

Approved by:	jhb
2002-03-27 09:23:41 +00:00
Jake Burkholder
fb893e9c13 Fix style bugs. 2002-03-27 06:50:34 +00:00
Jake Burkholder
3d58262f2f Fix breakage. 2002-03-27 06:45:48 +00:00
Matthew Dillon
d74ac6819b Compromise for critical*()/cpu_critical*() recommit. Cleanup the interrupt
disablement assumptions in kern_fork.c by adding another API call,
cpu_critical_fork_exit().  Cleanup the td_savecrit field by moving it
from MI to MD.  Temporarily move cpu_critical*() from <arch>/include/cpufunc.h
to <arch>/<arch>/critical.c (stage-2 will clean this up).

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

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

Reviewed by:	core
Approved by:	core
2002-03-27 05:39:23 +00:00
Thomas Moestl
1ca3bc9097 Add missing includes for the KTRACE case. 2002-03-25 04:54:19 +00:00
Thomas Moestl
6267df8595 Add missing declarations. 2002-03-25 04:53:18 +00:00
Thomas Moestl
2ef66f9259 Make this compile (submitted by jake), add a missing include. 2002-03-25 04:38:48 +00:00
Thomas Moestl
937b1ef9e2 Remove second copy of iommu_decode_fault() which I accidentially added.
Pointy hat to:	tmm
2002-03-25 04:34:52 +00:00
David E. O'Brien
c543d983fa Guard against redefining __gnuc_va_list. 2002-03-24 11:25:46 +00:00
Thomas Moestl
e8e2c56650 Revamp the busdma implementation a bit:
- change the IOMMU support code so that it supports overcommittting the
  available DVMA memory, while still allocating as lazily as possible.
  This is achieved by limiting the preallocation, and deferring the
  allocation to map load time when it fails. In the latter case, the
  DVMA memory reserved for unloaded maps can be stolen to free up enough
  memory for loading a map.
- allow NULL settings in the method tables, and search the parent tags
  until an appropriate implementation is found. This allows to remove some
  kluges in the old implementation.
2002-03-24 02:50:53 +00:00
Thomas Moestl
494fde77c9 Fix sparc64_bus_mem_unmap() to pass the right address to kmem_free(). 2002-03-24 02:33:09 +00:00
Thomas Moestl
464ae30ee6 Make the OpenFirmware interrupt mapping code more generic, to reduce
the bus-dependent code and to be able to support more systems. The core
of the new code is mostly obtained from NetBSD.
Kluge the interrupt routing methods of the psycho and apb drivers so
that an intline of 0 can be handled for now; real routing is still not
possible (all intline registers are preinitialized instead); this will
require a sparc64-specific adaption of the driver for generic PCI-PCI
bridges with a custom routing method to work right.
2002-03-24 02:11:06 +00:00
Thomas Moestl
1734bea4fb Map the device memory belonging to resources of type SYS_RES_MEMORY into
KVA upon activation so that rman_get_virtual() works as expected.
2002-03-24 01:51:29 +00:00
Thomas Moestl
4b5504494d Add code to print the fault virtual address for uncorrectable DMA errors
caused by IOMMU misses to aid debugging. This will only work on
UltraSPARC-IIi and IIe.
2002-03-23 20:42:23 +00:00
Thomas Moestl
d1e39d7347 De-__P(), de-K&R, remove superfluous comments and prototypes, some
style fixes. No functional changes.
2002-03-23 20:27:32 +00:00
Thomas Moestl
8d515e67fa De-K&R. 2002-03-23 20:22:19 +00:00
Thomas Moestl
bbe4a6c452 Fix syscall ktraceing. 2002-03-23 20:11:38 +00:00
Thomas Moestl
676c54ffe6 Make this compile without options DDB; use intr_disable() instead of
fiddling with PSTATE_IE manually.
2002-03-23 20:09:48 +00:00
Thomas Moestl
69f2effbd9 Decruft some #if 0'ed code. 2002-03-23 20:05:42 +00:00
Thomas Moestl
bc4e9bed7c Add PCIfunctions 2 and 3 of the PCIO2 chip to the intpin quirk table. 2002-03-23 20:04:10 +00:00
Jake Burkholder
f4db8e245f Machine must be non-static for COMPAT_43 to compile. This is used in bsd/os
1.x compatibility code, which I'm sure we all use every day.
2002-03-23 17:13:45 +00:00
Jake Burkholder
b7cbb37042 Cleanup the trace back routine slightly. Print the leaf return value so
that traps inside of leaf functions are less confusing.  Add a function
to print a non-symbolic trace of the user stack.
2002-03-23 17:04:41 +00:00
Jake Burkholder
c8c751181e Sync with other arches; add bloat. 2002-03-23 16:55:37 +00:00
Jake Burkholder
f1bb97a884 Fix a deadlock condition with tlb shootdown ipi delivery. Since ipis are
not blocked by raising the pil, a reciever may be interrupted while holding
a spinlock.  If the sender does not defer interrupts throughout the entire
operation it may be interrupted and try to acquire a spinlock held by a
reciever, leading to a deadlock due to the synchronization used by the
ipi handlers themselves.

Submitted by:	tmm
2002-03-23 04:20:00 +00:00
Jake Burkholder
44a7aea1d7 Backout intrusive ktr traces in tlb fault handlers which have served their
purpose.
2002-03-23 03:25:09 +00:00
David E. O'Brien
439a4003ab ASM versions of __FBSDID. 2002-03-23 02:01:27 +00:00