Commit Graph

1925 Commits

Author SHA1 Message Date
Warner Losh
06b4bf3e55 Expand inline the relevant parts of src/COPYRIGHT for Matt Dillon's
copyrighted files.

Approved by: Matt Dillon
2003-08-12 23:24:05 +00:00
John Baldwin
e9911cf591 - Convert Alpha over to the new calling conventions for cpu_throw() and
cpu_switch() where both the old and new threads are passed in as
  arguments.  Only powerpc uses the old conventions now.
- Update comments in the Alpha swtch.s to reflect KSE changes.

Tested by:	obrien, marcel
2003-08-12 19:33:36 +00:00
Marcel Moolenaar
9df7b8eac4 Implement cpu_set_upcall_kse(). Further tweaking may be needed after
testing.
2003-08-11 01:38:23 +00:00
Andrew Gallatin
c8aacbdaa8 MFI386: Acquire the page queues lock in pmap_insert_entry(), from
i386/i386/pmap.c 1.423
2003-08-07 18:35:16 +00:00
John Baldwin
3bdbd658f1 - Since td_critnest is now initialized in MI code, it doesn't have to be
set in cpu_critical_fork_exit() anymore.
- As far as I can tell, cpu_thread_link() has never been used, not even
  when it was originally added, so remove it.
2003-08-04 20:32:45 +00:00
David E. O'Brien
a98a5f06d3 Style sync. 2003-08-03 07:50:19 +00:00
Marcel Moolenaar
5ba809ff66 In set_mcontext(), store the (user) stack pointer and the thread
pointer in the PCB of the corresponding thread if it's not the
current thread.  This is needed for thr_create() to setup the
newly created thread from the context provided by the application.

This commit finalizes supporting libthr.
2003-07-31 05:27:00 +00:00
Bosko Milekic
b053bc8407 Make sure that when the PV ENTRY zone is created in pmap, that it's
created not only with UMA_ZONE_VM but also with UMA_ZONE_NOFREE.  In
the i386 case in particular, the pmap code would hook a special
page allocation routine that allocated from kernel_map and not kmem_map,
and so when/if the pageout daemon drained the zones, it could actually
push out slabs from the PV ENTRY zone but call UMA's default page_free,
which resulted in pages allocated from kernel_map being freed to
kmem_map; bad.  kmem_free() ignores the return value of the
vm_map_delete and just returns.  I'm not sure what the exact
repercussions could be, but it doesn't look good.

In the PAE case on i386, we also set-up a zone in pmap, so be
conservative for now and make that zone also ZONE_NOFREE and
ZONE_VM.  Do this for the pmap zones for the other archs too,
although in some cases it may not be entirely necessarily.  We'd
rather be safe than sorry at this point.

Perhaps all UMA_ZONE_VM zones should by default be also
UMA_ZONE_NOFREE?

May fix some of silby's crashes on the PV ENTRY zone.
2003-07-31 03:39:51 +00:00
Peter Wemm
ad7a226f9d Deal with 'options KSTACK_PAGES' being a global option. 2003-07-31 01:31:32 +00:00
Marcel Moolenaar
8b04492f2c In cpu_thread_setup(), set md_pcbpaddr to the physical address of
the pcb. We use the physical address for context switching.
While here, fix a nearby style(9) bug.
2003-07-31 01:05:34 +00:00
Marcel Moolenaar
c9085788f6 In get_mcontext(), if we need to clear the return value, clear
FRAME_A3 as well. Otherwise swapcontext() will return -1.
2003-07-30 06:38:35 +00:00
Marcel Moolenaar
de22416ef6 Reset the per-CPU unique value at boot and clear it in the PCB of the
child when forking. This provides a consistent initial state.
Note that cpu_set_upcall() does not clear the per-CPU unique value as
it is followed by a call to set_mcontext(), which sets it accordingly.
2003-07-27 23:45:48 +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
Alan Cox
059358675e MFi386 revision 1.416
Add vm object locking to pmap_prefault().

Note: powerpc and sparc64 do not implement this function.
2003-07-25 18:58:39 +00:00
Marcel Moolenaar
e180afe760 Implement casuptr(). 2003-07-24 07:49:45 +00:00
Marcel Moolenaar
8af2fbd6fb In get_mcontext() and set_mcontext() save and restore the current
thread pointer.
2003-07-24 07:48:11 +00:00
Marcel Moolenaar
c8baa23e56 Implement alpha_pal_wrunique() and alpha_pal_rdunique(). Both are
used to set and get the thread pointer. Note that a context switch
will automaticly save and restore the thread pointer.
2003-07-24 07:41:08 +00:00
Marcel Moolenaar
286cc49014 Use a spare for the thread pointer (mc_thrptr). The thread pointer
is only read and written by set_mcontext() and get_mcontext() for
use by threading libraries.
2003-07-24 07:34:31 +00:00
Bernd Walter
b7c901eba2 Enable eisa support on alpha.
We need eisa bridge support on some models, which now depends on having
eisa in the kernel.
2003-07-21 19:15:25 +00:00
David Xu
20a2d71332 Rename thread_siginfo to cpu_thread_siginfo.
Suggested by: jhb
2003-07-15 00:11:04 +00:00
Alan Cox
6e3bf93111 MFi386
Updates to cnt.v_wire_count, the global count of wired pages, should be
 performed using atomic ops.
2003-07-06 20:32:42 +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
3b8caa9bab Oops, add back a free() call that I mistakenly removed in
my last commit.
2003-07-01 21:20:51 +00:00
Maxime Henrion
73f0b07961 Sync with i386's busdma backend. This fixes a few bugs and adds
support for the BUS_DMA_NOWAIT flag in bus_dmamap_load().
2003-07-01 19:02:26 +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
Marcel Moolenaar
25ae78c736 Implement fuword32() and suword32(). These functions are used in
kern_thread.c. This is a best effort implementation.
2003-06-29 17:14:42 +00:00
Alan Cox
4a309ab44c MFi386
Add vm object locking to pmap_object_init_pt().
2003-06-28 21:21:04 +00:00
Bernd Walter
7d83324cdc enable interrupt routing for mcpcia based systems
Reviewed by:	mjacob, gallatin
2003-06-28 13:47:23 +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
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
Alan Cox
40ebf3e43a Fix a performance bug in all of the various implementations of
uma_small_alloc(): They always zeroed the page regardless of what the
caller requested.
2003-06-18 02:57:38 +00:00
David Xu
87e31fda52 Don't set TDF_UPCALLING in cpu_set_upcall, it is not only used by
SA process.
2003-06-15 00:54:07 +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
Peter Wemm
77e2a274d0 GC unused cpu_wait() function 2003-06-11 05:20:33 +00:00
David E. O'Brien
61334e3b42 Use __FBSDID(). 2003-06-10 17:31:31 +00:00
David E. O'Brien
a880eba3cf Use __FBSDID(). 2003-06-10 17:10:18 +00:00
David E. O'Brien
f59584cd7f Use __FBSDID(). 2003-06-10 17:02:51 +00:00
David E. O'Brien
fa58a9089f Use __FBSDID(). 2003-06-10 16:50:43 +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
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
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
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