Commit graph

9426 commits

Author SHA1 Message Date
Robert Drehmel 266c520a5a Changed the data types of three index variables, two of them
in the `video_state' structure, to larger ones (from u_char to
u_short).  Each can now hold values at least as large as the
size of the array it is meant to point into.

This eliminates warnings printed by GCC 3.3.1 and hence makes
pcvt compilable using -Werror.
2003-07-27 14:01:33 +00:00
Maxime Henrion d5afecd068 - Introduce a new busdma flag BUS_DMA_ZERO to request for zero'ed
memory in bus_dmamem_alloc().  This is possible now that
  contigmalloc() supports the M_ZERO flag.
- Remove the locking of Giant around calls to contigmalloc() since
  contigmalloc() now grabs Giant itself.
2003-07-27 13:52:10 +00:00
Poul-Henning Kamp a8d43c90af Add a "int fd" argument to VOP_OPEN() which in the future will
contain the filedescriptor number on opens from userland.

The index is used rather than a "struct file *" since it conveys a bit
more information, which may be useful to in particular fdescfs and /dev/fd/*

For now pass -1 all over the place.
2003-07-26 07:32:23 +00:00
Poul-Henning Kamp 8b30546120 Stop GCC from whining when people use a 16 bit port number for inb() and outb() 2003-07-23 20:28:23 +00:00
Alan Cox 3462150083 Annotate pmap_changebit() as __always_inline. This function was
written as a template that when inlined is specialized for the caller
through constant value propagation and dead code elimination.  Thus,
the specialized code that is generated for pmap_clear_reference() et
al. avoids several conditional branches inside of a loop.
2003-07-23 19:49:32 +00:00
John Baldwin e47d4f0fc2 Use macros from apic.h to when writing to the ICR to send IPIs to startup
APs rather than magic numbers.

Tested by:	scottl
2003-07-23 19:04:28 +00:00
John Baldwin 55fb372edd Add a new macro APIC_ICRLO_RESV_MASK that contains all of the reserved
fields in the low 32 bits of the local APIC ICR register.  Use this macro
in place of APIC_RESV2_MASK when masking off existing bits from the ICR
when writing to it to send an IPI.

Tested by:	scottl
2003-07-23 18:59:38 +00:00
Peter Wemm 461d4da338 Remove _ARCH_INDIRECT, it was the glue to enable having both hardware
and software versions of the floating point code in libm.  The runtime
selection was done by reading the hw.floatingpoint sysctl via
__get_hw_float().
2003-07-23 04:28:51 +00:00
Peter Wemm a35b33869d Initiate de-orbit burn for fpu-less operation. 386+387 is still
theoretically supportable, but you'd really be happier with FreeBSD 2.1.8
on it.
2003-07-22 08:11:17 +00:00
Sam Leffler 721efab91e add safe driver until we can verify it as machine-independent 2003-07-21 21:51:24 +00:00
Peter Wemm 5d2fc474c5 Commit Ian Dowse's workaround for acpi resume resetting after the
LAZY_SWITCH changes.  He pointed out the acpi code sets up an identity
mapping in the current vmspace and that got messed up by the %cr3 being
out of sync with the current page directory.  As a workaround, restore
%cr3 across the sleep/resume.  A more complete fix would be to undo the
lazy state and clear the pm_active bit from the borrowed pmap, but this
works and people are currently hurting.  I'll clean this up.
This is mostly Ian's patch, plus a PAE tweak from me.
2003-07-21 20:59:27 +00:00
Robert Drehmel fcaec66af7 Make the 80x60, 132x25, 132x43, 132x50, and 132x60 VESA text modes
work when using a graphics chipset which identifies itself as
`VIA CLE266', used in some VIA EPIA boards.  Two values need to be
patched in the VESA mode information structure: the widths of the modes
mentioned above are encoded in a format which was unknown to the VESA
module (and to my copy of the VBE spec.) whereas the window memory
segment values seem to be just incorrect.

I tested this on a VIA EPIA-M9000 and -M10000.
2003-07-18 00:06:10 +00:00
Scott Long 476755ab25 Now that the dust has settled, make dflt_lock() always panic. 2003-07-17 16:07:46 +00:00
David Xu 20a2d71332 Rename thread_siginfo to cpu_thread_siginfo.
Suggested by: jhb
2003-07-15 00:11:04 +00:00
Peter Wemm 74ed31bfc0 Fix the gcc-3.3 boot problem. Gcc now optimizes 'int foo = 0' by moving
it to the bss section and skips the initialization.  This causes all
sorts of havoc because the bogus bss zero code clobbered previously set
variables.  All our supported boot loaders already zero the bss, even
kgzip for the elf case.  Since we dont generate a.out kernels, the old
a.out bootblocks and the a.out kgzip are not a factor anymore.
2003-07-11 21:39:25 +00:00
Mark Murray c7b132c974 Protect lint(1) from a #error. 2003-07-10 18:05:02 +00:00
Peter Wemm e95babf3a8 unifdef -DLAZY_SWITCH and start to tidy up the associated glue. 2003-07-10 01:02:59 +00:00
Alan Cox 90a7c7b671 In pmap_object_init_pt(), the pmap_invalidate_all() should be performed on
the caller-provided pmap, not the kernel_pmap.  Using the kernel_pmap
results in an unnecessary IPI for TLB shootdown on SMPs.

