Commit Graph

26953 Commits

Author SHA1 Message Date
Semen Ustimenko
395a636fb2 Fix an bug in FreeBSD attach routine - attaching MII interfaces before doing
common_attach is wrong as common attach initialize some fileds used by
mediainit routine. This was hard to notify because loading driver as kld
lead to mediainit routine being called after common_attach, though probe_phy
is called before.

MFC after:	1 week
2001-08-13 18:37:31 +00:00
Semen Ustimenko
2c9067b16f Add support for 802.1Q VLAN and oversized ethernet frames.
PR:		kern/29235
Submitted by:	Peter Jeremy <peter.jeremy@alcatel.com.au>
Reviewed by:	Yar Tikhiy <yar@FreeBSD.org>
MFC after:	1 week
2001-08-13 18:32:39 +00:00
Ruslan Ermilov
c5e7e03a14 Spell "FreeBSD" with "F" and "BSD" in uppercase. 2001-08-13 16:33:00 +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
Bruce Evans
807ef07ea1 Fixed minor numbers when there is more than one cy card.
PR:		19256
Submitted by:	initial version by yokota
MFC after:	1 week
2001-08-13 10:52:15 +00:00
Bruce Evans
0ce18d0354 Use ttymalloc() instead of a static array of `struct tty'. This will
be a regression until `pstat -t' actually understands the results of
ttymalloc().

