Commit Graph

63 Commits

Author SHA1 Message Date
jasone
daa58ba7a4 Major update to the way synchronization is done in the kernel. Highlights
include:

* Mutual exclusion is used instead of spl*().  See mutex(9).  (Note: The
  alpha port is still in transition and currently uses both.)

* Per-CPU idle processes.

* Interrupts are run in their own separate kernel threads and can be
  preempted (i386 only).

Partially contributed by:	BSDi (BSD/OS)
Submissions by (at least):	cp, dfr, dillon, grog, jake, jhb, sheldonh
2000-09-07 01:33:02 +00:00
peter
03f153fc25 Do not fault if curproc is null. 2000-04-29 11:32:15 +00:00
peter
e4b04a2b21 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
phk
192b6d4a54 Merge the cons.c and cons.h to the best of my ability. alpha may or
may not compile, I can't test it.
1999-08-09 10:35:05 +00:00
green
95a5c13052 Make long longs ("%ll" format) work.
Reviewed by:	msmith
1999-08-07 20:13:32 +00:00
dfr
a577542c85 This makes the in kernel printf routines conform to the documented
behavior of their userland counterparts with respect to return values.

Submitted by: Matthew N. Dodd <winter@jurai.net>
1999-07-24 09:34:12 +00:00
peter
73e3a5193f Oops, missed out one chunk of the last patch. (*blush*)
Submitted by:	Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
Submitted by:	"Matthew N. Dodd" <winter@jurai.net>
1999-07-14 17:37:53 +00:00
peter
fefa466c10 Fixes for a couple of problems in last commit:
1. Printing large quads in small bases overflowed the buffer if
   sizeof(u_quad_t) > sizeof(u_long).
2. The sharpflag checks had operator precedence bugs due to excessive
   parentheses in all the wrong places.
3. The explicit 0L was bogus in the quad_t comparison and useless in
   the long comparision.
4. There was some more bitrot in the comment about ksprintn().  Our
   ksprintn() handles bases up to 36 as well as down to 2.

Bruce has other complaints about using %q in kernel and would rather
we went towards using the C9X style %ll and/or %j.  (I agree for that
matter, as long as gcc/egcs know how to deal with that.)

Submitted by:	bde
1999-07-10 15:27:05 +00:00
peter
0e5a7beaf2 Implement the %q prefix for the integer types. Note that egcs on the
Alpha believes that %q is for long long, whereas our quad_t and int64_t
is only just a plain long.  long long on the alpha is the same size (64
bit) as a long.  It was requested, but I have not implemented yet, support
for C9X style %lld - it should be pretty easy though.
1999-07-09 17:54:39 +00:00
archie
289c2a94b6 ksprintn() may be called with base=2, so redefine MAXNBUF accordingly.
Other brucification tweaks.

Obtained from:	bde@freebsd.org
1999-06-07 18:26:26 +00:00
archie
6b91451129 The function ksprintn(), which is used to convert numbers to ASCII, is not
reentrant because it returns a static buffer. This results in a race condition
when/if an interrupt handler calls log(), printf() etc. Fix this.
1999-06-06 02:41:55 +00:00
jlemon
c6e9557b49 Unifdef VM86.
Reviewed by:	silence on on -current
1999-06-01 18:20:36 +00:00
archie
74ce545967 Add snprintf(3) and vsnprintf(3) capability to the kernel.
Reviewed by:	bde
1998-12-03 04:45:57 +00:00
ache
4818085324 Store formatted panic string in static buffer to make it available later
for savecore.
Previous code give only panic format to savecore
1998-09-06 06:25:18 +00:00
bde
7ce3ad02a0 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
bde
cd39e51e66 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
bde
4e226de97b Fixed (un)sign extension bugs in %+n format. -4 became
(long)(u_long)(u_int)-4 = 0x00000000fffffffc on machines with 32-bit
ints and 64-bit longs.

Restored %z format for printing signed hex.  %+x shouldn't have been
used since it is an error in userland.

Prepared to nuke %n format by cloning it to %r.  %n shouldn't have
been used because it means something completely different in
userland.  Now %+r is equivalent to ddb's original %r, and %r is
equivalent to ddb's original %n.

Ignore '+' flag in combination with unsigned formats %{o,p,u,x}.
1998-07-08 10:41:32 +00:00
phk
69ad703802 Some cleanups related to timecounters and weird ifdefs in <sys/time.h>.
Clean up (or if antipodic: down) some of the msgbuf stuff.

Use an inline function rather than a macro for timecounter delta.

Maintain process "on-cpu" time as 64 bits of microseconds to avoid
needless second rollover overhead.

Avoid calling microuptime the second time in mi_switch() if we do
not pass through _idle in cpu_switch()

This should reduce our context-switch overhead a bit, in particular
on pre-P5 and SMP systems.

WARNING:  Programs which muck about with struct proc in userland
will have to be fixed.