Reviewed by:	jake, peter
2003-07-08 19:40:35 +00:00
David Xu e2e8935832 Fix LOR between scheduler lock and SMP rendezvous lock.
Reviewed by: jhb
2003-07-08 00:14:30 +00:00
Brian S. Dean fa8ee6aca1 Woops - don't forget to declare locals needed for that last commit. 2003-07-06 16:56:16 +00:00
Brian S. Dean 6745e78cee Don't unconditionally reset the hardware debug registers in cpu_exit(),
reset them only if they were previously in use.  Unconditionally
resetting the registers wipes them out frequently, which interferes
with their use for kernel debugging.

While I'm here, be less verbose in the associated comment of a
neighboring function.

Noticed by:	bde
2003-07-06 16:52:18 +00:00
Alan Cox 4041408f4f Add vm object locking to pmap_prefault(). 2003-07-04 22:13:39 +00:00
Alan Cox 1f78f902a8 Background: pmap_object_init_pt() premaps the pages of a object in
order to avoid the overhead of later page faults.  In general, it
implements two cases: one for vnode-backed objects and one for
device-backed objects.  Only the device-backed case is really
machine-dependent, belonging in the pmap.

This commit moves the vnode-backed case into the (relatively) new
function vm_map_pmap_enter().  On amd64 and i386, this commit only
amounts to code rearrangement.  On alpha and ia64, the new machine
independent (MI) implementation of the vnode case is smaller and more
efficient than their pmap-based implementations.  (The MI
implementation takes advantage of the fact that objects in -CURRENT
are ordered collections of pages.)  On sparc64, pmap_object_init_pt()
hadn't (yet) been implemented.
2003-07-03 20:18:02 +00:00
John Baldwin 5cc1a74e77 Silly compile fixes from resource_disabled() commit.
Reported by:	tinderbox
Pointy hat to:	jhb
2003-07-03 14:33:17 +00:00
John Baldwin 8a9bc9c03b - Use the new resource_disabled() helper function to see if devices are
disabled.
- Change the apm driver to match the acpi driver's behavior by checking to
  see if the device is disabled in the identify routine instead of in the
  probe routine.  This way if the device is disabled it is never created.

Note that a few places (ips(4), Alpha SMP) used "disable" instead of
"disabled" for their hint names, and these hints must be changed to
"disabled".  If this is a big problem, resource_disabled() can always be
changed to honor both names.
2003-07-02 16:09:02 +00:00
Maxime Henrion 331e012396 Sync more things with other backends. 2003-07-01 19:16:48 +00:00
Maxime Henrion 4813f72a9b Honor the boundary of the busdma tag when allocating bounce pages.
This was fixed in revision 1.5 of alpha/alpha/busdma_machdep.c and
was never fixed in other busdma backends using bounce pages.
2003-07-01 16:54:54 +00:00
Scott Long f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +00:00
Alan Cox dca96f1adc - Export pmap_enter_quick() to the MI VM. This will permit the
implementation of a largely MI pmap_object_init_pt() for vnode-backed
   objects.  pmap_enter_quick() is implemented via pmap_enter() on sparc64
   and powerpc.
 - Correct a mismatch between pmap_object_init_pt()'s prototype and its
   various implementations.  (I plan to keep pmap_object_init_pt() as
   the MD hook for device-backed objects on i386 and amd64.)
 - Correct an error in ia64's pmap_enter_quick() and adjust its interface
   to match the other versions.  Discussed with: marcel
2003-06-29 21:20:04 +00:00
Jeff Roberson ab875ef896 - Construct a cpu topology map for Hyper Threading systems so that ULE may
take advantage of them.
2003-06-28 22:07:42 +00:00
David Xu b8f480ab94 Add a machine depended function thread_siginfo, SA signal code
will use the function to construct a siginfo structure and use
the result to export to userland.

Reviewed by: julian
2003-06-28 06:34:08 +00:00
Peter Wemm eabd19726f Tidy up leftover lazy_switch instrumentation that is no longer needed.
This cleans up some #ifdef hell.
2003-06-27 22:39:14 +00:00
Peter Wemm 813b1b3df7 *groan*. I can't win today. Fix manual transcription error so that the
PAE ifdef is correct.

Pointy hat assigned by:  kan
2003-06-27 22:20:18 +00:00
Peter Wemm 48eceb6213 Make LAZY_SWITCH work with PAE 2003-06-27 22:13:30 +00:00
Peter Wemm b50953ccfa Fix the false IPIs on smp when using LAZY_SWITCH caused by pmap_activate()
not releasing the pm_active bit in the old pmap.
2003-06-27 21:50:52 +00:00
Scott Long 3eaffdf7e0 Do the first and mostly mechanical step of adding mutex support to the
bus_dma async callback scheme.  Note that sparc64 does not seem to do
async callbacks.  Note that ia64 callbacks might not be MPSAFE at the
moment.  Note that powerpc doesn't seem to do async callbacks due to
the implementation being incomplete.

