Commit Graph

7611 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
b51a26edb2 Add proc/<pid>/cmdline. 2000-12-09 16:20:48 +00:00
Dag-Erling Smørgrav
8b5a844af9 Add a dependency on procfs. 2000-12-09 16:20:35 +00:00
Dag-Erling Smørgrav
f786d43aac A bunch of fixes that have been rotting in my tree for a month or two
waiting for procfs to get fixed:

  - Use fill_eproc() to obtain correct VM stats. Attempt to compute VmLib.

  - Fill some more fields in proc/<pid>/stat, and add four (unimplemented)
    fields after studying a recent Linux kernel.

  - Compute CPU frequency only once instead of twice.

  - Fix some comments that were OBE.

  - Fix indentation except where it makes the code less readable.
2000-12-09 13:25:54 +00:00
Mike Smith
bb0d0a8efc Next phase in the PCI subsystem cleanup.
- Move PCI core code to dev/pci.
 - Split bridge code out into separate modules.
 - Remove the descriptive strings from the bridge drivers.  If you
   want to know what a device is, use pciconf.  Add support for
   broadly identifying devices based on class/subclass, and for
   parsing a preloaded device identification database so that if
   you want to waste the memory, you can identify *anything* we know
   about.
 - Remove machine-dependant code from the core PCI code.  APIC interrupt
   mapping is performed by shadowing the intline register in machine-
   dependant code.
 - Bring interrupt routing support to the Alpha
   (although many platforms don't yet support routing or mapping
   interrupts entirely correctly).  This resulted in spamming
   <sys/bus.h> into more places than it really should have gone.
 - Put sys/dev on the kernel/modules include path.  This avoids
   having to change *all* the pci*.h includes.
2000-12-08 22:11:23 +00:00
David Malone
7cc0979fd6 Convert more malloc+bzero to malloc+M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
2000-12-08 21:51:06 +00:00
Jake Burkholder
1b00f92039 Revert the previous change I made to cpu_switch. It doesn't help as
much as I thought it would and according to bde was a pessimization.
2000-12-08 21:31:52 +00:00
Poul-Henning Kamp
959b7375ed Staticize some malloc M_ instances. 2000-12-08 20:09:00 +00:00
Jake Burkholder
cc3f51b537 Fix a jump to the wrong label, <sigh>. Put a period at the end of a
sentence in a comment.

Submitted by:	bde
2000-12-08 19:53:37 +00:00
John Baldwin
31ae9b450a Argh, revert the clobber changes. Since %ecx and %edx aren't call safe,
calling the C functions mtx_enter_hard() and mtx_exit_hard() clobbers them.
Note that %eax is also not call safe, but it is already clobbered due to
cmpxchg.  However, now we are back to not compiling again, so these macros
are still left disabled for now.
2000-12-08 18:21:06 +00:00
Jake Burkholder
96d57f35b2 Change the calling conventions of the MTX_ENTER macro to match
that of MTX_EXIT.  Don't assume that the reg parameter to MTX_ENTER
holds curproc, load it explicitly.  Put semi-colons at the end of
the macros to be more consistent and so its harder to forget them
when these change.
2000-12-08 08:49:36 +00:00
John Baldwin
5e028585be Well, the previous commit wasn't entirely correct either. For now, just
disable the optimized mutex micro-operations for the non-I386_CPU case
and fall back to the C stubs that call the atomic_foo() inlines.
2000-12-08 05:03:34 +00:00
Poul-Henning Kamp
45b031c5e4 Move extern tsc_present outside function to quelch a warning. 2000-12-07 22:30:11 +00:00
Mitsuru IWASAKI
b52617dc0e Create a pmtimer device instance for GENERIC and NEWCARD kernels by default.
Submitted by:	Masayuki FUKUI <fukui@sonic.nm.fujitsu.co.jp>
2000-12-07 14:27:02 +00:00
John Baldwin
a423d0122b Fix broken register restraints that needlessly clobbered registers %ecx
and %edx resulting in gcc not having enough registers left to work with.
2000-12-07 02:23:16 +00:00
Peter Wemm
4366ac52ad This is kind of a nasty hack, but it appears to solve the Compaq DL360
SMP problem.  Compaq, in their infinite wisdom, forgot to put the IO apic
intpin #0 connection to the 8259 PIC into the mptable.  This hack is to
look and see if intpin #0 has *no* table entry and adds a fake ExtInt
entry for the remap routines to use.  isa/clock.c will still test the
interrupts.  This entry is only ever used on an already broken system.
2000-12-06 03:47:14 +00:00
Peter Wemm
a263238c86 Move io_apic_{read,write} from apic_ipl.s (where they do not belong) into
mpapic.c.  This gives us the benefit of C type checking.  These functions
are not called in any critical paths and are not used by the interrupt
routines.
2000-12-06 01:04:02 +00:00
Peter Wemm
9a18987b73 GC unused assembler function apic_eoi() 2000-12-06 00:38:04 +00:00
Jake Burkholder
1eb44f0270 Remove the last of the MD netisr code. It is now all MI. Remove
spending, which was unused now that all software interrupts have
their own thread.  Make the legacy schednetisr use an atomic op
for setting bits in the netisr mask.