Submitted by:	mostly by yokota
2001-08-13 07:00:21 +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
Mark Peek
53ab587043 Remove unused nmdmpoll function.
Approved by:	julian
2001-08-11 00:18:15 +00:00
John Baldwin
3f085c228e If we've panic'd already, then just bail in lockmgr rather than blocking or
possibly panic'ing again.
2001-08-10 23:29:15 +00:00
Julian Elischer
2b6a0c4fcd Make the protoswitch definitiosn checkable in the same way that
cdevsw entries have been for a long time.
Discover that we now have two version sof the same structure.
I will shoot one of them shortly when I figure out why someone thinks
they need it. (And I can prove they don't)
(netinet/ipprotosw.h should GO AWAY)
2001-08-10 23:17:22 +00:00
Bill Paul
c214e6636e Fix some of the GDB linkage setup. The l_name member of the gdb linkage
structure is always free()ed yet only sometimes malloc()ed. In particular,
it was simply set to point to l_filename from the a linker_file_t in
link_elf_link_preload_finish(). The l_filename had been malloc()ed inside
the kern_linker.c module and was being free()ed twice: once by
link_elf_unload_file() and again by linker_file_unload(), leading to
a panic.

How to duplicate the problem:

- Pre-load a kernel module from the loader, i.e. if_sis.ko
- Boot system
- Attempt to unload module with kldunload if_sis
- Bewm

The problem here is that the case where the module was loaded with kldload
after system boot would work correctly, so this bug went unnoticed until
I stubbed my toe on it just now. (Also, you can only trip this bug if
you compile a kernel with options DDB, but that's the default now.)

Fix: remember to malloc() a separate copy of the module name for the
l_name member of the gdb linkage structure in three places where the
linkage structure can be initialized.
2001-08-10 23:15:13 +00:00
John Baldwin
0f345c4054 Add an optimization where we check hte PS_ASTPENDING and PS_NEEDRESCHED
flags with interrupts disabled to see if we should call ast() during
doreti.  This was mostly submitted by Bruce, but his original patch did
the looping in ast() in assembly rather than in the ast() function itself.
Once we've actually called into the ast() function, it's cheaper to just
loop inside the function rather than returning from the function,
performing the check, and then calling the function again.  However, we
can optimize the first check to avoid calling the function at all.
Other architectures may choose to implement this optimization if they
wish but it is not required for correct operation.

Submitted by:	bde
2001-08-10 23:00:07 +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
John Baldwin
827dcaf663 Make witness compile w/o DDB.
Reported by:	wpaul
2001-08-10 22:33:59 +00:00
David E. O'Brien
9fd2cfcc2f Style cleanup. 2001-08-10 22:31:05 +00:00
Ian Dowse
a9a8ba3d71 Arbitrarily limit to 64k the number of bytes that can be read at
a time using the ogetdirentries() compatibility syscall. This is a
hack to ensure that rediculous values don't get passed to MALLOC().

Reviewed by:	kris
2001-08-10 22:14:18 +00:00
John Baldwin
8791b43513 Work around a race between msleep() and endtsleep() where it was possible
for endtsleep() to be executing when msleep() resumed, for endtsleep()
to spin on sched_lock long enough for the other process to loop on
msleep() and sleep again resulting in endtsleep() waking up the "wrong"
msleep.

Obtained from:	BSD/OS
2001-08-10 21:08:56 +00:00
John Baldwin
a45982d2ea Change callout_stop() to return an integer. If callout_stop() succeeds in
removing the callout entry, return 1.  If callout_stop() fails to remove
the callout entry because it is currently executing or has already been
executed, then the function returns 0.  The idea was obtained from BSD/OS,
however, BSD/OS changed untimeout(), and I've just changed callout_stop()
to be more conservative.

Obtained from:	BSD/OS
2001-08-10 21:06:59 +00:00
John Baldwin
4d33620270 Style nit: covert a couple of if (p_wchan) tests to if (p_wchan != NULL). 2001-08-10 20:56:25 +00:00
Ruslan Ermilov
94ba280c59 mdoc(7) police: join split punctuation to macro calls. 2001-08-10 17:35:21 +00:00
Julian Elischer
d05a918fc3 Do NOT allocate a 1K buffer on the kernel stack.
Found by: Smashed u-area and hardware watch points.
MFC after: 1 week
2001-08-10 17:32:11 +00:00
Kazutaka YOKOTA
3863b6db4c Fix missing splx(). 2001-08-10 14:26:48 +00:00
Poul-Henning Kamp
4446bcb757 Eliminate the hot-spare 'r' in Arrray.
Submitted by:	Søren Schrøder <sch@chaos.dk>
2001-08-10 11:47:08 +00:00
Julian Elischer
3b82ede012 DO NOT ALLOCATE 2+K OBJECTS ON THE KERNEL STACK!!!!
found by: Getting my u-area overwritten
2001-08-10 07:50:14 +00:00
John Baldwin
02cd7c3cf2 - Remove asleep(), await(), and M_ASLEEP.
- Callers of asleep() and await() have been converted to calling tsleep().
  The only caller outside of M_ASLEEP was the ata driver, which called both
  asleep() and await() with spl-raised, so there was no need for the
  asleep() and await() pair.  M_ASLEEP was unused.

Reviewed by:	jasone, peter
2001-08-10 06:56:12 +00:00
John Baldwin
c4a448100c - Remove asleep(), await(), and M_ASLEEP.
- Callers of asleep() and await() have been converted to calling tsleep().
  The only caller outside of M_ASLEEP was the ata driver, which called both
  asleep() and await() with spl-raised, so there was no need for the
  asleep() and await() pair.  M_ASLEEP was unused.

Reviewed by:	jasone, peter
2001-08-10 06:45:43 +00:00
John Baldwin
8ec48c6dbf - Remove asleep(), await(), and M_ASLEEP.
- Callers of asleep() and await() have been converted to calling tsleep().
  The only caller outside of M_ASLEEP was the ata driver, which called both
  asleep() and await() with spl-raised, so there was no need for the
  asleep() and await() pair.  M_ASLEEP was unused.

Reviewed by:	jasone, peter
2001-08-10 06:37:05 +00:00
Warner Losh
043b27b450 Move ISA interrupt ISR and timeout routines to pcic from pcic_isa so
that we can use them in the pci code when we have to fall back to ISA
interrupt routing.
2001-08-10 06:07:20 +00:00
Warner Losh
e4db871961 Type sanity: use uintptr_t * for read_ivar and u_int8_t instead of u_char 2001-08-10 06:00:44 +00:00
Warner Losh
f470b3bb56 Rearrange the pcic_irq_type enum (and specifically tag the first one
as being 1) in anticipation of documentation.
2001-08-10 05:42:08 +00:00
John Baldwin
c37c2d03b8 Bump MAXCOMLEN from 16 to 19 to take advantage of 32-bit alignment.
Approved by:	peter, jasone
2001-08-10 05:34:48 +00:00
Jake Burkholder
f02f55a8e3 Correct copyright language. 2001-08-10 04:51:19 +00:00
Jake Burkholder
416d9c00fa Add code to program the tick register and to setup its interrupt handler. 2001-08-10 04:49:33 +00:00
Jake Burkholder
228fa56391 Add early code to support interrupts. 2001-08-10 04:48:48 +00:00
Jake Burkholder
f69f6debc3 Fake up the frame pointers on a process's initial stack so they can be
restored correctly from the trapframe.

Submitted by:	tmm
2001-08-10 04:47:14 +00:00
Jake Burkholder
22693a0fef Handle all types of mmu misses from user mode.
Pass a context argument to tlb functions.
2001-08-10 04:44:33 +00:00
Jake Burkholder
a3698a6d7f Use the macro for getting the trap type from the trapframe.
Only set sticks (and acquire sched_lock) on entry from user mode.
Add handlers for all kinds of mmu misses, and for interrupts from
user mode.
Acquire Giant before calling into the vm system so this runs with
invariants.
Try to get the restrictions for page faults on user memory from
kernel mode right.
Only set pcb_onfault and return to the alternate return code if
this is actually a fault on user memory from kernel mode.
2001-08-10 04:43:31 +00:00
Jake Burkholder
c0eedfbccb Store 8 bytes instead of 4 in suword. Use a temporary stack that's known
to be locked in the tlb for calling openfirmware.

Submitted by:	tmm
2001-08-10 04:39:23 +00:00
Jake Burkholder
e822e0eefb Pass a context to tlb_store_slot, use a member(Sync) after setting the
secondary context register.
2001-08-10 04:37:03 +00:00
Jake Burkholder
9a6cacf3dd 1. Start the clock running early for testing.
2. Use the upcoming "tick" interface.
3. Save a call frame as well as a trap frame on proc0's initial stack.
4. Setup a pointer to the per-cpu interrupt queue.
5. Install the per-cpu pointer in interrupt and alternate globals as well.
6. Flush out setregs so exec works.

Submitted by:	tmm (3, 5, 6)
2001-08-10 04:36:00 +00:00
Jake Burkholder
346d41dd6f Set the pil to something sane on startup. 2001-08-10 04:32:13 +00:00
Jake Burkholder
4a7517d17f Add definitions needed by new assembler code. 2001-08-10 04:31:30 +00:00
Jake Burkholder
cc11501e3b 1. Add code to handle traps and interrupts from user mode.
2. Add spill and fill handlers for spills to the user stack on entry
   to the kernel.
3. Add code to handle instruction mmu misses from user mode.
4. Add code to handle level interrupts from kernel mode and vectored
   interrupt traps from either.
5. Save the pil in the trapframe on entry from kernel mode and restore
   it on return.

Submitted by:	tmm (1, 2)
2001-08-10 04:30:36 +00:00
Jake Burkholder
8dec6a681e Add code to handle stack traces that go all the way back to userland.
Use a better algorithm for finding out if an address is in the kernel.

Submitted by:	tmm
2001-08-10 04:23:41 +00:00
Jake Burkholder
8a7de3c054 Add trap types for interrupts. Ad definitions to get the interrupt level
from the trap type.
2001-08-10 04:22:24 +00:00
Jake Burkholder
fa01c0ff70 1. Add code to demap pages from the tlb for user contexts.
2. Add a context argument to most functions, instead of extracting it from
   from the tte.

Submitted by:	tmm (1).
2001-08-10 04:21:44 +00:00
Jake Burkholder
0cb2d36969 Add fields that point to per-cpu interrupt data. 2001-08-10 04:18:48 +00:00
Jake Burkholder
db6c479810 Add a field to trapframe for saving the pil. 2001-08-10 04:18:13 +00:00
Jake Burkholder
c13c9cbf4f Add asis for interrupt registers. 2001-08-10 04:17:29 +00:00