Reviewed by:	mostly silence on arch@
2003-06-27 08:31:48 +00:00
Poul-Henning Kamp 3b6d965263 Add a f_vnode field to struct file.
Several of the subtypes have an associated vnode which is used for
stuff like the f*() functions.

By giving the vnode a speparate field, a number of checks for the specific
subtype can be replaced simply with a check for f_vnode != NULL, and
we can later free f_data up to subtype specific use.

At this point in time, f_data still points to the vnode, so any code I
might have overlooked will still work.
2003-06-22 08:41:43 +00:00
Matthew N. Dodd c27e9c5100 Implement a loader tunable/sysctl to allow the user to request that
the APM driver byte-swap battery time values.  (For broken laptops.)

PR:		i386/42439
Submitted by:	Bruce M Simpson <bms@spc.org>
2003-06-22 05:08:10 +00:00
John-Mark Gurney b9d3718a18 fix another LP64 problem. READ_IVAR takes a pointer to an uintptr_t, not
an int.
2003-06-20 07:22:54 +00:00
David Xu 0e2a4d3aeb Rename P_THREADED to P_SA. P_SA means a process is using scheduler
activations.
2003-06-15 00:31:24 +00:00
Alan Cox 49a2507bd1 Migrate the thread stack management functions from the machine-dependent
to the machine-independent parts of the VM.  At the same time, this
introduces vm object locking for the non-i386 platforms.

Two details:

1. KSTACK_GUARD has been removed in favor of KSTACK_GUARD_PAGES.  The
different machine-dependent implementations used various combinations
of KSTACK_GUARD and KSTACK_GUARD_PAGES.  To disable guard page, set
KSTACK_GUARD_PAGES to 0.

2. Remove the (unnecessary) clearing of PG_ZERO in vm_thread_new.  In
5.x, (but not 4.x,) PG_ZERO can only be set if VM_ALLOC_ZERO is passed
to vm_page_alloc() or vm_page_grab().
2003-06-14 23:23:55 +00:00
Alan Cox 89f4fca265 Move the *_new_altkstack() and *_dispose_altkstack() functions out of the
various pmap implementations into the machine-independent vm.  They were
all identical.
2003-06-14 06:20:25 +00:00
Alan Cox b26ce6a4b4 Add vm object locking to pmap_object_init_pt(). 2003-06-13 19:27:52 +00:00
Alan Cox 8630c1173e Add vm object locking to various pagers' "get pages" methods, i386 stack
management functions, and a u area management function.
2003-06-13 03:02:28 +00:00
Matthew N. Dodd d7522df29c Conditionally attach the MCA bus device. 2003-06-13 00:43:57 +00:00
Matthew N. Dodd cba6ce369d Despite my best efforts the Linux way of doing this is the only
way that works correctly.

- Remove unused function.
- Move declaration of variables to .S file.
2003-06-13 00:36:03 +00:00
Matt Jacob 132ba32ac2 Remove mpt from the nodevice list. This was tested by the submitter.
Submitted by:	Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
2003-06-12 17:11:01 +00:00
Peter Wemm 77e2a274d0 GC unused cpu_wait() function 2003-06-11 05:20:33 +00:00
David E. O'Brien e9f0aa0360 Use __FBSDID(). 2003-06-10 05:05:54 +00:00
Juli Mallett d196a10856 Note that scbus is required for SCSI, not just "required" in general.
Submitted by:	Edward Kaplan (tmbg37 on IRC)
Reviewed by:	rwatson (in principle)
2003-06-08 02:03:02 +00:00
John Baldwin 9dc9d63d01 Reinstate the bug fix in revision 1.2 as it is correct. The errors I saw
on my laptop after this change were the result of a bug in the ACPICA code.
2003-06-07 14:34:18 +00:00
John Baldwin ba40a03417 - Rename nexus_pcib to legacy_pcib. I've been meaning to do this for a
while after the legacy device was added since this driver hangs from
  legacy and not nexus.
- Make several methods non-static so they can be reused in a mptable
  host -> pci bridge driver that will be added at a later date.
- Let legacy_pcib() use pcibios_pcib_route_interrupt() directly instead of
  wrapping it in a private function.  Originally, I thought I was going to
  have the nexus_pcib() driver make a runtime APIC vs. 8259A check and call
  the appropriate routing method (MPTable vs. PIR) that way, but it ended
  up being cleaner to make nexus_pcib() just work with PIR and have a
  separate host -> pci bridge driver for the mptable/apic case.