Reviewed by:	jhb
2000-12-05 00:36:00 +00:00
Peter Wemm
5ee171d264 Cleanup some leftover lint from the old interrupt system.
Also, while here, run up to 32 interrupt sources on APIC systems.
Normalize INTREN/INTRDIS so they are the same on both UP and SMP systems
rather than sometimes a macro, and sometimes a function.

Reviewed by:  jhb, jakeb
2000-12-04 21:15:14 +00:00
Jake Burkholder
f315dbdbd4 (1) Allow a stray lock prefix to be compiled out with the
MPLOCKED macro
(2)	Use decimal 12 rather than hex 0xc in an addl
(3)	Implement MTX_ENTER for the I386_CPU case
(4)	Use semi-colons between instructions to allow MTX_ENTER
	and MTX_ENTER_WITH_RECURSION to be assembled
(5)	Use incl instead of incw to increment the recusion count
(6)	10 is not a valid label, use 7, 8 and 9 rather than 8, 9 and 10
(7)	Sort numeric labels

Submitted by:	bde (2, 4, and 5)
2000-12-04 12:38:03 +00:00
Alexander Langer
b2ca55728b Add the NS DP83815 to the list of supported chips by the sis driver.
Inspired by:	Oliver Fromme
2000-12-03 18:43:41 +00:00
David Malone
0863e00340 Check return value of malloc correctly and use M_ZERO. 2000-12-03 13:18:49 +00:00
Jake Burkholder
1306962a43 Change cpu_switch to explicitly popl the callers program counter and
pushl that of the new process, rather than doing a movl (%esp) and
assuming that the stack has been setup right.  This make the initial
stack setup slightly more sane, and will make it easier to stick
an interrupted process onto the run queue without its knowing.
2000-12-03 01:09:59 +00:00
Mark Murray
4a3a2f0704 Namespace cleanup. Remove some #includes in favour of an explicit
declaration.

Asked for by:	bde
2000-12-02 17:59:41 +00:00
John Baldwin
0de7d1da20 Protect access to p_stat with sched_lock. 2000-12-01 06:34:19 +00:00
John Baldwin
1bcb20def1 Fix this slightly better by using NON_GPROF_RET instead of duplicating
hard-coded asm.

Suggested by:	bde
2000-12-01 05:29:21 +00:00
Jake Burkholder
21ad98bca8 Change doreti to take a trapframe instead of an intrframe.
Remove associated pushes of dummy units to convert frame.

Reviewed by:	jhb
2000-12-01 02:09:45 +00:00
John Baldwin
e60877b3ae Revert the previous change to this file. We have to hardcode in the opcode
for return because we do Evil Things(tm) with a 'ret' macro in
asmacros.h.

Noticed by:	markm
2000-11-30 20:07:49 +00:00
Alfred Perlstein
82625cf321 remove unneded sys/ucred.h includes 2000-11-30 18:52:32 +00:00
Marcel Moolenaar
d034d459da Don't use p->p_sigstk.ss_flags to keep state of whether the
process is on the alternate stack or not. For compatibility
with sigstack(2) state is being updated if such is needed.

We now determine whether the process is on the alternate
stack by looking at its stack pointer. This allows a process
to siglongjmp from a signal handler on the alternate stack
to the place of the sigsetjmp on the normal stack. When
maintaining state, this would have invalidated the state
information and causing a subsequent signal to be delivered
on the normal stack instead of the alternate stack.

PR: 22286
2000-11-30 05:23:49 +00:00
Peter Wemm
083e9ed543 Increase NKPT from 17 to 30. This fixes the 4GB ram boot panic on both
-current and RELENG_4 with GENERIC.

NKPT is the number of initial bootstrap page table pages we create for
the kernel during startup. Once VM is up, we resize it as needed, but
with 4G ram, the size of the vm_page_t structures was pushing it over
the limit.  The fact that trimmed down kernels boot on 4G ram machines
suggests that we were pretty close to the edge.