Reviewed, but found imperfect by:       bde
1998-05-28 09:30:28 +00:00
phk
8aa81c2fdf Make the size of the msgbuf (dmesg) a "normal" option. 1998-05-19 08:58:53 +00:00
bde
6ec873b836 Handle "%...p" as "%#...x" instead of "0x%...x". This is a quick fix
for field widths being 2 larger than specified for "%<number>p".  Only
printing of null pointers is "wrong" now (it is actually "right", but
inconsistent with printf(3)).
1997-12-28 05:03:33 +00:00
phk
d38c0e3213 Last major round (Unless Bruce thinks of somthing :-) of malloc changes.
Distribute all but the most fundamental malloc types.  This time I also
remembered the trick to making things static:  Put "static" in front of
them.

A couple of finer points by:	bde
1997-10-12 20:26:33 +00:00
bde
ec06a8cbcf Removed unused #includes. 1997-09-02 20:06:59 +00:00
peter
c8dcd04895 Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.
1997-02-22 09:48:43 +00:00
jkh
9c0cd3f9df Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
bde
b574768f3a Fixed the easy cases of const poisoning in the kernel. Cosmetic. 1996-08-31 16:52:44 +00:00
julian
a2e40aeceb Collect all the functioons concerned with rebooting into one place
also add the at_shutdown callout list, and change the one user of
the present (broken) method (the vn driver) to use the new scheme.
1996-08-19 20:07:07 +00:00
gpalmer
fefdc1e870 Correct a comment. There is no fn `kprintf' 1996-05-09 18:58:06 +00:00
gpalmer
6a52d4a592 Clean up various compiler warnings. Most (if not all) were benign
Reviewed by:	bde
1996-05-08 04:29:08 +00:00
phk
94b32fd41f KGDB is dead. It may come back one day if somebody does it. 1996-05-02 09:34:51 +00:00
jkh
9d4febcc0c Bill Fenner <fenner@parc.xerox.com> comes up with a better fix to the
debugger_on_panic stuff.
1996-03-25 17:06:34 +00:00
jkh
450ac8ea66 Ok, now this is correct (even simple fixes sometimes ain't so simple :) 1996-03-23 21:41:00 +00:00
jkh
37131b55bd Fix bogus last commit - debugger_on_panic was referenced even when
not defined.  Another change clearly committed without testing! :-(
1996-03-23 21:23:43 +00:00
phk
5c791e2a07 Remove all traces of KADB
add sysctl
	debug.debugger_on_panic: 1
if DDB or KGDB is defined.

Requested by: davidg
1996-03-23 11:31:16 +00:00
gpalmer
1b6f3f07ed Add a new option: DDB_UNATTENDED. Stops machine dropping into DDB
when it panics, but leaving activation of DDB from the console
unaffected.
1996-02-28 21:42:15 +00:00
gibbs
044dede750 Kernel printf now returns int. 1996-01-29 03:18:05 +00:00
bde
529d1be137 Restored newline at the end of panic messages. 1996-01-25 00:17:22 +00:00
phk
16eadd8d7e Remove %r hack, we have vprintf() now.
Add %D for "dumping" data.  Good for ethernet/MAC addresses and such.
Handle 1 < radix < 37.
1996-01-24 20:56:20 +00:00
phk
19968af5b6 bounds check the radix, just in case. 1996-01-22 13:21:33 +00:00
phk
7e1f10c873 Imake %.*s really work. :-( 1996-01-19 21:05:52 +00:00
phk
27eadfdea8 Make result of sprintf zero terminated. Fix %r for sprintf case. 1996-01-19 11:38:18 +00:00
phk
54454b508b Make %.*s work. 1996-01-18 10:23:02 +00:00
phk
12a8df7146 Add support for %.{int|*}s 1996-01-16 18:08:57 +00:00
phk
e7c21ea3e8 Get rid of two and a half printf in the kernel.
Add more features to the one remaining to handle the job:
	+	signed quantity.
	#	alternate format
	-	left padding
	*	read width as next arg.
	n	numeric in (argument specified) default radix.

Fix the DDB debugger to use these.
Use vprintf in debug routine in pcvt.

The warnings from gcc may become more wrong and  intolerable because
of this.

Warning:  I have not checked the entire source for unsupported or
changed constructs, but generally belive that there are only a few.

Suggested by: bde
1996-01-15 22:41:03 +00:00
wollman
a90779c958 Convert DDB to new-style option. 1996-01-04 21:13:23 +00:00
phk
c16e905bcf A Major staticize sweep. Generates a couple of warnings that I'll deal
with later.
A number of unused vars removed.
A number of unused procs removed or #ifdefed.
1995-12-14 08:32:45 +00:00
dg
5cae38e760 Killed some gratuitous #include's. 1995-08-24 12:54:11 +00:00
dg
fcc597a1ad Woops, I committed the wrong version of the diff in the last rev. 1995-08-07 08:40:49 +00:00
dg
680acd2495 Made msgbuf range checking more robust and clean. 1995-08-07 07:58:23 +00:00
dg
4d8db6ac1d Restore check for msg_bufx being negative. Changed if() expression to be
in Lite2 style.
1995-08-06 22:00:17 +00:00
bde
3781af1db0 Convert %p to 0x%x instead of to 0x%8x. The latter gives blank padding
in the wrong place.  Blank padding in the right place or zero padding
would be inconsistent with user mode.

Put case 'p' in alphabetical order.

Implement %p in sprintf() too.  I'd like only a single, more complete
printf() core, perhaps one based on vsnprintf().
1995-06-14 07:55:07 +00:00