Commit Graph

1885 Commits

Author SHA1 Message Date
Mike Smith
287e61c39f Presently there is only one `currentldt' variable for all cpus
in a SMP system. Unexpected things could happen if each cpu
        has a different ldt setting and one cpu tries to use value
        of currentldt set by another cpu.

        The fix is to move currentldt to the per-cpu area. It includes
        patches I filed in PR i386/6219 which are also user ldt related.

PR:		i386/7591, i386/6219
Submitted by:	Luoqi Chen <luoqi@watermarkgroup.com>
1998-08-18 07:47:12 +00:00
Bruce Evans
2d2f8ae7ad Fixed nonsense overflow checking (checking that a long variable is less
than INT_MAX after it has possibly overflowed).

Removed an unused variable and its associated 2 style bugs.

Removed unused includes.
1998-08-17 17:28:10 +00:00
Dag-Erling Smørgrav
d08b9c139f Enable kernel dumps on SLICE systems. 1998-08-16 11:27:19 +00:00
John Polstra
317c91f4d4 Make ELF kernels build again. 1998-08-16 04:19:03 +00:00
Bruce Evans
86a14a7a0a Use [u]intptr_t instead of [u_]long for casts between pointers and
integers.  Don't forget to cast to (void *) as well.
1998-08-16 01:21:52 +00:00
Bruce Evans
69ed480f48 pmap.c:
Cast pointers to (vm_offset_t) instead of to (u_long) (as before) or to
(uintptr_t)(void *) (as would be more correct).  Don't cast vm_offset_t's
to (u_long) just to do arithmetic on them.

mp_machdep.c:
Cast pointers to (uintptr_t) instead of to (u_long).  Don't forget
to cast pointers to (void *) first or to recover from integral
possible integral promotions, although this is too much work for
machine-dependent code.

vm code generally avoids warnings for pointer vs long size mismatches
by using vm_offset_t to represent pointers; pmap.c often uses plain
`unsigned int' instead of vm_offset_t and didn't use u_long elsewhere,
but this style was messed up by code apparently imported from mp_machdep.c.
1998-08-16 00:41:40 +00:00
Bruce Evans
160bd4c62f Oops, the printf format error fixes confused curp->area with a pointer. 1998-08-15 22:42:20 +00:00
Doug Rabson
7032ad107e Protect all modifications to v_numoutput with splbio(). 1998-08-13 08:09:08 +00:00
Bruce Evans
13950bd2ed Don't configure compatibility code for pre-Lite2 mount() calls by
default.  This code should go away soon.
1998-08-12 20:17:42 +00:00
Doug Rabson
a2c99e3e72 Modify the internal interfaces to the kernel linker to make it possible
for DDB to use its symbol tables.
1998-08-12 08:44:21 +00:00
Bruce Evans
18c5a6c435 Implemented dynamic registration of software interrupt handlers. Not
used yet.

Use dummy SWI handlers to avoid some checks for null pointers.
1998-08-11 15:08:13 +00:00
Bruce Evans
c41141b002 Fixed the formatting of some tables (mainly the one produced by ps
in ddb) which I broke by changing %8[l]x to %8p.  Hacked the central
printf routine to not add an "0x" prefix for %p formats if the field
width is nonzero.  The tables are still horribly misformatted on
64-bit machines.

Use %p instead of %8p to print pointers when the field width isn't
important.
1998-08-10 14:27:34 +00:00
Poul-Henning Kamp
22126f4208 The machine dependent disk slice manager does not recognize
DOS partition type 15 (Extended DOS, LBA) as a container for
DOS logical volumes, so the appropriate slices (e.g. sd1s5)
are not initialized.

