Commit Graph

43133 Commits

Author SHA1 Message Date
marcel
92a56e0f1b Remove prototype of unaligned_fixup() and fix a nearby style(9)
bug.
2003-10-23 06:21:44 +00:00
marcel
74d6568906 Add prototypes for spillfd() and unaligned_fixup(). 2003-10-23 06:20:38 +00:00
marcel
9298bcdbb4 Add spillfd(). This function loads a double-precision FP register
at the first address and spills it to the second address. This
allows unaligned_fixup() to update the context of the process in
a way that assures proper rounding.
Similar functions for single-and extended-precision are added when
needed.
2003-10-23 06:19:06 +00:00
marcel
52a61b01ad Hook-up the new disassembler. 2003-10-23 06:11:37 +00:00
peter
e56b7aabda Use a more robust API altogether for the amd64_get_fsbase() etc functions. 2003-10-23 06:06:14 +00:00
marcel
4f18f4daa0 Add a new disassembler that improves over the previous disassembler
in that it provides an abstract (intermediate) representation for
instructions. This significantly improves working with instructions
such as emulation of instructions that are not implemented by the
hardware (e.g. long branch) or enhancing implemented instructions
(e.g. handling of misaligned memory accesses). Not to mention that
it's much easier to print instructions.

Functions are included that provide a textual representation for
opcodes, completers and operands.