2003-06-06 17:56:30 +00:00
John Baldwin 6b9691f103 - Use IDTVEC() to declare IPI handlers since they are also IDT vectors.
- Make handlers for IPI's used by SMP kernels #ifdef SMP.
2003-06-06 17:45:25 +00:00
John Baldwin cdd83b0ad1 Use the secondary bus number instead of the number of the bus the PCI-PCI
bridge lives on (i.e., the parent bus) when probing the PIR table for a
bus.  This could cause the PCIBIOS PCI-PCI bridge driver to bogusly attach
to bridges that weren't in the PIR but whose parent bus was in the PIR.
2003-06-06 17:27:18 +00:00
John Baldwin e59ae32f18 - Document the thermal and performance counter LVT entries in the local
APIC.
- Add a lvt_thermal member to the LAPIC struct.
- Add constants for the SMI and INIT LVT delivery modes.
2003-06-06 17:22:15 +00:00
Marcel Moolenaar 11e0f8e16d Change the second (and last) argument of cpu_set_upcall(). Previously
we were passing in a void* representing the PCB of the parent thread.
Now we pass a pointer to the parent thread itself.
The prime reason for this change is to allow cpu_set_upcall() to copy
(parts of) the trapframe instead of having it done in MI code in each
caller of cpu_set_upcall(). Copying the trapframe cannot always be
done with a simply bcopy() or may not always be optimal that way. On
ia64 specifically the trapframe contains information that is specific
to an entry into the kernel and can only be used by the corresponding
exit from the kernel. A trapframe copied verbatim from another frame
is in most cases useless without some additional normalization.

Note that this change removes the assignment to td->td_frame in some
implementations of cpu_set_upcall(). The assignment is redundant.
A previous call to cpu_thread_setup() already did the exact same
assignment. An added benefit of removing the redundant assignment is
that we can now change td_pcb without nasty side-effects.

This change officially marks the ability on ia64 for 1:1 threading.

Not tested on: amd64, powerpc
Compile & boot tested on: alpha, sparc64
Functionally tested on: i386, ia64
2003-06-04 21:13:21 +00:00
John Baldwin 8375d3a4bc Bah, revert the previous commit for the time being due to inadequate testing
on my part.  The output asm looks correct with the previous commit in place
and it works on amd64, but on my laptop I got a spew of AE_BAD_PARAMETER
errors trying to unlock the acpi global lock.
2003-06-03 18:44:31 +00:00
John Baldwin d234ea4e0b Fix the asm constraints so that we use the correct constants when acquiring
and releasing ACPI global locks instead of (ab)using the pointers to those
locks as the constants.  Also, rather than require that the address of
the lock be stored in a register, use a memory constraint allowing the
memory address to be used directly.