PR:		7549
PR:		4120
Reviewed by:	phk
Submitted by:	Jim Mattson <jmattson@sonic.net>
1998-08-10 07:22:14 +00:00
Doug Rabson
d474eaaa5f Protect all modifications to paging_in_progress with splvm(). The i386
managed to avoid corruption of this variable by luck (the compiler used a
memory read-modify-write instruction which wasn't interruptable) but other
architectures cannot.

With this change, I am now able to 'make buildworld' on the alpha (sfx: the
crowd goes wild...)
1998-08-06 08:33:19 +00:00
Bruce Evans
6360628342 Removed unused function hzto(). 1998-08-05 18:06:40 +00:00
David Greenman
760c5490ee Move assignment of cur_rlp to after the acquisition of the list lock.
PR:	7496
Submitted by:	Stefan Eggers <seggers@semyam.dinoco.de>
1998-08-05 14:06:04 +00:00
Poul-Henning Kamp
205d5ed6ff remove nonsense code.
PR:		7482
Reviewed by:	phk
Submitted by:	Stefan Eggers <seggers@semyam.dinoco.de>
1998-08-04 09:21:04 +00:00
Bruce Evans
34e9dea435 Added a flags arg to dsopen() and updated drivers. The DSO_ONESLICE
and DSO_NOLABELS flags prevent searching for slices and labels
respectively.  Current drivers don't set these flags.  When
DSO_NOLABELS is set, the in-core label for the whole disk is cloned
to create an in-core label for each slice.  This gives the correct
result (a good in-core label for the compatibility slice) if
DSO_ONESLICE is set or only one slice is found, but usually gives
broken labels otherwise, so DSO_ONESLICE should be set if DSO_NOLABELS
is set.
1998-07-30 15:16:06 +00:00
Doug Rabson
8a8a13c8f0 Only access an int for READU/WRITEU since that is what ptrace is declared to
return.
1998-07-29 18:41:30 +00:00
Doug Rabson
a9d81f7c5c Default to FreeBSD if no brand detected. This makes life easier when
bootstrapping from NetBSD/alpha.
1998-07-29 18:39:35 +00:00
Bruce Evans
d974cf4dda Fixed printf format errors. 1998-07-29 17:38:14 +00:00
Bruce Evans
f9a9c96c25 Centralized and optimized handling of large sectors. Centralized
checking of transfer sizes and alignments.

Old version tested with 2K-sectors on od disks by: Shunsuke Akiyama
<akiyama@kme.mei.co.jp>.
1998-07-29 11:15:54 +00:00
Bruce Evans
ea0823f2c9 Use the slice-relative blkno in all parts of the label write
protection checks.  Using the partition-relative blkno in some
parts broke the write protection for partitions at unusual
offsets (only for partitions at offset 1 on i386's).
1998-07-29 08:24:23 +00:00
Joerg Wunsch
57308494ec Make the logging of abnormally exiting processes optional by a sysctl.
PR:		kern/1711
Submitted by:	Nick Sayer <nsayer@kfu.com>
1998-07-28 22:34:12 +00:00
Bruce Evans
1733a6c1df Set bp->b_resid for failed transfers in dscheck(). This is the
best place to set it, and the wd and wfd strategy routines don't
set it (for failed transfers) because they expect dscheck() to
initialize everything necessary.  dscheck() has always set B_ERROR,
but this is not quite sufficient, because b_resid is used by physio()
to decide how much of a B_ERROR'ed i/o was done.
1998-07-28 19:39:09 +00:00
Bruce Evans
aa6db4230d Used daddr_t's, not ints, to store disk block numbers. Updated printf
formats and args to match.  Fixed old printf format errors (all related;
most were hidden by calling printf indirectly).

This change somehow avoids compiler bugs for 64-bit longs on i386's,
although it increases the number of 64-bit calculations.
1998-07-28 18:25:51 +00:00
Bruce Evans
bc9e7c3b42 Fixed double counting of runtime after a process exits. The last
timeslice of the exiting process was counted for both the exiting
process and the next process to run if the next process runs
immediately.

Broken in:	mostly in kern_clock.c rev.1.70 (1998/05/28)
1998-07-27 19:16:21 +00:00
David Greenman
01ddfa33e6 Only call m_reclaim() if M_WAIT since calling it from an interrupt can
cause problems.
PR:	7403
1998-07-27 03:59:48 +00:00
Bruce Evans
f69c53b019 Don't pass the label to diskerr(), since the label is being constructed
and may be invalid.  In particular, d_secpercyl may be 0, and diskerr()
divides by it.
1998-07-25 16:35:06 +00:00
Doug Rabson
0bf030847d Add some very simple support for a compiled in (from config(8)) resource
database.
1998-07-22 08:35:52 +00:00
Bruce Evans
7cb743ae28 Initialize more defaults for the in-core label for the whole disk.
Callers only need to initialize d_secperunit now, but should
initialize d_type (to reduce the IDE/SCSI confusion), d_typename
(put the disk model in it) and geometry info (if it isn't completely
ficticious).  Callers will soon need to initialize d_secsize.
1998-07-20 14:35:27 +00:00
Bruce Evans
f21b93a0f7 Cleaned up rev.1.39 - the shadowing variable should have just gone away. 1998-07-20 13:51:11 +00:00
Bruce Evans
92d1f65ed2 Moved allocation of the slices struct to the right place. Initialize
everything in it (the devsw pointers were not initialized early or at
all for the !DEVFS case, but this was harmless on i386's).
1998-07-20 13:39:45 +00:00
Bruce Evans
1e550e3809 Backed out rev.1.43 (removed nonsense SLICE ifdef). SLICE is
normally only defined in opt_devfs.h, so testing it before including
anything is normally a no-op.  Undef'ing DEVFS before including
opt_devfs.h is similarly useless.  OTOH, DEVFS support for sliced
but not SLICEd (despite defined(SLICE)) devices is either harmless
(if there are no such devices, then nothing in this file is used)
or necessary (otherwise).  It even seems to work for sliced cd
devices.
1998-07-20 12:37:59 +00:00
Bill Fenner
0c495036b4 Undo rev 1.41 until we get more details about why it makes some systems
fail.
1998-07-18 18:48:45 +00:00
Bruce Evans
18da528d41 Changed %n to %r in devfs name format strings. %n has almost gone away. 1998-07-15 12:18:34 +00:00
Bruce Evans
30166fabb6 Cast between longs and pointers via intptr_t. There shouldn't be
nearly so many casts here.  Casting an pointer that was an integer
back to an integer just to compare it with -1 is bad, and casting
it back just to compare it with NULL is just wrong.
1998-07-15 06:51:14 +00:00
Bruce Evans
d4d88b1e4d Cast between u_longs and object pointers via uintptr_t.
Access the entry address as a uintfptr_t, not as a long, and not
necessarily as what modload(8) passes (it takes a u_long from the
exec header and passes a u_int).
1998-07-15 06:39:12 +00:00
Bruce Evans
aae0aa4593 Cast between longs and pointers via intptr_t. The results of fuword()
should be checked before casting.  The results of suword() should be
checked.
1998-07-15 06:19:33 +00:00
Bruce Evans
1ede4662be Cast longs to intptr_t before casting them to pointers.
Fixed bitrot in pseudo-declaration of `struct fcntl_args'.  fcntl()
is now broken in some cases when ints are larger than longs.
1998-07-15 06:10:16 +00:00
Bruce Evans
c2da0fd903 Cast pointers to intptr_t instead of or before casting to long.
Fixed bitrot in K&R support (suword() now takes a long word).
Didn't fix corresponding bitrot in store.9 and fetch.9.

The correct types for the store and fetch families are problematic.
The `word' functions are unfortunately named and need to be split
to handle ints/longs/object pointers/function pointers.  Storing
argv[] as longs is quite broken when longs are longer than pointers,
but usually works because it clobbers variables that will soon be
reinitialized.
1998-07-15 05:21:48 +00:00
Bruce Evans
7cd99438f8 Cast u_longs to uintptr_t before casting them to pointers. Don't
attempt to even partially support systems with function pointers
larger than object pointers.
1998-07-15 05:00:26 +00:00
Bruce Evans
6a206dd96a Cast function pointers to uintfptr_t before casting them to u_long.
Hopefully caddr_t is large enough to hold function pointers.

Cast object pointers to uintptr_t before casting them to u_long.

Types are wronger than usual for the PT_READ_U case.  ptrace() can
only return ints, but longs are accessed.
1998-07-15 04:43:49 +00:00
Bruce Evans
a23d65bfc8 Cast pointers to uintptr_t/intptr_t instead of to u_long/long,
respectively.  Most of the longs should probably have been
u_longs, but this changes is just to prevent warnings about
casts between pointers and integers of different sizes, not
to fix poorly chosen types.
1998-07-15 02:32:35 +00:00
Bruce Evans
37889b394a Changed to the C9x draft spelling of the (unsigned) integral type
suitable for holding object pointers (ptrint_t -> uintptr_t).
Added corresponding signed type (intptr_t).  Changed/added
corresponding non-C9x types for function pointers to match.  Don't
use nonstandard types to implement these types, and don't comment
on them in <machine/types.h>.
1998-07-14 05:09:48 +00:00
Bruce Evans
9f14a215f4 Fixed printf format errors. 1998-07-13 07:05:55 +00:00
Doug Rabson
7a6c46b55a Initialise all the fields separately in vattr_null since on the alpha
they are not all the same width.
1998-07-12 16:45:39 +00:00
Doug Rabson
45c95fa1d6 Change interrupt api to be closer to intr_create/intr_connect. 1998-07-12 16:20:52 +00:00
Bruce Evans
bef7db2e66 Moved definition of fscale from param.c to kern_synch.c where it
should always have been (it has no user-servicable parts even at
compile time) and staticized it.
1998-07-11 13:06:41 +00:00
Bruce Evans
2f18a2801b Fixed printf format errors. 1998-07-11 10:45:45 +00:00