The disassembler supports all ia64 instructions defined by revision
2.1 of the SDM (Oct 2002).
2003-10-23 06:01:52 +00:00
peter
951b71c1b7 Look at the equipment list for amd64 as well as i386 for autodetecting
floppy drives in the absence of hints.
2003-10-23 05:52:52 +00:00
imp
15a4c57d43 Fix mismerge from one tree to another: add ( 2003-10-23 05:33:53 +00:00
peter
647bf6f4e8 Renumber the sysarch vectors for amd64 specific syscalls so that I can
implement i386 compat numbers where it makes sense.  This would save a
syscall translation layer.  Yes, this breaks the abi slightly again, but
fortunately its just a recompile rather than tweaking the source.  I will
be fixing the libc stubs while I'm here.
2003-10-23 05:31:23 +00:00
imp
98808f99c2 more unused item cleanup 2003-10-23 04:53:33 +00:00
imp
37e75337c2 BASE is no longer used, and is an appendix. Remove it. 2003-10-23 04:50:35 +00:00
imp
85e50985be Learn basic C.
((uint32_t *) v) + 10 != ((caddr_t) v) + 10
so apply the cast later.
2003-10-23 03:42:47 +00:00
simokawa
08700a775a Reduce debug messages. 2003-10-23 01:55:03 +00:00
njl
18bf90d7da Allow access to the field if it is within the region size rounded up
to a multiple of the access byte width.  This overcomes errors in the
AML often found in Toshiba laptops.  These errors were allowed by
the Microsoft ASL compiler and interpreter.  This will NOT be imported
by ACPI-CA so make the change on our local branch.  File was already off
the vendor branch.

Submitted by:	blaz
Original idea:	Rick Richardson for Linux
2003-10-22 22:30:57 +00:00
njl
67f989102e Add the ACPICA_PEDANTIC option which is off by default. Enabling it will
enable strict checks of the AML.  Our default behavior will be to relax
checks to work on as many platforms as possible.  Also clean up and document
other ACPI options while I'm here.
2003-10-22 22:27:49 +00:00
rwatson
966f1ed0b5 mac_Finish break-out of kern_mac.c into parts:
Include src/sys/security/mac/mac_internal.h in kern_mac.c.

  Remove redundant defines from the include: SYSCTL_DECL(), debug macros,
    composition macros.

  Unstaticize various bits now exposed to the remainder of the kernel:
    mac_init_label(), mac_destroy_label().

  Remove all the functions now implemented in mac_process/mac_vfs/mac_net/
    mac_pipe.  Also remove debug counters, sysctls exporting debug
    counters, enforcement flags, sysctls exporting enforcement flags.

  Leave module declaration, sysctl nodes, mactemp malloc type, system
    calls.

This should conclude MAC/LINT/NOTES breakage from the break-out process,
but I'm running builds now to make sure I caught everything.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-10-22 20:59:31 +00:00
rwatson
bae92ad3e6 Variable cleanup following break-out of kern_mac.c into sys/security/mac:
Unstaticize mac_late.
  Remove ea_warn_once, now in mac_vfs.c.
  Unstaticisize mac_policy_list, mac_static_policy_list, use
    struct mac_policy_list_head instead of LIST_HEAD() directly.
  Unstaticize and un-inline MAC policy locking functions so they can
    be referenced from mac_*.c.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-10-22 20:47:41 +00:00
rwatson
e36fe77ad7 Rename error_select() to mac_error_select(), and unstaticize so it
can be used from src/sys/security/mac/mac_*.c.

Obtained from:	TrustedBSD Project
Sponosred by:	DARPA, Network Associates Laboratories
2003-10-22 20:42:22 +00:00
rwatson
c61b588bc8 Hook up to the build for options MAC:
security/mac/mac_net.c
	security/mac/mac_pipe.c
	security/mac/mac_process.c
	security/mac/mac_system.c
	security/mac/mac_vfs.c

Note: Here begins a period of NOTES/LINT build breakage due to duplicate
symbols that will shortly be removed from kern_mac.c.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-10-22 20:39:33 +00:00
rwatson
b297dc7322 Remove non-VFS related code from mac_vfs.c. Leave:
Extended attribute transaction warning flag if transactions aren't
  supported on the EA implementation being used.

  Debug fallback flag to permit a less conservative fallback if reading
  an on-disk label fails.

  Enforce_fs toggle to enforce file systme access control.

  Debugging counters for file system objects: mounts, vnodes, devfs_dirents.

  Object initialization, destruction, copying, internalization,
  externalization, relabeling for file system objects.

  Life cycle operations for devfs entries.

  Generic extended attribute label implementation for use by UFS, UFS2 in
  multilabel mode.

  Generic single-level label implementation for use by all file systems
  when in singlelabel mode.

  Exec-time transition based on file label entry points.

  Vnode operation access control checks (many).

  Mount operation access control checks (few).

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-10-22 20:29:41 +00:00
phk
d7e0132261 Fix a braino memory leak.
Found by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2003-10-22 20:28:46 +00:00
rwatson
ea8fde8275 Remove non-system bits from mac_system.c. Leave:
Enforce_kld, enforce_system access control toggles.
  Access control checks for: kenv operation, kld operations,
    sysarch_ioperm(), acct(), nfsd(), reboot(), settime(), swapon(),
    swapoff(), sysctl().

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-10-22 20:09:12 +00:00
rwatson
99a9310ddf Remove non-credential/process-related bits from mac_process.c. Leave:
Enforce_process, enforce_vm access control enforcement twiddles.
  Credential, process label counters.
  VM revocation sysctls/tunables.
  Credential label management, internalization/externalization/relabel
    code.
  Process label management.
  Proc0, proc1 creation, cred creation.
  Thread userret.
  mac_execve_enter(), _exit(), transition at exec-time.
  VM revocation on process label change.
  Process-related access control checks (visibility, debug, signal, sched).

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-10-22 20:02:04 +00:00
rwatson
07917a99a1 Remove non-pipe code from mac_pipe.c. Leave:
Pipe enforcement flag.
  Pipe object debugging counters.
  MALLOC type for MAC label storage.
  Pipe MAC label management routines, externalize/internalization/change
    routines.
  Pipe MAC access control checks.

Un-staticize functions called from mac_set_fd() when operating on a
pipe.  Abstraction improvements in this space seem likely.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-10-22 19:31:57 +00:00
ume
e0831e433f we have ppsratecheck(). 2003-10-22 19:23:51 +00:00
rwatson
e4d75ae386 Remove non-network related contents from mac_net.c. Leave:
Network and socket enforcement toggles.
  Counters for network objects (mbufs, ifnets, bpfdecs, sockets, and ipqs).
  Label management routines for network objects.
  Life cycle events for network objects.
  Label internalization/externalization/relabel for ifnets, sockets,
    including ioctl implementations for sockets, ifnets.
  Access control checks relating to network obejcts.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-10-22 19:15:34 +00:00
ume
caf3332c51 IP6Q_LOCK_CHECK -> IP6Q_LOCK_ASSERT.
Sugested by:	sam
2003-10-22 19:03:49 +00:00
tegge
77f7b5a60e Initialize bp->b_offset to the physical offset in partition
so GEOM knows where to read from disk.
2003-10-22 18:57:59 +00:00
ume
75025ec654 drop the code of HAVE_NRL_INPCB part. our system doesn't
use NRL style INPCB.
2003-10-22 18:52:57 +00:00
rwatson
a0221fd813 The following shared types/constants/interfaces/... are required
in mac_internal.h:

  Sysctl tree declarations.

  Policy list structure definition.

  Policy list variables (static, dynamic).

  mac_late flag.

  Enforcement flags for process, vm, which have checks in multiple files.

  mac_labelmbufs variable to drive conditional mbuf labeling.

  M_MACTEMP malloc type.

  Debugging counter macros.

  MAC Framework infrastructure primitives, including policy locking
    primitives, kernel label initialization/destruction, userland
    label consistency checks, policy slot allocation.

  Per-object interfaces for objects that are internalized and externalized
    using system calls that will remain centrally defined: credentials,
    pipes, vnodes.

  MAC policy composition macros: MAC_CHECK, MAC_BOOLEAN, MAC_EXTERNALIZE,
    MAC_INTERNALIZE, MAC_PERFORM.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-10-22 18:49:29 +00:00
alc
794553172b - Retire vm_pageout_page_free(). Instead, use vm_page_select_cache() from
vm_pageout_scan().  Rationale: I don't like leaving a busy page in the
   cache queue with neither the vm object nor the vm page queues lock held.
 - Assert that the page is active in vm_pageout_page_stats().
2003-10-22 18:41:32 +00:00
ume
b9e84a6697 pretect ip6 reassemble queue by use of mutex.
Submitted by:	rwatson (with modification)
2003-10-22 15:32:56 +00:00
ume
55ad7e749c - implement lock around IPv6 reassembly, to avoid panic due to
frag6_drain (mutex version will come later).
- limit number of fragments (not fragment queues) in kernel.

Obtained from:	KAME
2003-10-22 15:29:42 +00:00
ume
75c947372b protect sid_default and sid.
Submitted by:	rwatson (with modification)
2003-10-22 15:13:36 +00:00
ume
6018d9bfc9 reduce calling in6_addr2zoneid(). 2003-10-22 15:12:06 +00:00
ume
bf4d53d977 protect by IFNET_RLOCK. 2003-10-22 15:10:39 +00:00
suz
d11ff9f6a5 more strict sanity check for ESP tail
Obtained from: KAME
2003-10-22 10:44:59 +00:00
harti
73542e98c6 Some upgrade instructions. 2003-10-22 07:44:45 +00:00
harti
b3b7780dfa This commit was generated by cvs2svn to compensate for changes in r121326,
which included commits to RCS files with non-trunk default branches.
2003-10-22 07:41:16 +00:00
harti
9651c80ecb Virgin import of the NgATM SAAL layer shared kernel/user part v0.9. 2003-10-22 07:41:16 +00:00
harti
b9a34c0f98 Remove a gcc-ism: declaring a variable array at the end of a structure
as [0] and replace it with the ISO way of writing []. This has caused
warnings with WARNS=6.
2003-10-22 07:35:05 +00:00
phk
5a35d3b764 Forgotten commit: If a provider has zero sectorsize, it is an
indication of lack of media.

Tripped up:	peter
2003-10-22 06:32:20 +00:00
sam
2174581a5c terminate the rx descriptor list with a self-linked entry
so high phy error rates on a 5212 don't cause rx overruns
2003-10-22 04:37:34 +00:00
alc
8382cb8835 - Assert that every page found in the active queue is an active page. 2003-10-22 03:08:24 +00:00
mjacob
bb1fc42f6c Turn off ISP_SMPLOCK- not to be turned on again.
Until we can have perfect knowledge that all callers above us think it's okay
for us to sleep, releasing *our* locks of course, we don't dare try and sleep.
2003-10-21 21:52:23 +00:00
ume
5199c863f8 - change scope to zone.
- change node-local to interface-local.
- better error handling of address-to-scope mapping.
- use in6_clearscope().

Obtained from:	KAME
2003-10-21 20:05:32 +00:00
alc
35743f84b8 - Assert that the containing vm object is locked in
vm_page_set_validclean().  (This function reads and modifies the
   vm page's valid field, which is synchronized by the lock on the
   containing vm object.)
2003-10-21 19:36:51 +00:00
sos
63e0f3bdf5 Properly unload the DMA SG list on errors. 2003-10-21 19:25:20 +00:00
sos
08d97161dc Fix the DMA problem that most severely hit on the DS3112a SATA chip
in connection with Marvell based SATA->PATA dongles.

The problem was caused by a combination of things working
together to make it hard to spot...

The ATA driver has always started the ATA command, then build
the SG list for DMA and then finally started the DMA engine.
While this is according to specs, it poses a potential
problem as some controllers apparently do not allow for unlimitted
time between starting the ATA command and starting the DMA engine.

At about the same time as ATAng was committed there were lots
of other changes applied, some of which was locking in parts
that causes the busdma load functions to take significantly
longer to load the SG list.

This pushed the time spent between starting the ATA command and
starting the DMA engine over the hill for some controllers
(especially the Silicon Image DS3112a) and caused what looked
like lost interrupts.

The solution is to get all the SG list work or rather all
busdma related stuff done before we even try to start anything.

This has the nice side effect of seperating busdma out the
way it should be, so the working of the ATA machinery is not
cluttered up with busdma droppings, making the code easier
to read and understand.
2003-10-21 19:20:37 +00:00
silby
f0e686a675 Change all SYSCTLS which are readonly and have a related TUNABLE
from CTLFLAG_RD to CTLFLAG_RDTUN so that sysctl(8) can provide
more useful error messages.
2003-10-21 18:28:36 +00:00
silby
7552dbf14b Add another sysctl flag, CTLFLAG_TUN, which is a hint to the userland
sysctl that a given variable is tunable.

Also added is CTLFLAG_RDTUN, which is CTLFLAG_RD|CTLFLAG_TUN; TUN does
not always imply read-only, so RDTUN should be used where RD was used
before.
2003-10-21 16:48:33 +00:00
rwatson
3873350b0f Line-break sync to the MAC development branch. 2003-10-21 15:18:26 +00:00
simokawa
aeab60718e We need to initialize bp->b_offset and bp->b_iooffset
becuase bp->b_blkno is ignored now.
2003-10-21 13:18:19 +00:00
tjr
39d2858393 Reject negative ngrp arguments in linux_setgroups() and linux_setgroups16();
stops users being able to cause setgroups to clobber the kernel stack by
copying in data past the end of the linux_gidset array.
2003-10-21 11:00:33 +00:00
sos
b85e19be51 Up the alignment requirement of the SC1100 to 16 bytes, it has all the bugs and then some of its Cyrix inheritance.
Set the max_iosize for the Cyrix to 63K as the SC1100.
2003-10-21 08:53:29 +00:00
scottl
0564a95894 Don peril-sensitive sunglasses and mark pipe(2) as MPSAFE. I've beaten up
on it for the last 15 hours with no signs of problems.  It gives a small
(1%) gain on buildworld since pipe_read/pipe_write are already free of Giant.
2003-10-21 07:03:27 +00:00
phk
c78e94ed98 Retire bio_caller2 (alias for b_io.bio_caller2), this field is reserved
for dev_strategy() use.

Retire bio_driver[12] (aliases for b_io.bio_driver[12]) these fields are
reserved for device driver use and can as such never have any interest
in the buf end of things.
2003-10-21 06:58:58 +00:00
phk
01dad440c7 Remove KASSERTS on B_PHYS for vmapbuf() and vunmapbuf(), B_PHYS is going
away.
2003-10-21 06:53:10 +00:00
marcel
7df6e35964 Remove md_bspstore from the MD fields of struct thread. Now that
the backing store is at a fixed address, there's no need for a
per-thread variable.
2003-10-21 01:13:49 +00:00
sam
b058e8665f revert default for idle polling to zero until we can resolve the
livelock problem
2003-10-20 21:14:24 +00:00
jeff
d477fdf956 - If a thread is not bound to a kse return 0 from sched_pctcpu().
Reported by:	 pawel.worach@nordea.com
2003-10-20 19:55:21 +00:00
alc
eecac55b7d - Remove some long unused code. 2003-10-20 18:57:01 +00:00
alc
512489f301 Initialize the buf's b_object in pbgetvp(). Clear it in pbrelvp(). (This
facilitates synchronization of the vm page's valid field using the
vm object's lock.)

Suggested by:	tegge
2003-10-20 18:24:38 +00:00
sam
3d2d2c4fd8 fix build: linux_to_bsd_msf_lba is no longer used because of previous commit 2003-10-20 17:56:10 +00:00
ume
01f1aaf295 enclose IPv6 part with ifdef INET6.
Obtained from:	KAME
2003-10-20 16:19:01 +00:00
dwmalone
72e9866f3d Mark dup as MPSAFE. Giant was pushed into dup ages ago, but it looks
like it was missed in syscalls.master.

Spotted by:	alc
2003-10-20 16:16:03 +00:00
ume
1bfb498609 correct linkmtu handling.
Obtained from:	KAME
2003-10-20 15:27:48 +00:00
phk
6b3ae2c6aa Remember to check the DE_WHITEOUT flag in the case where a cloned
device is hidden by a devfs(8) rule.

Spotted by:	 Adam Nowacki <ptnowak@bsk.vectranet.pl>
2003-10-20 15:08:10 +00:00
sos
e83edc4bf6 If just gcc could make up its mind... 2003-10-20 14:28:37 +00:00
sos
0468baeb3f Only return valid DMA error bits. 2003-10-20 13:45:11 +00:00
sos
c0bf81d66c Up delay from 10 to 100ms after reset, this helps some slow devices
get their act together before we start probing.
2003-10-20 13:44:33 +00:00
sos
cff8e144fe Only announce ECC errors when its only that. 2003-10-20 13:32:42 +00:00
tjr
f2b3ceb410 Fix some security bugs in the SVR4 emulator:
- Return NULL instead of returning memory outside of the stackgap
  in stackgap_alloc() (FreeBSD-SA-00:42.linux)
- Check for stackgap_alloc() returning NULL in svr4_emul_find(),
  and clean_pipe().
- Avoid integer overflow on large nfds argument in svr4_sys_poll()
- Reject negative nbytes argument in svr4_sys_getdents()
- Don't copy out past the end of the struct componentname
  pathname buffer in svr4_sys_resolvepath()
- Reject out-of-range signal numbers in svr4_sys_sigaction(),
  svr4_sys_signal(), and svr4_sys_kill().
- Don't malloc() user-specified lengths in show_ioc() and
  show_strbuf(), place arbitrary limits instead.
- Range-check lengths in si_listen(), ti_getinfo(), ti_bind(),
  svr4_do_putmsg(), svr4_do_getmsg(), svr4_stream_ti_ioctl().

Some fixes obtain from OpenBSD.
2003-10-20 10:38:48 +00:00
sos
82da7f6b49 We dont support CDROMREADAUDIO anymore. 2003-10-20 09:51:00 +00:00
sos
e5803507e0 Remove no longer existant CDIOCREADAUDIO ioctl. 2003-10-20 09:29:40 +00:00
phk
c096f8aa94 When a driver successfully created a device on demand, we can directly
pick up the DEVFS inode number from the dev_t and find our directory
entry from that, we don't need to scan the directory to find it.

This also solves an issue with on-demand devices in subdirectories.

Submitted by:	cognet
2003-10-20 07:04:09 +00:00
alc
ba669f6199 - Synchronize access to a vm page's valid field using the containing
vm object's lock.
2003-10-20 05:57:55 +00:00
marcel
87282b0dcb Put the RSE backing store at a fixed address. This change is triggered
by libguile that needs to know the base of the RSE backing store. We
currently do not export the fixed address to userland by means of a
sysctl so user code needs to hardcode it for now. This will be revisited
later.

The RSE backing store is now at the bottom of region 4. The memory stack
is at the top of region 4. This means that the whole region is usable
for the stacks, giving a 61-bit stack space.

Port: lang/guile (depended of x11/gnome2)
2003-10-20 05:34:10 +00:00
alc
d681abd0f8 - Remove comments referring to functions that no longer exist. 2003-10-20 05:16:27 +00:00
cognet
18fc7b26c7 Various style and type fixes in my last commit.
Suggested by:	mux
2003-10-20 04:10:20 +00:00
alc
9167e4667d - Hold the vm object's lock around calls to vm_page_set_validclean(). 2003-10-20 04:05:24 +00:00
silby
4c4e7a9593 Fix m_head handling in sis_encap so that the correct mbuf is always handed
to BPF_MTAP.
2003-10-19 23:28:02 +00:00
silby
fc5724e28c Fix a problem where m_defrag would allocate a new mbuf to replace the
chain passed into dc_encap, which dc_start was unaware of.  This caused
the old (now invalid) mbuf to be passed to BPF_MTAP.

Spotted by:	Kenjiro Cho <kjc@csl.sony.co.jp>
2003-10-19 23:05:19 +00:00
silby
4add8d9302 Add a new macro M_ASSERTVALID which ensures that the mbuf in question
is non-free.  (More checks can/should be added in the future.)

Use M_ASSERTVALID in BPF_MTAP so that we catch when freed mbufs are
passed in, even if no bpf listeners are active.

Inspired by a bug in if_dc caught by Kenjiro Cho.
2003-10-19 22:33:41 +00:00
phk
9f420bf43d Add a testcase which validates that the same buffer can be passed to
rijndael_blockDecrypt() as both input and output.

This property is important because inside rijndael we can get away
with allocating just a 16 byte "work" buffer on the stack (which
is very cheap), whereas the calling code would need to allocate the
full sized buffer, and in all likelyhood would have to do so with
an expensive malloc(9).
2003-10-19 22:12:23 +00:00
ume
8ff2c775d4 - revert to old rijndael code. new rijndael code broke gbde.
- since aes-xcbc-mac and aes-ctr require functions in new
  rijndael code, aes-xcbc-mac and aes-ctr are disabled for now.
2003-10-19 21:28:34 +00:00
dwmalone
be405a4cbd falloc allocates a file structure and adds it to the file descriptor
table, acquiring the necessary locks as it works. It usually returns
two references to the new descriptor: one in the descriptor table
and one via a pointer argument.

As falloc releases the FILEDESC lock before returning, there is a
potential for a process to close the reference in the file descriptor
table before falloc's caller gets to use the file. I don't think this
can happen in practice at the moment, because Giant indirectly protects
closes.

To stop the file being completly closed in this situation, this change
makes falloc set the refcount to two when both references are returned.
This makes life easier for several of falloc's callers, because the
first thing they previously did was grab an extra reference on the
file.

Reviewed by:	iedowse
Idea run past:	jhb
2003-10-19 20:41:07 +00:00
alc
676085d671 - Add vm object locking to vfs_clean_pages() and vfs_bio_set_validclean().
This is to synchronize access to the vm page's valid field by
   vm_page_set_validclean().
2003-10-19 20:39:06 +00:00
phk
b7c9250fa7 Remove KASSERT check for negative bio_offsets, add "normal" EIO
error return for same.
2003-10-19 19:06:54 +00:00
imp
92be84c4b4 Finish the removal of the bst/bsh confusion. 2003-10-19 17:38:04 +00:00
mux
d16b904dfe Remove debug printf(). 2003-10-19 14:33:00 +00:00
cognet
82c805f917 Implement partially /proc/<pid>/maps.
It looks enough to make SImics run.

Reviewed by:	des
2003-10-19 14:13:51 +00:00
nyan
eb1cd59204 MFi386: revision 1.577. 2003-10-19 11:35:44 +00:00
bms
6360d0a43d Fix LINT build by correcting a missed change. 2003-10-19 09:31:07 +00:00
njl
432ff6a541 Disable irqs before entering the power-off state. This is not known
to fix any problems but is similar to how Linux implements this
function.
2003-10-19 05:56:59 +00:00
peter
7b3a8f1308 Tidy up loose ends in the idle process. Call the MI cpu_idle() function
for all platforms now.

XXX alpha/sparc64/powerpc should fill in the function.

Submitted by:  bde
2003-10-19 02:43:57 +00:00
peter
05de20ae7a Add a stub cpu_idle() function for sparc64, alpha, powerpc. This is a
MI declared function so it should be everywhere.
2003-10-19 02:36:07 +00:00
davidxu
f2c5a17d79 Use npxdrop in cpu_thread_exit to save some cycles.
Clear FPU pcb flags for new upcall thread, these flags needn't
be inherited, the new thread should start from clean FPU status.
2003-10-19 00:57:10 +00:00
imp
61abce2611 Don't confuse tags and handles. 2003-10-19 00:03:10 +00:00
alc
cc2c1485cf - Synchronize access to a vm page's valid field using the containing
vm object's lock.
 - Reduce the scope of the vm page queues lock in two places.
2003-10-19 00:01:56 +00:00
njl
8689796a4b Add the cpu_idle_hook() function pointer so that other idlers can be
hooked at runtime.  Make C1 sleep (e.g., HLT) be the default.  This
prepares the way for further ACPI sleep states.
2003-10-18 22:25:07 +00:00
alc
fb13ea0aa9 - Synchronize access to the page's valid field in
vnode_pager_generic_getpages() using the containing object's lock.
2003-10-18 21:30:29 +00:00
alc
bccf1d15ab - Increase the object lock's scope in vm_contig_launder() so that access
to the object's type field and the call to vm_pageout_flush() are
   synchronized.
 - The above change allows for the eliminaton of the last parameter
   to vm_pageout_flush().
 - Synchronize access to the page's valid field in vm_pageout_flush()
   using the containing object's lock.
2003-10-18 21:09:21 +00:00
bms
39bde695bf Fix a typo. The module has the EISA front-end commented out, therefore the
error may not have been picked up right away.

Reviewed by:	mdodd
Submitted by:	Stuart Walsh
2003-10-18 20:44:23 +00:00
phk
50ecf36141 Initialize b_iooffset before calling VOP_[SPEC]STRATEGY 2003-10-18 19:49:46 +00:00
phk
4b7ade98cd Initialize b_iooffset before calling strategy 2003-10-18 19:48:21 +00:00
alc
d9e9583e64 Corrections to revision 1.305
- Specifying VM_MAP_WIRE_HOLESOK should not assume that the start
   address is the beginning of the map.  Instead, move to the first
   entry after the start address.
 - The implementation of VM_MAP_WIRE_HOLESOK was incomplete.  This
   caused the failure of mlockall(2) in some circumstances.
2003-10-18 18:48:17 +00:00
phk
ba114823c5 Retire b_pblkno which was an alias for a bio field which is for
device drivers only.
2003-10-18 18:17:55 +00:00
phk
80b79c02da Don't report b_pblkno, it is going away. 2003-10-18 17:59:02 +00:00
phk
36a05b5ad5 Do not initialize bp->b_pblkno, it is going away. 2003-10-18 17:57:48 +00:00
phk
b3eb57c5d4 Retire bio_blkno entirely.
bio_offset is the field drivers should use.
bio_pblkno remains as a convenient place to store the number of
the device drivers.
2003-10-18 17:53:34 +00:00
phk
5a1c5c9c13 Eliminate use bio_blkno. 2003-10-18 17:51:26 +00:00
ume
42120d22ea rtfree() must be called in lock context.
Reported by:	jhay
2003-10-18 17:46:23 +00:00
phk
313310b9a6 Discontinue bio_blkno usage. 2003-10-18 17:45:45 +00:00
phk
583ddf14d7 Discontinue bio_blkno, use bio_offset instead. 2003-10-18 17:44:01 +00:00
phk
8714e3267f Eliminate reporting of bio_blkno. 2003-10-18 17:28:36 +00:00
phk
adc5cdd07a Report bio_pblkbo instead of bio_blkno. 2003-10-18 17:27:10 +00:00
phk
94a1f5bcd6 Use bio_offset instead of bio_blkno 2003-10-18 17:26:13 +00:00
phk
466d3b80d8 No need to initialize bio_pblkno from bio_blkno, disksort uses bio_offset. 2003-10-18 17:24:51 +00:00
phk
b60969a35e Make bioq_disksort() sort on the bio_offset field instead of bio_pblkno. 2003-10-18 15:50:56 +00:00
imp
cec43b43e0 Transition to using bus_space macros rather than the inb/outb/etc.
Use EP_{READ,WRITE}{,_MULTI}_{1,2,4} instead.  I've had several people
submit patches like this over the years of varying qualities, markm
being the last.  The names were chosen in consulation with mdodd on
irc.

I've tested this with only PCMCIA cards: 3CCE589EC and 3CCSH572BT.
I've not tried with my more extensive ISA, EISA and cbus collection.

Reviewed by: mdodd
2003-10-18 15:22:43 +00:00
phk
4c2cb3f397 DuH!
bp->b_iooffset (the spot on the disk), not bp->b_offset (the offset in
the file)
2003-10-18 14:10:28 +00:00
phk
d004fc1e31 I think rwatson got the sign wrong here... 2003-10-18 12:16:17 +00:00
phk
d985a757f9 Don't initialize unused bio_blkno field. 2003-10-18 11:25:42 +00:00
phk
3905ba5d0a Initialize bp->b_offset before calling VOP_[SPEC]STRATEGY() 2003-10-18 11:16:33 +00:00
phk
1e371cc970 Initialize bp->b_offset before calling VOP_STRATEGY().
Remove KASSERTS and panics with B_PHYS checks which no longer apply.
2003-10-18 11:14:29 +00:00
phk
bd00da531d Initialize bp->b_offset before calling VOP_STRATEGY() 2003-10-18 11:13:31 +00:00
phk
902030340d Initialize bp->b_offset before calling VOP_[SPEC]STRATEGY().
Remove stale comment about B_PHYS.
2003-10-18 11:11:05 +00:00
phk
4f15f97a05 Initialize b_offset before calling VOP_SPECSTRATEGY() 2003-10-18 11:08:33 +00:00
phk
bd34a4ab18 Initialize bp->b_offset before calling VOP_[SPEC]STRATEGY() 2003-10-18 11:08:04 +00:00
phk
7279dea9d5 Initialize b_offset before calling VOP_STRATEGY/VOP_SPECSTRATEGY.
Remove various comments of KASSERTS and comments about B_PHYS which
does not apply anymore.
2003-10-18 11:06:15 +00:00
phk
011e3f22c7 Initialize bp->b_offset and remove comment about B_PHYS. 2003-10-18 11:02:24 +00:00
phk
8b8970c045 There is no need to muck about with the B_PHYS flag here. We never even
get close to DEV_STRATEGY() which is the only place it is relevant.
2003-10-18 11:01:11 +00:00
phk
a347a9d216 We do not get B_PHYS buffers here anymore. /dev/drum is long gone. 2003-10-18 09:33:13 +00:00
phk
6b528c7911 Convert some if(bla) panic("foo") to KASSERTS to improve grep-ability. 2003-10-18 09:32:39 +00:00
markm
715845d8e6 Mark as __unused some arguments that are, erm, unused. 2003-10-18 09:16:01 +00:00
phk
3dfc831549 The size and contents of the DEV_STRATEGY() macro has progressed to
the point where it being a macro is no longer sensible, and it will
only be more so in days to come.

BIO_STRATEGY() is now only used from DEV_STRATEGY() and should not
be used directly anymore.

Put the contents of both in the new function dev_strategy() and
make DEV_STRATEGY() call that function.

In addition, this allows us to make the rather magic bufdonebio()
helper function static.

This alse saves hunderedandsome bytes of code in a typical kernel.
2003-10-18 09:03:15 +00:00
phk
eec76e0d92 Rearrange the deck-chairs while we wait for scottl to GEOMify RF. 2003-10-18 08:58:35 +00:00
simokawa
8b6083e5fd Add SBP-II target mode driver.
Though this is still incomplete and has some missing features such as
exclusive login and event notification, it may be enough for someone
who wants to play with it.

This driver is supposed to work with firewire(4), targ(4) of CAM(4)
and scsi_target(8) which can be found in /usr/share/example/scsi_target.
This driver doesn't require sbp(4) which implements initiator mode.

Sample configuration:

Kernel: (you can use modules as well)
device	firewire
device	scbus
device	targ
device	sbp_targ

After reboot:
# mdconfig -a -t malloc -s 10m
md0
# scsi_target 0:0:0 /dev/md0
(Assuming sbp_targ0 on scbus0)

You should find the 10MB HDD on FreeBSD/MacOS X/WinXP or whatever connected
to the target using FireWire.

Manpage is not finished yet.
2003-10-18 05:41:31 +00:00
simokawa
f8104f75ff - Call sbp_reset_start() for mgm timeout.
- Change type of target->luns to allocate an array of LUNs dynamically.
	This allows targets to change their number of LUNs after each bus reset.
- Serialize ORB POINTER command for each LUN.
- Improve debug messages.
2003-10-18 04:59:47 +00:00
rwatson
9be7eda223 Wrap db_active check in #ifdef DDB, as db_active is not defined ifndef
DDB.
2003-10-18 02:23:57 +00:00
rwatson
bf32888a2a Add a new cn_flags fields to struct consdev, the low-level console
definition structure.  Define one flag, CN_FLAG_NODEBUG, which
indicates the console driver cannot be used in the context of the
debugger.  This may be used, for example, if the console device
interacts with kernel services that cannot be used from the
debugger context, such as the network stack.  These drivers are
skipped over for calls to cn_checkc() and cn_putc(), and the
calling function simply moves on to the next available console.
2003-10-18 02:13:39 +00:00
sam
68dcd813b1 fix station mode breakage (repeat after me: "test every change, no
matter how small...")
2003-10-17 23:59:11 +00:00
sam
eefb2fc9e8 add statistics for all failures and/or abnormal events; still need
to add per-node statistics
2003-10-17 23:15:30 +00:00
sam
a6b5975f25 fixup debug msgs 2003-10-17 22:15:26 +00:00
sam
45942b2f20 include FH/DS parameters element in probe response frames 2003-10-17 22:09:20 +00:00
sam
c0c1db86a0 o consolidate rx filter calculations in one place
o enable beacon reception when operating in adhoc mode
  so the 802.11 layer can use them to create nodes for peers
2003-10-17 21:58:39 +00:00
sam
23522eb855 correct comment 2003-10-17 21:56:42 +00:00
sam
2053001848 indicate device receives all management frames 2003-10-17 21:55:53 +00:00
sam
98b46f244c o add capability to indicate if device receives all management frames
o use recv mgmt capability to decide if outbound frames should be
  discarded if no node table entry is present
2003-10-17 21:54:59 +00:00
scottl
49356e4d0e Fix a couple of bugs with AIF handling:
- Correct the logic for the AIF array index pointers so that correct slot is
   always looked at.
 - Copy the full FIB payload size when copying AIF's, not just the first 64
   bytes.

Thanks to Mirapoint, Inc, for pointing these problems out and offering a
solution.
2003-10-17 21:44:06 +00:00
sam
365e4629ed parameterize locking to improve portability and possible
change to different locking strategies
2003-10-17 21:41:52 +00:00
jeff
1869c3be82 - Remove the correct thread from the run queue in setrunqueue(). This
fixes ULE + KSE.
2003-10-17 20:53:04 +00:00
ume
a5d2658456 use ND_IFINFO(). 2003-10-17 20:20:14 +00:00
ume
31759c0525 nuke duplicate function and unused function.
Obtained from:	KAME
2003-10-17 17:50:09 +00:00
ume
89eb79f30b revert wrongly dropped null check by previous commit. 2003-10-17 17:34:31 +00:00
ume
babf2c3ec0 - add dom_if{attach,detach} framework.
- transition to use ifp->if_afdata.

Obtained from:	KAME
2003-10-17 15:46:31 +00:00
mckusick
b19170c4ba When expunging unlinked files from a snapshot, skip over holes in the
file rather than panicing with "indiracct: botched params".

Submitted by:	Mark Santcroos <marks@ripe.net>
2003-10-17 13:57:58 +00:00
phk
888092f317 Simplify count_dev() 2003-10-17 11:56:48 +00:00
alc
29c05d8a9b - Synchronize access to a vm page's valid field using the containing
vm object's lock.
 - Release the vm object and vm page queues locks around vput().
2003-10-17 05:07:17 +00:00
peter
c7a92905e0 Halt the cpu on amd64 as well. For some strange reason, this makes
a fair bit of difference to the power consumption and lets my cpu cool
down enough for the temperature sensitive fan controller to completely
stop the cpu fan at times.
2003-10-17 03:49:03 +00:00
marcel
1d3178bbc0 Implement cpu_idle() on ia64. We put the processor in a lightweight
halt state that minimizes power consumption while still preserving
cache and TLB coherency. Halting the processor is not conditional at
this time. Tested with UP and SMP kernels.
2003-10-17 02:24:59 +00:00
jeff
7a27809dea - The kse may be null in sched_pctcpu().
Reported by:	kris
2003-10-16 21:13:14 +00:00
jeff
fcda5c4f74 - Only kse_reassign() in the !running case.
Reported by:	kris
2003-10-16 20:32:57 +00:00
jeff
3b6db25186 - Call sched_add() with the correct argument on SMP.
Reported by:	Valentin Chopov <valentin@valcho.net>
2003-10-16 20:06:19 +00:00
sam
81a0698b6a fix horribly botched MFp4 merge 2003-10-16 19:55:28 +00:00
sam
104396b82e pfil hooks can modify packet contents so check if the destination
address has been changed when PFIL_HOOKS is enabled and, if it has,
arrange for the proper action by ip*_forward.

Submitted by:	Pyun YongHyeon
Supported by:	FreeBSD Foundation
2003-10-16 18:57:45 +00:00
sam
f9a0664908 pfil hooks can modify packet contents so check if the destination
address has been changed when PFIL_HOOKS is enabled and, if it has,
arrange for the proper action by ip*_forward.

Supported by:	FreeBSD Foundation
Submitted by:	Pyun YongHyeon
2003-10-16 16:25:25 +00:00
sam
aa3ae742c3 Drop dummynet lock when calling back into the network stack to deliver
packets.  This eliminates a LOR with Giant that caused outbound pipes
to fail.

Supported by:	FreeBSD Foundation
2003-10-16 16:21:25 +00:00
sam
bf970aa6cf Correct handling of cloning loop avoidance: rtalloc1 may return a null
pointer in which case we should not do the unlock.

Supported by:	FreeBSD Foundatin
2003-10-16 16:17:17 +00:00
sam
2044616f8e o correct handling of a frame that has too many segments to fit in the
tx descriptor array
o while here fix a whitespace nit

Obtained from:	NetBSD
2003-10-16 16:13:11 +00:00
ume
0fb87ae0ef AF_LINK sockaddr has to be attached to ifp->if_addrlist until the
end, as many of the code assumes that TAILQ_FIRST(ifp->if_addrlist)
is non-null.

Submitted by:	itojun
2003-10-16 13:38:29 +00:00
dfr
300addad5e Changes for new SMP-safe kobj method dispatch algorithm. 2003-10-16 13:29:26 +00:00
bde
bfb4a0a2c1 Don't forget to load %es with the kernel data segment selector in
Xcpustop().  %es is used in at least the call to savectx() when savectx()
calls bcopy(), so not loading it was fatal if a stop IPI interrupts
user mode.

This reduces bugs starting and stopping CPUs for debuggers.  CPUs are
stopped mainly in kdb_trap() and cpu_reset().  At reset time there is
a good chance that all the CPUs are in the kernel, so the bug was
probably harmless then.
2003-10-16 10:44:24 +00:00
jeff
6e062906a7 - Fix a minor problem with my last commit, we don't want to return from
sched_switch if the thread is running, we want to fall through and pick
   a new thread because we have been preempted.
2003-10-16 10:04:54 +00:00
jeff
f21d0fada6 - mtx_ownedby() was unpopular and is no longer needed. Remove it. 2003-10-16 09:48:09 +00:00
dfr
72e3738dce Add a workaround for the fact that the priv field was removed from
struct driver. We were the last user of that field (and we are scheduled
for demolition) so there wasn't much point in keeping it.
2003-10-16 09:18:35 +00:00
dfr
3dac505582 * Add multiple inheritance to kobj. Each class can have zero or more base
classes and if a method is not found in a given class, its base classes
  are searched (in the order they were declared). This search is recursive,
  i.e. a method may be define in a base class of a base class.
* Change the kobj method lookup algorithm to one which is SMP-safe. This
  relies only on the constraint that an observer of a sequence of writes
  of pointer-sized values will see exactly one of those values, not a
  mixture of two or more values. This assumption holds for all processors
  which FreeBSD supports.
* Add locking to kobj class initialisation.
* Add a simpler form of 'inheritance' for devclasses. Each devclass can
  have a parent devclass. Searches for drivers continue up the chain of
  devclasses until either a matching driver is found or a devclass is
  reached which has no parent. This can allow, for instance, pci drivers
  to match cardbus devices (assuming that cardbus declares pci as its
  parent devclass).
* Increment __FreeBSD_version.

This preserves the driver API entirely except for one minor feature used
by the ISA compatibility shims. A workaround for ISA compatibility will
be committed separately. The kobj and newbus ABI has changed - all modules
must be recompiled.
2003-10-16 09:16:28 +00:00
jeff
4aea3a9433 - Collapse sched_switchin() and sched_switchout() into sched_switch(). Now
mi_switch() calls sched_switch() which calls cpu_switch().  This is
   actually one less function call than it had been.
2003-10-16 08:53:46 +00:00
jeff
991febf6dd - Update the sched api. sched_{add,rem,clock,pctcpu} now all accept a td
argument rather than a kse.
2003-10-16 08:39:15 +00:00
jeff
bf29a9dd12 - The non iterative algorithm for interact_update was broken due to
rounding errors.  This was the source of the majority of the
   interactivity problems.  Reintroduce the old algorithm and its XXX.
 - Up the interactivity threshold to 30.  It really could stand to be even
   a tiny bit higher.
 - Let the sleep and run time accumulate up to 5 seconds of history rather
   than two.  This helps stop XFree86 from becoming non-interactive during
   bursts of activity.
2003-10-16 08:17:43 +00:00
phk
d00fd6c26e Bump FreeBSD version for changed layout of cdevsw 2003-10-16 07:58:37 +00:00
mckusick
0dd6703d54 Malloc buckets of size 128 have been having their 64-byte offset
trashed after being freed. This has caused several panics including
kern/42277 related to soft updates. Jim Kuhn tracked the problem
down to ipfw limit rule processing.  In the expiry of dynamic rules,
it is possible for an O_LIMIT_PARENT rule to be removed when it still
has live children.  When the children eventually do expire, a pointer
to the (long gone) parent is dereferenced and a count decremented.
Since this memory can, and is, allocated for other purposes (in the
case of kern/42277 an inodedep structure), chaos ensues. The offset
in question in inodedep is the offset of the 16 bit count field in
the ipfw2 ipfw_dyn_rule.

Submitted by:	Jim Kuhn <jkuhn@sandvine.com>
Reviewed by:	"Evgueni V. Gavrilov" <aquatique@rusunix.org>
Reviewed by:	Ben Pfountz <netprince@vt.edu>
MFC after:	1 week
2003-10-16 02:00:12 +00:00
obrien
8eb262a2d5 Quiet warnings about mis-matched pointer assignment.
Tested on:	PowerPC
2003-10-15 20:05:57 +00:00
phk
c7ba6f536a Introduce a new optional memberfunction for cdevsw, fdopen() which
passes the fdidx from VOP_OPEN down.

This is for all I know the final API for this functionality, but
the locking semantics for messing with the filedescriptor from
the device driver are not settled at this time.
2003-10-15 20:00:59 +00:00
ps
58d350029a Print the correct logical drive lun number returned by the controller. 2003-10-15 18:52:44 +00:00
sam
baa5cf51cd purge extraneous ';'s
Supported by:	FreeBSD Foundation
Noticed by:	bde
2003-10-15 18:19:28 +00:00
shiba
24ea734c5d Add Allied Telesis SIC-AT boards support.
Discussed in from [FreeBSD-tech-jp 3396] to [FreeBSD-tech-jp 3407]
at FreeBSD-tech-jp@jp.freebsd.org.

NOTE: We must put ed_probe_SIC() function into if_ed_isa.c because
      this is a bus dependent code. But the ed driver code is not
      separated explicitly whether it is bus dependent or independent
      now.

Refer to: http://plaza17.mbn.or.jp/~chi/myprog/FreeBSD/sicat.html
Submitted by: chi@bd.mbn.or.jp (Chiharu Shibata)
2003-10-15 17:22:15 +00:00
phk
35212ae1a1 Make sure to pull in all relevant crypto for GEOM_BDE 2003-10-15 08:53:04 +00:00
alc
b722f9a630 - vm_fault_copy_entry() should not assume that the source object contains
every page.  If the source entry was read-only, one or more wired pages
   could be in backing objects.
 - vm_fault_copy_entry() should not set the PG_WRITEABLE flag on the page
   unless the destination entry is, in fact, writeable.
2003-10-15 08:00:45 +00:00
jeff
72dab909cc - If our user_pri doesn't match our actual priority our priority has been
elevated either due to priority propagation or because we're in the
   kernel in either case, put us on the current queue so that we dont
   stop others from using important resources.  At some point the priority
   elevations from sleeping in the kernel should go away.
 - Remove an optimization in sched_userret().  Before we would only set
   NEEDRESCHED if there was something of a higher priority available.  This
   is a trivial optimization and it breaks priority propagation because it
   doesn't take threads which we may be blocking into account.  Notice that
   the thread which is blocking others gets up to one tick of cpu time before
   we honor this NEEDRESCHED in sched_clock().
2003-10-15 07:47:06 +00:00
deischen
d5430e8218 Add a wrapper for a function that takes and releases the adapter
lock around a call to the original function.  Make the timeout
function in callout_reset() use the wrapped function to avoid a
lock assertion panic.

Reviewed by:	sam
Reported by:	cgiordano@ids.net
2003-10-15 05:34:41 +00:00
peter
8cbefc5894 The KERN_PROC_PROC sysctl took 4 args in 5.0-REL and 5.1-REL. We need to
accept this for a bit longer.  Requiring the new order of 3 args only
was not very helpful.
2003-10-15 03:11:46 +00:00
peter
8f60b15573 Pull the tier-2 card one last time and break the get/setcontext and
sigreturn() ABI and the signal context on the stack.

Make the trapframe (and its shadows in the ucontext and sigframe etc)
8 bytes larger in order to preserve 16 byte stack alignment for the
following C code calls.  I could have done some padding after the
trapframe was saved, but some of the C code still expects an argument of
'struct trapframe'.  Anyway, this gives me a spare field that can be used
to store things like 'partial trapframe' status or something else in
the future.

The runtime impact is fairly small, *except* for threaded apps and things
that decode contexts and the signal stack (eg: cvsup binary).  Signal
delivery isn't too badly affected because the kernel generates the
sigframe that sigreturn uses after the handler has been called.

The size of mcontext_t and struct sigframe hasn't changed.  Only
the last few fields (sc_eip etc) got moved a little and I eliminated
a spare field.  mc_len/sc_len did change location though so the
sanity checks there will still trap it.
2003-10-15 02:04:52 +00:00
peter
1e073a3aa6 Get some more data if we hit the pmap_enter() thing. 2003-10-15 00:45:35 +00:00
sam
55681a746c o convert mutex calls to #defines for portability, etc.
o destroy mutex's on detach (was missing)
2003-10-14 22:51:45 +00:00
rsm
3989051f82 Major update to xe driver:
- Make multicast work
- Fix (some of) the watchdog timeouts after card reset
- Add support for CE2, CEM28 and CEM33 cards
- General code cleanup

Any card that worked previously should still work, as well as a lot that
didn't.

The driver is not yet style(9) compliant; those changes are forthcoming,
once the functional changes are done.

PR:		kern/50644
Reviewed by:	imp
Approved by:	imp
2003-10-14 22:51:35 +00:00
sam
5355d8b454 Lock ip forwarding route cache. While we're at it, remove the global
variable ipforward_rt by introducing an ip_forward_cacheinval() call
to use to invalidate the cache.

Supported by:	FreeBSD Foundation
2003-10-14 19:19:12 +00:00
sam
5daf1cdd10 MFp4: correct locking issues in nd6_lookup
Supported by:	FreeBSD Foundation
2003-10-14 18:49:08 +00:00
sam
a771df1391 remove dangling ';'s` that were harmless
Supported by:	FreeBSD Foundation
2003-10-14 18:45:50 +00:00