The "30" is arbitary, but smaller than the 'nkpt' variable on all
machines that I checked.
2000-11-30 01:53:02 +00:00
John Baldwin
8d9888d37a Don't wait forever for CPUs to stop or restart. Instead, give up after a
timeout.  If DIAGNOSTIC is turned on, then display a message to the console
with a map of which CPUs failed to stop or restart.  This gives an SMP box
at least a fighting chance of getting into DDB if one of the other CPUs has
interrupts disabled.
2000-11-28 23:52:36 +00:00
John Baldwin
bf8bfade99 Use atomic ops to close a race condition on the in_Debugger variable used
to only allow 1 CPU at a time to (non-recursively) enter the debugger.
2000-11-28 23:15:44 +00:00
Dag-Erling Smørgrav
fbbd9aebdd Add bogomips to cpuinfo (set it equal to the CPU frequency, which is bogus
but not more so than Linux' definition).
This should get the IBM JDK 1.3 working again.

Prompted by:	sobomax
2000-11-27 11:10:03 +00:00
David Malone
373134cc60 Don't scroll of the end of the help pages when using the visual
option in for "boot -c".

PR:		17539
Submitted by:	Edwin.Groothuis@cgmd76206.chello.nl
2000-11-26 23:39:46 +00:00
Jonathan Lemon
df5e198723 Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue.  Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.

IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue.  An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.

Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.
2000-11-25 07:35:38 +00:00
Jonathan Lemon
14db7f978b Correct a misnamed argument hidden behind a #ifdef DEBUG
Found by:  LINT
2000-11-25 07:04:43 +00:00
Jonathan Lemon
e82ac18e52 Revert the last commit to the callout interface, and add a flag to
callout_init() indicating whether the callout is safe or not.  Update
the callers of callout_init() to reflect the new interface.

Okayed by: Jake
2000-11-25 06:22:16 +00:00
Alfred Perlstein
d28632c097 These files are mpsafe. 2000-11-25 03:01:05 +00:00
Marcel Moolenaar
cc6ca9b35c o Change the argument of linux_sigreturn to be a pointer to a
struct sigframe. We need more than only the signal context.

o  Properly convert the signal mask when setting up the signal
   frame in linux_sendsig and properly convert it back in
   linux_sigreturn.

Do some cleanups and improve style while here.
2000-11-23 08:55:30 +00:00
Marcel Moolenaar
e26cc4467b Change the argument of linux_sigreturn to be a pointer to a
struct sigframe.
2000-11-23 08:53:19 +00:00
Marcel Moolenaar
466b14d758 Don't unregister the ioctl handlers before we verified we
can unload. Doing so leaves the linuxulator in a crippled
state (no ioctl support) when Linux binaries are run at
unload time.

While here, consistently spell ELF in capitals and perform
some minor style improvements.

ELF spelling submitted by: asmodai
2000-11-23 03:21:58 +00:00
Jake Burkholder
553629ebc9 Protect the following with a lockmgr lock:
allproc
	zombproc
	pidhashtbl
	proc.p_list
	proc.p_hash
	nextpid

Reviewed by:	jhb
Obtained from:	BSD/OS and netbsd
2000-11-22 07:42:04 +00:00
Mark Murray
39413503a4 Assembler fixes.
Fix opcodes that were typed as ".byte 0xNN, 0xMM" when an older
assembler could not recognise the newer Pentium instructions.
Reviewed by:	jhb
2000-11-21 20:16:49 +00:00
Mark Murray
5855006767 Add a consistent API to a feature that most modern CPUs have; a fast
counter register in-CPU.

This is to be used as a fast "timer", where linearity is more important
than time, and multiple lines in the linearity caused by multiple CPUs
in an SMP machine is not a problem.

This adds no code whatsoever to the FreeBSD kernel until it is actually
used, and then as a single-instruction inline routine (except for the
80386 and 80486 where it is some more inline code around nanotime(9).

Reviewed by:	bde, kris, jhb
2000-11-21 19:55:21 +00:00
John Baldwin
0fb3a41200 Stop handcoding a couple of instructions since gas 2.10 can properly
assemble 16-bit code.

Noticed by:	markm
2000-11-21 18:36:10 +00:00
Poul-Henning Kamp
d7450ce6d5 Make programs which still #include <machine/{mouse,console}.h> fail
at compiletime, with an explanatory error message.  Previously they
would only get a warning.

These files will be finally removed 2001-01-15
2000-11-20 22:00:25 +00:00
Julian Elischer
06525b98f2 Duh. These have been sitting in my tree since I committed this stuff.
Thes are identical to what I committed except that they had the correct
copyright headers. This is what I was SUPPOSED to have checked in..
2000-11-20 13:43:40 +00:00
Jake Burkholder
fa2fbc3dac - Protect the callout wheel with a separate spin mutex, callout_lock.
- Use the mutex in hardclock to ensure no races between it and
  softclock.
- Make softclock be INTR_MPSAFE and provide a flag,
  CALLOUT_MPSAFE, which specifies that a callout handler does not
  need giant.  There is still no way to set this flag when
  regstering a callout.

Reviewed by:	-smp@, jlemon
2000-11-19 06:02:32 +00:00
Jake Burkholder
7da6f97772 - Split the run queue and sleep queue linkage, so that a process
may block on a mutex while on the sleep queue without corrupting
it.
- Move dropping of Giant to after the acquire of sched_lock.

Tested by:	John Hay <jhay@icomtek.csir.co.za>
		jhb
2000-11-17 18:09:18 +00:00