Noticed by:	peter
2003-06-03 14:46:16 +00:00
Tor Egge c7251aede7 Initialize td->td_pcb->pcb_ext in cpu_thread_setup() since a garbage
value (e.g. 0xd0d0d0d0) can cause a kernel panic.
2003-06-02 20:43:28 +00:00
David E. O'Brien 71c5a90130 Use __FBSDID(). 2003-06-02 17:01:49 +00:00
David E. O'Brien 27e0099c4a Use __FBSDID(). 2003-06-02 16:56:40 +00:00
David E. O'Brien 006124d811 Use __FBSDID(). 2003-06-02 16:32:55 +00:00
David E. O'Brien db31907c73 Use __FBSDID(). 2003-06-02 06:48:51 +00:00
David E. O'Brien 9676a785e7 Use __FBSDID(). 2003-06-02 06:43:15 +00:00
David E. O'Brien cef2a2e364 Use __FBSDID(). 2003-06-02 06:16:45 +00:00
David E. O'Brien 0f0f21c394 Use __FBSDID(). 2003-06-02 06:02:49 +00:00
David E. O'Brien 8d19a0584b Don't use ## to concatinate to two things that don't together make a C token.
Two tokens that don't together form a vaid preprocssor token cannot be
pasted together using ANSI-C token concatinatation.  GCC 3.2's cpp, at least,
produces the desired result w/o using "##".
2003-06-02 02:41:38 +00:00
David E. O'Brien 69bb404192 Use C99 compatable asm statements. 2003-06-02 00:29:35 +00:00
David E. O'Brien 4b620ec03d Shorten long comment. 2003-06-01 20:28:20 +00:00
Poul-Henning Kamp 670966596b Remove unused variable(s).
Found by:       FlexeLint
2003-05-31 20:29:34 +00:00
Poul-Henning Kamp 618b80ddcf Avoid unbalancing the { } count in the source file with #ifdef by
putting the opening { after the #ifdef ... #endif sequence.

Found by:       FlexeLint
2003-05-31 20:25:53 +00:00
Poul-Henning Kamp 7d4220518e Remove break after return;
Found by:       FlexeLint
2003-05-31 20:24:30 +00:00
Poul-Henning Kamp 9a3454805e Don't rely on boolean expression evaluating to 1 or 0 by default.
Found by:       FlexeLint
2003-05-31 20:23:46 +00:00
Poul-Henning Kamp 8aa2b5ce7e We cannot use the normal strlen() and strcpy, but don't #define strlen and
strcpy to get private versions, use private versions directly.

Found by:       FlexeLint
2003-05-31 19:06:38 +00:00
Poul-Henning Kamp 76e4a2dc72 Add missing break;
Found by:       FlexeLint
2003-05-31 19:04:37 +00:00
Poul-Henning Kamp c9e61fbb81 Protect macro with do { ... } while (0)
Found by:       FlexeLint
2003-05-31 19:04:07 +00:00
Poul-Henning Kamp 80fcafb161 Remove unused variable.
Found by:       FlexeLint
2003-05-31 19:03:20 +00:00
Poul-Henning Kamp 78b52202d0 Fix indentation.
Found by:       FlexeLint
2003-05-31 19:02:20 +00:00
Poul-Henning Kamp e64f402ff1 Hang softc from dev_t 2003-05-31 18:56:58 +00:00
Poul-Henning Kamp d6b602d4b2 Remove unused variable.
Found by:       FlexeLint
2003-05-31 18:55:18 +00:00
Poul-Henning Kamp 03841f4eec Eliminate potential overflows by allocating softc dynamically,
removing at the same time the need for this to be a "count" config
option.

Found by:       FlexeLint
2003-05-31 17:06:20 +00:00
Hiten Pandya b77c32a07e Rename BUS_DMAMEM_NOSYNC to BUS_DMA_COHERENT.
The current name is confusing, because it indicates to
the client that a bus_dmamap_sync() operation is not
necessary when the flag is specified, which is wrong.

The main purpose of this flag is to hint the underlying
architecture that DMA memory should be mapped in a coherent
way, but the architecture can ignore it.  But if the
architecture does supports coherent mapping of memory, then
it makes bus_dmamap_sync() calls cheap.

This flag is the same as the one in NetBSD's Bus DMA.

Reviewed by: gibbs, scottl, des (implicitly)
Approved by: re@ (jhb)
2003-05-30 20:40:33 +00:00
Scott Long 7e71df9339 Bring back bus_dmasync_op_t. It is now a typedef to an int, though the
BUS_DMASYNC_ definitions remain as before.  The does not change the ABI,
and reverts the API to be a bit more compatible and flexible.  This has
survived a full 'make universe'.

Approved by:	re (bmah)
2003-05-27 04:59:59 +00:00
Scott Long c87d464f28 De-orbit bus_dmamem_alloc_size(). It's a hack and was never used anyways.
No need for it to pollute the 5.x API any further.

Approved by:	re (bmah)
2003-05-26 04:00:52 +00:00
Paul Saab 3284b9ee87 Make ciss usable under PAE
Approved by:	re (scottl)
2003-05-21 07:17:06 +00:00
Paul Saab 487a8c7e61 - Make this work with PAE.
- atomically load and clear the status block so we dont miss an
  update.
  Submitted by: jdp

Approved by:	re (scottl)
2003-05-21 07:00:49 +00:00
John Baldwin 7f4725bd09 The per-CPU spinlocks list is only maintained when WITNESS is enabled.
Thus, treat all page faults while in a critical section as fatal rather
than just those that occur with a non-empty spinlocks list.  All such page
faults are fatal anyways.  Calling trap_fatal() earlier increases the
chances of getting more useful panic messages and a possible DDB prompt.

Approved by:	re (scottl)
2003-05-20 20:50:33 +00:00
Alexander Kabaev 980ded9a7d sys/sys/limits.h:
- Fix visibilty test for LONG_BIT and WORD_BIT.  `#if defined(__FOO_VISIBLE)'
   is alays wrong because __FOO_VISIBLE is always defined (to 0 for
   invisibility).

sys/<arch>/include/limits.h
sys/<arch>/include/_limits.h:

 - Style fixes.

Submitted by:	bde
Reviewed by:	bsdmike
Approved by:	re (scottl)
2003-05-19 20:29:07 +00:00
Ruslan Ermilov 517f3f1ae5 There's just no reason to not have these in GENERIC.
Found by:	release/*/drivers.conf cleaning script
Approved by:	re (scottl)
2003-05-18 20:39:15 +00:00
Thomas Moestl a93b6bf5e9 In cpu_fork(), initialize pcb_psl for the new process to PSL_KERNEL,
instead of taking the (userland) eflags from the trap frame and masking
out PSL_I. There is no need to inherit any flags from the forking process;
the old method however can cause flags set in userland for the forking
process to be bogusly set in kernel mode when the newly forked process
runs for the first time (in particular PSL_T, which is set for userland
when the process is single-stepped; this would cause trace traps in
kernel mode).

Approved by:	re (jhb)
2003-05-16 01:10:33 +00:00
Alan Cox 4a0d6dfd2c Initialize logical_cpus_mask when the logical CPUs are enumerated in
the mptable.  (Previously, logical_cpus_mask was only initialized if
the hyperthreading fixup was executed.)

Approved by:	re (jhb)
Reviewed by:	ps
2003-05-15 05:12:24 +00:00
Juli Mallett 7bbf05a2c3 Clear up that COMPAT_43 may not do the same thing on every architecture
and clear up that COMPAT_SUNOS is similarly MI, and does something
relatively similar.

Approved by:	re/rwatson
2003-05-15 02:10:30 +00:00
John Baldwin 90af4afacb - Merge struct procsig with struct sigacts.
- Move struct sigacts out of the u-area and malloc() it using the
  M_SUBPROC malloc bucket.
- Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(),
  sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared().
- Remove the p_sigignore, p_sigacts, and p_sigcatch macros.
- Add a mutex to struct sigacts that protects all the members of the struct.
- Add sigacts locking.
- Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now
  that sigacts is locked.
- Several in-kernel functions such as psignal(), tdsignal(), trapsignal(),
  and thread_stopped() are now MP safe.

Reviewed by:	arch@
Approved by:	re (rwatson)
2003-05-13 20:36:02 +00:00
John Baldwin dea7cce585 Add some extra #ifdef stubs so that this compiles on 4.8.
Approved by:	re (rwatson/bmah)
2003-05-13 16:59:46 +00:00
Matthew N. Dodd 598d45be84 Provide exec_linux_setregs() to override exec_setregs().
Linux initializes %gs to 0.  Mimic this behavior.

Submitted by:	 Christian Zander <zander@minion.de>
Reviewed by:	 jake
Approved by:	 re
2003-05-11 21:51:11 +00:00
Scott Long 1b20702e45 Add notes about the 'ips' driver. 2003-05-11 06:39:05 +00:00
John Baldwin ace85d0a3c Style nits.
Approved by:	re (bmah)
2003-05-07 17:21:38 +00:00
Alexander Kabaev 0eda4c08a5 Style fixes.
Remove DBL_DIG, DBL_MIN, DBL_MAX and their FLT_ counterparts, they
were marked for deprecation ever since SUSv1 at least.
Only define ULLONG_MIN/MAX and LLONG_MAX if long long type is
supported.
Restore a lost comment in MI _limits.h file and remove it from
sys/limits.h where it does not belong.
2003-05-04 22:13:04 +00:00
Peter Wemm cda4b241e2 Hack to enable getting two different elf32 and elf64 loaders in the
same i386 loader binary.
2003-05-01 03:46:12 +00:00
Peter Wemm e7d32e949b <b30> is 'IA64' - ie: you're running on an ia64 in 32 bit mode. 2003-05-01 03:44:40 +00:00
Peter Wemm 7f47668191 Slight reorg and added AMD64 support. A couple of the MODINFOMD_* values
that were added to sparc64 and later powerpc, really should have been in
the MI area.  But changing that now with insufficient preperation will
just cause too much pain.

Move MD_FETCH() to the MI sys/linker.h file to avoid another two copies
of it.
2003-05-01 03:31:18 +00:00
Peter Wemm 4580c352e1 KPT_MIN_ADDRESS and KPT_MAX_ADDRESS are not used anywhere. And if they
were, they are not safe to use outside of the kernel since these values
can change at kernel compile time - ie: we do not want them compiled into
userland binaries.
2003-05-01 00:10:38 +00:00
John Baldwin d90e753aa8 Range check the syscall number before looking it up in the syscallnames[]
array.

Submitted by:	pho
2003-04-30 17:59:27 +00:00
Mark Murray 51da11a27a Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.
2003-04-30 12:57:40 +00:00
Mark Murray f17615daca Warns fixing. Protect against inappropriate linting, and mark
GCC-specific assemble code as such (in #ifdefs). Fix an easy
static variable warning while I'm here.
2003-04-30 12:23:58 +00:00
Alexander Kabaev 104a9b7e3e Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on:	standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-04-29 13:36:06 +00:00
Jake Burkholder 14ce5bd49b Use inlines for loading and storing page table entries. Use cmpxchg8b for
the PAE case to ensure idempotent 64 bit loads and stores.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-28 20:35:36 +00:00
Warner Losh 1ba3f9e2da Update to reflect tw removal. 2003-04-27 05:35:10 +00:00
Warner Losh 5899148189 After careful review of this driver, I'm pretty sure it would take a
lot of work to make this driver work under current.  In the past when
people wanted to remove xten, I was the only one in the way.  After
talking to fsmp@ (last person to make real changes to this driver)
about this, I'm convinced it is better left in the dust-bin of history

Approved by: re@ (scottl)
2003-04-27 05:30:52 +00:00
Johan Karlsson 00ffb51ea5 Add nodevice axe, since usb isn't supported by PAE.
Submitted by:	harti@
Approved by:	jake@
2003-04-25 21:49:35 +00:00
John Baldwin 7ff022c485 - Push down Giant into the sysarch() calls that still need Giant.
- Standardize on EINVAL rather than EOPNOTSUPP if the sysarch op value is
  invalid.
2003-04-25 20:04:02 +00:00
Jake Burkholder ffad008fcd Remove harmless invalid cast.
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-25 15:07:58 +00:00
Daniel Eischen 1328e1c4be Add an argument to get_mcontext() which specified whether the
syscall return values should be cleared.  The system calls
getcontext() and swapcontext() want to return 0 on success
but these contexts can be switched to at a later time so
the return values need to be cleared in the saved register
sets.  Other callers of get_mcontext() would normally want
the context without clearing the return values.

Remove the i386-specific context saving from the KSE code.
get_mcontext() is not i386-specific any more.

Fix a bad pointer in the alpha get_mcontext() code.  The
context was being bcopy()'d from &td->tf_frame, but tf_frame
is itself a pointer, so the thread was being copied instead.
Spotted by jake.

Glanced at by:  jake
Reviewed by:    bde (months ago)
2003-04-25 01:50:30 +00:00
Eric Anholt 42da33c444 Update the DRM to the latest from DRI CVS. Includes some bugfixes and removal
of the infrastructure for the gamma driver which was removed a while back.
The DRM_LINUX option is removed because the handler is now provided by the
linux compat code itself.
2003-04-25 01:18:47 +00:00
David Xu e63c419732 Don't print anything for fault at cpu_switch_load_gs, just like other
code to recover fault in doreti because of invalid segment registers,
silently push error to userland.
2003-04-24 01:48:59 +00:00
Alexander Kabaev 6fd839f9c7 Add a new sys/limits.h file which in turn depends on machine/_limits.h
to get actual constant values. This is in preparation for machine/limits.h
retirement.

Discussed on:	standards@
Submitted by:	Craig Rodrigues <rodrigc@attbi.com>  (*)
Modified by:	kan
2003-04-23 21:41:59 +00:00
John Baldwin eeec6bab2e Prefer the proc lock to sched_lock when testing PS_INMEM now that it is
safe to do so.
2003-04-22 20:01:56 +00:00
John Baldwin fe8cdcae87 - Replace inline implementations of sigprocmask() with calls to
kern_sigprocmask() in the various binary compatibility emulators.
- Replace calls to sigsuspend(), sigaltstack(), sigaction(), and
  sigprocmask() that used the stackgap with calls to the corresponding
  kern_sig*() functions instead without using the stackgap.
2003-04-22 18:23:49 +00:00
David Xu 97637bcfb2 Move down intr level testing code a bit, cpu_switch_load_gs fault can be at
interrupt nested time.
2003-04-22 08:12:03 +00:00
David Xu 5515888875 Fix some problems for cpu_switch_load_gs. when fault address is at
cpu_switch_load_gs, cpu is in context switch, so don't enable interrupt.
because it is in context switch, it is expected sched_lock was held,
so don't PROC_LOCK(p) and psignal, it is LOR, probably we can
set a P_XSIGBUS like flag in p_sflags, and set TDF_ASTPENDING in
td_flags, in ast(), post a SIGBUS to process if P_XSIGBUS was set.
2003-04-22 07:45:47 +00:00
David Xu 5b70587b8a Remove single threading detecting code, these code really should be
replaced by thread_user_enter(), but current we don't want to enable
this in trap.
2003-04-22 03:17:41 +00:00
Hidetoshi Shimokawa 092cd06fcd Add FireWire drivers to GENERIC. 2003-04-21 16:44:05 +00:00
David E. O'Brien 40373d8796 Assembly files put thru the C preprocessor need to have C style comments. 2003-04-21 16:30:12 +00:00
David Xu 6625036082 Reset pcb_gs and %gs before possibly invalidating it. 2003-04-21 15:05:05 +00:00
Bill Paul 87b4a25958 Add device driver support for the ASIX Electronics AX88172 USB 2.0
ethernet controller. The driver has been tested with the LinkSys
USB200M adapter. I know for a fact that there are other devices out
there with this chip but don't have all the USB vendor/device IDs.

Note: I'm not sure if this will force the driver to end up in the
install kernel image or not. Special magic needs to be done to exclude
it to keep the boot floppies from bloating again, someone please
advise.
2003-04-20 19:05:33 +00:00
David Xu d1fc2022c3 Backout my last commit.
Requested by: bde
2003-04-20 01:35:21 +00:00
David Xu 2bdf11638e Don't return garbage in high 16 bits. 2003-04-19 02:40:39 +00:00
John Baldwin 9eb78fcfd9 Synchronize the two linux_clone() implementations which includes a few
minor cleanups in both.
2003-04-18 20:54:41 +00:00
John Baldwin 889a6b5845 Use the proc lock to protect p_singlethread and a P_WEXIT test. This
fixes a couple of potential KSE panics on non-i386 arch's that weren't
holding the proc lock when calling thread_exit().
2003-04-18 20:20:00 +00:00
John Baldwin ee6c1d2ed2 Hold the proc lock for curproc around sigonstack(). 2003-04-18 20:09:04 +00:00
John Baldwin aff1d36ceb Add some missing proc mutex unlocks. 2003-04-17 22:19:47 +00:00
John Baldwin e5567180fb Don't drop the proc lock just to reacquire it after a few simple assignment
statements.  Just hold the lock the entire time.
2003-04-17 22:18:07 +00:00
John Baldwin 8365f5bf7c Remove a couple of unused symbols. 2003-04-17 22:17:28 +00:00
Poul-Henning Kamp a300701213 Don't include <sys/disklabel.h> 2003-04-16 20:57:35 +00:00
Matthew N. Dodd 2836b6d03e - Set if_unit, if_init, and ifq_maxlen.
- Remove unnecessary initializations; ether_ifattach() takes care of them.
- Change function argument types to avoid nasty casts.
2003-04-16 06:27:39 +00:00
John Baldwin f265002902 Sync up with changes to ptrace() and use P_SHOULDSTOP instead of
a duplicate P_TRACED check.

Submitted by:	marcel
2003-04-15 16:29:39 +00:00
Maxime Henrion 0cb112309a style(9) 2003-04-15 03:11:03 +00:00
Hidetoshi Shimokawa c8990f0d8e Restore delayed load support for the resource shortage case.
It was missed in the previous change.
Now, _bus_dmamap_load_buffer() accepts BUS_DMA_WAITOK/BUS_DMA_NOWAIT flags.

Original idea from: jake
2003-04-14 13:21:40 +00:00
Hidetoshi Shimokawa f5270431be * Use _bus_dmamap_load_buffer() and respect maxsegsz in bus_dmamap_load().
Ignoring maxsegsz may lead to fatal data corruption for some devices.
ex. SBP-2/FireWire
We should apply this change to other platforms except for sparc64.

MFC after: 1 week
2003-04-14 04:19:42 +00:00
David Xu 2257a44ffd Copy %gs from current CPU not from a stale PCB backup. 2003-04-11 14:47:34 +00:00
David Xu d8c586e73a set_user_ldt_rv() should check same proc not thread,
this commit fixes an user LDT smp rendezvous bug.
2003-04-11 14:45:07 +00:00
Dag-Erling Smørgrav 0da46d776b Convert the SMP_TSC kernel option into a loader tunable. Also enable
the TSC timecounter on single-CPU systems even when they are running
an SMP kernel.
2003-04-10 23:07:24 +00:00
Maxime Henrion 141bacb048 Change the operation parameter of bus_dmamap_sync() from an
enum to an int and redefine the BUS_DMASYNC_* constants as
flags.  This allows us to specify several operations in one
call to bus_dmamap_sync() as in NetBSD.
2003-04-10 23:03:33 +00:00
Julian Elischer 060563ec50 Move the _oncpu entry from the KSE to the thread.
The entry in the KSE still exists but it's purpose will change a bit
when we add the ability to lock a KSE to a cpu.
2003-04-10 17:35:44 +00:00
Wes Peters c2ff1e1682 Add a sysctl that records and reports the CPU clock rate calculated
at boot.  Funny how often this trivial piece of information crops up
in embedded boxen.

Sponsored by:   St. Bernard Software
2003-04-10 07:05:24 +00:00
Jake Burkholder 87b91b10ef Add ahd. 2003-04-09 14:58:28 +00:00
Jake Burkholder ac00210525 Remove invalid cast to vm_offset_t to avoid truncating a physical address
when doing pmap_kextract on a 2MB page.

Spotted by:	peter
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-08 18:22:41 +00:00
Jake Burkholder a3b3689ff3 Add a PAE kernel config. This includes GENERIC through the config include
mechanism, and then excludes device drivers which have not been tested or
are known to not work with more than 4G of ram.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-07 16:23:14 +00:00
Jake Burkholder fce2287796 Add support for bounce buffers to _bus_dmamap_load_buffer, which is the
backend for bus_dmamap_load_mbuf and bus_dmamap_load_uio.

- Increaes MAX_BPAGES to 512.  Less than this causes fxp to quickly runs out
  of bounce pages.
- Add an argument to reserve_bounce_pages indicating wether this operation
  should fail or be queued for later processing if we run out of memory.
  The EINPROGRESS return value is not handled properly by consumers of
  bus_dmamap_load_mbuf.
- If bounce buffers are required allocate minimum 1 bounce page at map
  creation time.  If maxsize was small previously this could get truncated
  to 0 and the drivers would quickly run out of bounce pages.
- Fix a bug handling the return value of alloc_bounce_pages at map creation
  time.  It returns the number of pages allocated, not 0 on success.
- Use bus_addr_t for physical addresses to avoid truncation.
- Assert that the map is non-null and not the no bounce map in
  add_bounce_pages.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-07 16:08:32 +00:00
Jake Burkholder 46ea68dd10 Better fix for previous previous which still allows the 4megs of kva at
the top of the address space to be reclaimed.  The problem is that with
the APTD gone the mapable kernel address space runs right to the end of
the 32 bit address space.  As a max this is 0x100000000, which can't be
represented in 32 bits, so we have to use ptd entry n-1 and pte offset
n-1, instead of ptd entry n and pte offset 0.  There's still 1 page we
can't use, but we gain just under 4 megs of kva (8 megs with PAE).

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-07 14:27:19 +00:00