MFC r267372-267374: fix various misimplementation of instructions.

Submitted by:	Wolf Ramovsky <wolf.ramovsky gmail.com>


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/8@268102 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r243080:

  Only pass ip[46].addr when _addrl contains a value

Partial MFC r204759:

  Redirect stdin from /dev/null when starting a jail:
    At least in RELENG_7 this fixes some start problems for some programs
    from the ports. It is also more correct, as a jail shall not expect
    input (interactivity) from the jail-host.

PR:		180916


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/8@268168 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r266814

Initialize r_flags the same way in all cases using a sanitized copy of
flags that has several bits cleared. The RF_WANTED and RF_FIRSTSHARE
bits are invalid in this context, and we want to defer setting RF_ACTIVE
in r_flags until later.  This should make rman_get_flags() return
the correct answer in all cases.

Add a KASSERT() to catch callers which incorrectly pass the RF_WANTED
or RF_FIRSTSHARE flags.

Do a strict equality check on the share type bits of flags.  In
particular, do an equality check on RF_PREFETCHABLE.  The previous
code would allow one type of mismatch of RF_PREFETCHABLE but disallow
the other type of mismatch.  Also, ignore the the RF_ALIGNMENT_MASK
bits since alignment validity should be handled by the amask check.
This field contains an integer value, but previous code did a strange
bitwise comparison on it.

Leave the original value of flags unmolested as a minor debug aid.

Change the start+amask overflow check to a KASSERT() since it is just
meant to catch a highly unlikely programming error in the caller.

Reviewed by:	jhb


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/8@268228 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC: r268095

Actually pro AMD chipsets, making r244146 (MFCed to stable/8 in r245801) work.

Sponsored by:	Bally Wulff Games & Entertainment GmbH


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/8@268252 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f