Merge ^/head r304965 through r305016.

This commit is contained in:
Dimitry Andric 2016-08-29 18:59:43 +00:00
commit aa1b0edd53
54 changed files with 940 additions and 3349 deletions

View File

@ -4,7 +4,7 @@ SRCDIR=${.CURDIR}/../../../..
.include "${.CURDIR}/../Makefile.common"
.PATH: ${.CURDIR}/..
TESTSDIR?= ${TESTSBASE}/cddl/sbin/zfsd
TESTSDIR?= ${TESTSBASE}/cddl/usr.sbin/zfsd
PLAIN_TESTS_CXX= zfsd_unittest
SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc}

View File

@ -72,7 +72,6 @@ using std::string;
using std::stringstream;
using DevdCtl::Event;
using DevdCtl::EventBuffer;
using DevdCtl::EventFactory;
using DevdCtl::EventList;
using DevdCtl::Guid;

View File

@ -108,6 +108,12 @@ public:
* \brief No-op copy constructor for nonexistent vdevs.
*/
Vdev();
/**
* \brief No-op virtual destructor, since this class has virtual
* functions.
*/
virtual ~Vdev();
bool DoesNotExist() const;
/**
@ -145,6 +151,10 @@ private:
extern Vdev NonexistentVdev;
//- Vdev Inline Public Methods ------------------------------------------------
inline Vdev::~Vdev()
{
}
inline DevdCtl::Guid
Vdev::PoolGUID() const
{

File diff suppressed because it is too large Load Diff

View File

@ -426,7 +426,6 @@ __LA_DECL void archive_entry_copy_mac_metadata(struct archive_entry *, const voi
#define ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY 0x10000000
#define ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS 0x20000000
#define ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS 0x40000000
#define ARCHIVE_ENTRY_ACL_ENTRY_INHERITED 0x80000000
#define ARCHIVE_ENTRY_ACL_INHERITANCE_NFS4 \
(ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT \
@ -502,8 +501,8 @@ __LA_DECL int archive_entry_acl_next_w(struct archive_entry *, int /* want_type
* ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each
* default ACL entry, as used in old Solaris ACLs.
*/
#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 16384
#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 32768
#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024
#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048
__LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *,
int /* flags */);
__LA_DECL const char *archive_entry_acl_text(struct archive_entry *,

View File

@ -411,116 +411,75 @@ setup_acls(struct archive_read_disk *a,
{
const char *accpath;
acl_t acl;
#if HAVE_ACL_IS_TRIVIAL_NP
int r;
#endif
accpath = archive_entry_sourcepath(entry);
if (accpath == NULL)
accpath = archive_entry_pathname(entry);
if (*fd < 0 && a->tree != NULL) {
if (a->follow_symlinks ||
archive_entry_filetype(entry) != AE_IFLNK)
*fd = a->open_on_current_dir(a->tree,
accpath, O_RDONLY | O_NONBLOCK);
if (*fd < 0) {
if (a->tree_enter_working_dir(a->tree) != 0) {
archive_set_error(&a->archive, errno,
"Couldn't access %s", accpath);
return (ARCHIVE_FAILED);
}
}
}
archive_entry_acl_clear(entry);
acl = NULL;
#ifdef ACL_TYPE_NFS4
/* Try NFS4 ACL first. */
#if HAVE_ACL_GET_FD_NP
if (*fd >= 0)
acl = acl_get_fd_np(*fd, ACL_TYPE_NFS4);
#endif
if (acl == NULL) {
acl = acl_get_fd(*fd);
#if HAVE_ACL_GET_LINK_NP
if (!a->follow_symlinks)
acl = acl_get_link_np(accpath, ACL_TYPE_NFS4);
else if (!a->follow_symlinks)
acl = acl_get_link_np(accpath, ACL_TYPE_NFS4);
#else
if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK)) }
/* We can't get the ACL of a symlink, so we assume
it can't have one. */
acl = NULL;
}
else if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK))
/* We can't get the ACL of a symlink, so we assume it can't
have one. */
acl = NULL;
#endif
}
if (acl == NULL)
else
acl = acl_get_file(accpath, ACL_TYPE_NFS4);
if (acl != NULL) {
#if HAVE_ACL_IS_TRIVIAL_NP
/* Ignore "trivial" ACLs that just mirror the file mode. */
if (acl_is_trivial_np(acl, &r) == 0) {
if (r) {
acl_free(acl);
acl = NULL;
return (ARCHIVE_OK);
}
}
#endif
r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
/* Ignore "trivial" ACLs that just mirror the file mode. */
acl_is_trivial_np(acl, &r);
if (r) {
acl_free(acl);
return (r);
acl = NULL;
}
#endif
if (acl != NULL) {
translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
acl_free(acl);
return (ARCHIVE_OK);
}
#endif
/* Retrieve access ACL from file. */
if (*fd >= 0)
acl = acl_get_fd(*fd);
if (acl == NULL) {
#if HAVE_ACL_GET_LINK_NP
if (!a->follow_symlinks)
acl = acl_get_link_np(accpath, ACL_TYPE_ACCESS);
else if (!a->follow_symlinks)
acl = acl_get_link_np(accpath, ACL_TYPE_ACCESS);
#else
if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK)) {
/* We can't get the ACL of a symlink, so we assume it
can't have one. */
acl = NULL;
}
else if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK))
/* We can't get the ACL of a symlink, so we assume it can't
have one. */
acl = NULL;
#endif
}
if (acl == NULL)
else
acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
if (acl != NULL) {
#if HAVE_ACL_IS_TRIVIAL_NP
/* Ignore "trivial" ACLs that just mirror the file mode. */
if (acl_is_trivial_np(acl, &r) == 0) {
if (r) {
acl_free(acl);
acl = NULL;
return (ARCHIVE_OK);
}
}
#endif
r = translate_acl(a, entry, acl,
translate_acl(a, entry, acl,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
acl_free(acl);
acl = NULL;
if (r != 0)
return (r);
}
/* Only directories can have default ACLs. */
if (S_ISDIR(archive_entry_mode(entry))) {
acl = acl_get_file(accpath, ACL_TYPE_DEFAULT);
if (acl != NULL) {
r = translate_acl(a, entry, acl,
translate_acl(a, entry, acl,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
acl_free(acl);
if (r != 0)
return (r);
}
}
return (ARCHIVE_OK);
@ -576,23 +535,19 @@ translate_acl(struct archive_read_disk *a,
#ifdef ACL_TYPE_NFS4
acl_entry_type_t acl_type;
acl_flagset_t acl_flagset;
int brand;
int brand, r;
#endif
acl_entry_t acl_entry;
acl_permset_t acl_permset;
int i, entry_acl_type;
int r, s, ae_id, ae_tag, ae_perm;
int s, ae_id, ae_tag, ae_perm;
const char *ae_name;
#ifdef ACL_TYPE_NFS4
// FreeBSD "brands" ACLs as POSIX.1e or NFSv4
// Make sure the "brand" on this ACL is consistent
// with the default_entry_acl_type bits provided.
if (acl_get_brand_np(acl, &brand) != 0) {
archive_set_error(&a->archive, errno,
"Failed to read ACL brand");
return (ARCHIVE_FAILED);
}
acl_get_brand_np(acl, &brand);
switch (brand) {
case ACL_BRAND_POSIX:
switch (default_entry_acl_type) {
@ -600,43 +555,31 @@ translate_acl(struct archive_read_disk *a,
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
break;
default:
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid ACL entry type for POSIX.1e ACL");
return (ARCHIVE_FAILED);
// XXX set warning message?
return ARCHIVE_FAILED;
}
break;
case ACL_BRAND_NFS4:
if (default_entry_acl_type & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"ACL brand mismatch");
return (ARCHIVE_FAILED);
// XXX set warning message?
return ARCHIVE_FAILED;
}
break;
default:
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid ACL brand");
return (ARCHIVE_FAILED);
// XXX set warning message?
return ARCHIVE_FAILED;
break;
}
#endif
s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get ACL entry");
return (ARCHIVE_FAILED);
}
while (s == 1) {
ae_id = -1;
ae_name = NULL;
ae_perm = 0;
if (acl_get_tag_type(acl_entry, &acl_tag) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL tag type");
return (ARCHIVE_FAILED);
}
acl_get_tag_type(acl_entry, &acl_tag);
switch (acl_tag) {
case ACL_USER:
ae_id = (int)*(uid_t *)acl_get_qualifier(acl_entry);
@ -676,12 +619,8 @@ translate_acl(struct archive_read_disk *a,
// non-NFSv4 ACLs
entry_acl_type = default_entry_acl_type;
#ifdef ACL_TYPE_NFS4
if (default_entry_acl_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
if (acl_get_entry_type_np(acl_entry, &acl_type) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL type from an NFSv4 ACL entry");
return (ARCHIVE_FAILED);
}
r = acl_get_entry_type_np(acl_entry, &acl_type);
if (r == 0) {
switch (acl_type) {
case ACL_ENTRY_TYPE_ALLOW:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
@ -695,64 +634,40 @@ translate_acl(struct archive_read_disk *a,
case ACL_ENTRY_TYPE_ALARM:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALARM;
break;
default:
archive_set_error(&a->archive, errno,
"Unknown NFSv4 ACL entry type: %d", acl_type);
return (ARCHIVE_FAILED);
}
}
/*
* Libarchive stores "flag" (NFSv4 inheritance bits)
* in the ae_perm bitmap.
*/
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get flagset from an NFSv4 ACL entry");
return (ARCHIVE_FAILED);
}
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
r = acl_get_flag_np(acl_flagset, acl_inherit_map[i].platform_inherit);
if (r == -1) {
archive_set_error(&a->archive, errno,
"Failed to check flag in a NFSv4 ACL flagset");
return (ARCHIVE_FAILED);
} else if (r)
/*
* Libarchive stores "flag" (NFSv4 inheritance bits)
* in the ae_perm bitmap.
*/
// XXX acl_get_flagset_np on FreeBSD returns EINVAL for
// non-NFSv4 ACLs
r = acl_get_flagset_np(acl_entry, &acl_flagset);
if (r == 0) {
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
if (acl_get_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit))
ae_perm |= acl_inherit_map[i].archive_inherit;
}
}
#endif
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL permission set");
return (ARCHIVE_FAILED);
}
acl_get_permset(acl_entry, &acl_permset);
for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
/*
* acl_get_perm() is spelled differently on different
* platforms; see above.
*/
r = ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm);
if (r == -1) {
archive_set_error(&a->archive, errno,
"Failed to check permission in an ACL permission set");
return (ARCHIVE_FAILED);
} else if (r)
if (ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm))
ae_perm |= acl_perm_map[i].archive_perm;
}
r = archive_entry_acl_add_entry(entry, entry_acl_type,
archive_entry_acl_add_entry(entry, entry_acl_type,
ae_perm, ae_tag,
ae_id, ae_name);
if (r != 0)
return (r);
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get ACL entry");
return (ARCHIVE_FAILED);
}
}
return (ARCHIVE_OK);
}

View File

@ -203,10 +203,6 @@ static int archive_read_format_tar_read_header(struct archive_read *,
static int checksum(struct archive_read *, const void *);
static int pax_attribute(struct archive_read *, struct tar *,
struct archive_entry *, const char *key, const char *value);
static int pax_attribute_acl(struct archive_read *, struct tar *,
struct archive_entry *, const char *, int);
static int pax_attribute_xattr(struct archive_entry *, const char *,
const char *);
static int pax_header(struct archive_read *, struct tar *,
struct archive_entry *, char *attr);
static void pax_time(const char *, int64_t *sec, long *nanos);
@ -1706,52 +1702,6 @@ pax_attribute_xattr(struct archive_entry *entry,
return 0;
}
static int
pax_attribute_acl(struct archive_read *a, struct tar *tar,
struct archive_entry *entry, const char *value, int type)
{
int r;
const char* errstr;
switch (type) {
case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
errstr = "SCHILY.acl.access";
break;
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
errstr = "SCHILY.acl.default";
break;
case ARCHIVE_ENTRY_ACL_TYPE_NFS4:
errstr = "SCHILY.acl.ace";
break;
default:
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Unknown ACL type: %d", type);
return(ARCHIVE_FATAL);
}
if (tar->sconv_acl == NULL) {
tar->sconv_acl =
archive_string_conversion_from_charset(
&(a->archive), "UTF-8", 1);
if (tar->sconv_acl == NULL)
return (ARCHIVE_FATAL);
}
r = archive_acl_parse_l(archive_entry_acl(entry), value, type,
tar->sconv_acl);
if (r != ARCHIVE_OK) {
if (r == ARCHIVE_FATAL) {
archive_set_error(&a->archive, ENOMEM,
"%s %s", "Can't allocate memory for ",
errstr);
return (r);
}
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC, "%s %s", "Parse error: ", errstr);
}
return (r);
}
/*
* Parse a single key=value attribute. key/value pointers are
* assumed to point into reasonably long-lived storage.
@ -1862,20 +1812,53 @@ pax_attribute(struct archive_read *a, struct tar *tar,
case 'S':
/* We support some keys used by the "star" archiver */
if (strcmp(key, "SCHILY.acl.access") == 0) {
r = pax_attribute_acl(a, tar, entry, value,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
if (r == ARCHIVE_FATAL)
return (r);
if (tar->sconv_acl == NULL) {
tar->sconv_acl =
archive_string_conversion_from_charset(
&(a->archive), "UTF-8", 1);
if (tar->sconv_acl == NULL)
return (ARCHIVE_FATAL);
}
r = archive_acl_parse_l(archive_entry_acl(entry),
value, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
tar->sconv_acl);
if (r != ARCHIVE_OK) {
err = r;
if (err == ARCHIVE_FATAL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory for "
"SCHILY.acl.access");
return (err);
}
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Parse error: SCHILY.acl.access");
}
} else if (strcmp(key, "SCHILY.acl.default") == 0) {
r = pax_attribute_acl(a, tar, entry, value,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
if (r == ARCHIVE_FATAL)
return (r);
} else if (strcmp(key, "SCHILY.acl.ace") == 0) {
r = pax_attribute_acl(a, tar, entry, value,
ARCHIVE_ENTRY_ACL_TYPE_NFS4);
if (r == ARCHIVE_FATAL)
return (r);
if (tar->sconv_acl == NULL) {
tar->sconv_acl =
archive_string_conversion_from_charset(
&(a->archive), "UTF-8", 1);
if (tar->sconv_acl == NULL)
return (ARCHIVE_FATAL);
}
r = archive_acl_parse_l(archive_entry_acl(entry),
value, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT,
tar->sconv_acl);
if (r != ARCHIVE_OK) {
err = r;
if (err == ARCHIVE_FATAL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory for "
"SCHILY.acl.default");
return (err);
}
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Parse error: SCHILY.acl.default");
}
} else if (strcmp(key, "SCHILY.devmajor") == 0) {
archive_entry_set_rdevmajor(entry,
(dev_t)tar_atol10(value, strlen(value)));

View File

@ -153,18 +153,9 @@ set_acl(struct archive *a, int fd, const char *name,
if (entries == 0)
return (ARCHIVE_OK);
acl = acl_init(entries);
if (acl == (acl_t)NULL) {
archive_set_error(a, errno,
"Failed to initialize ACL working storage");
return (ARCHIVE_FAILED);
}
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
&ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
if (acl_create_entry(&acl, &acl_entry) != 0) {
archive_set_error(a, errno,
"Failed to create a new ACL entry");
return (ARCHIVE_FAILED);
}
acl_create_entry(&acl, &acl_entry);
switch (ae_tag) {
case ARCHIVE_ENTRY_ACL_USER:
@ -195,84 +186,53 @@ set_acl(struct archive *a, int fd, const char *name,
break;
#endif
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unknown ACL tag: %d", ae_tag);
return (ARCHIVE_FAILED);
/* XXX */
break;
}
#ifdef ACL_TYPE_NFS4
r = 0;
switch (ae_type) {
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
break;
case ARCHIVE_ENTRY_ACL_TYPE_DENY:
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY);
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY);
break;
case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT);
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT);
break;
case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM);
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM);
break;
case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
// These don't translate directly into the system ACL.
break;
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unknown ACL entry type: %d", ae_type);
return (ARCHIVE_FAILED);
}
if (r != 0) {
archive_set_error(a, errno,
"Failed to set ACL entry type");
return (ARCHIVE_FAILED);
// XXX error handling here.
break;
}
#endif
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to get ACL permission set");
return (ARCHIVE_FAILED);
}
if (acl_clear_perms(acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to clear ACL permissions");
return (ARCHIVE_FAILED);
}
acl_get_permset(acl_entry, &acl_permset);
acl_clear_perms(acl_permset);
for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
if (ae_permset & acl_perm_map[i].archive_perm)
if (acl_add_perm(acl_permset,
acl_perm_map[i].platform_perm) != 0) {
archive_set_error(a, errno,
"Failed to add ACL permission");
return (ARCHIVE_FAILED);
}
acl_add_perm(acl_permset,
acl_perm_map[i].platform_perm);
}
#ifdef ACL_TYPE_NFS4
if (acl_type == ACL_TYPE_NFS4) {
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
archive_set_error(a, errno,
"Failed to get flagset from an NFSv4 ACL entry");
return (ARCHIVE_FAILED);
}
if (acl_clear_flags_np(acl_flagset) != 0) {
archive_set_error(a, errno,
"Failed to clear flags from an NFSv4 ACL flagset");
return (ARCHIVE_FAILED);
}
// XXX acl_get_flagset_np on FreeBSD returns EINVAL for
// non-NFSv4 ACLs
r = acl_get_flagset_np(acl_entry, &acl_flagset);
if (r == 0) {
acl_clear_flags_np(acl_flagset);
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
if (ae_permset & acl_inherit_map[i].archive_inherit) {
if (acl_add_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit) != 0) {
archive_set_error(a, errno,
"Failed to add flag to NFSv4 ACL flagset");
return (ARCHIVE_FAILED);
}
}
if (ae_permset & acl_inherit_map[i].archive_inherit)
acl_add_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit);
}
}
#endif

View File

@ -70,8 +70,6 @@ static void add_pax_attr_int(struct archive_string *,
static void add_pax_attr_time(struct archive_string *,
const char *key, int64_t sec,
unsigned long nanos);
static int add_pax_acl(struct archive_write *,
struct archive_entry *, struct pax *, int);
static ssize_t archive_write_pax_data(struct archive_write *,
const void *, size_t);
static int archive_write_pax_close(struct archive_write *);
@ -452,43 +450,6 @@ get_entry_symlink(struct archive_write *a, struct archive_entry *entry,
return (ARCHIVE_OK);
}
/* Add ACL to pax header */
static int
add_pax_acl(struct archive_write *a,
struct archive_entry *entry, struct pax *pax, int flags)
{
const char *p;
const char *attr;
int r;
if (flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS)
attr = "SCHILY.acl.access";
else if (flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)
attr = "SCHILY.acl.default";
else if (flags & ARCHIVE_ENTRY_ACL_TYPE_NFS4)
attr = "SCHILY.acl.ace";
else
return(ARCHIVE_FATAL);
r = archive_entry_acl_text_l(entry, flags, &p, NULL,
pax->sconv_utf8);
if (r != 0) {
if (errno == ENOMEM) {
archive_set_error(&a->archive, ENOMEM, "%s %s",
"Can't allocate memory for ", attr);
return (ARCHIVE_FATAL);
}
archive_set_error(&a->archive,
ARCHIVE_ERRNO_FILE_FORMAT, "%s %s %s",
"Can't translate ", attr, " to UTF-8");
return(ARCHIVE_WARN);
} else if (p != NULL && *p != '\0') {
add_pax_attr(&(pax->pax_header),
attr, p);
}
return(ARCHIVE_OK);
}
/*
* TODO: Consider adding 'comment' and 'charset' fields to
* archive_entry so that clients can specify them. Also, consider
@ -505,7 +466,6 @@ archive_write_pax_header(struct archive_write *a,
const char *p;
const char *suffix;
int need_extension, r, ret;
int acl_access, acl_default, acl_nfs4;
int sparse_count;
uint64_t sparse_total, real_size;
struct pax *pax;
@ -1057,6 +1017,16 @@ archive_write_pax_header(struct archive_write *a,
if (!need_extension && p != NULL && *p != '\0')
need_extension = 1;
/* If there are non-trivial ACL entries, we need an extension. */
if (!need_extension && archive_entry_acl_count(entry_original,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS) > 0)
need_extension = 1;
/* If there are non-trivial ACL entries, we need an extension. */
if (!need_extension && archive_entry_acl_count(entry_original,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) > 0)
need_extension = 1;
/* If there are extended attributes, we need an extension */
if (!need_extension && archive_entry_xattr_count(entry_original) > 0)
need_extension = 1;
@ -1065,17 +1035,6 @@ archive_write_pax_header(struct archive_write *a,
if (!need_extension && sparse_count > 0)
need_extension = 1;
acl_access = archive_entry_acl_count(entry_original,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
acl_default = archive_entry_acl_count(entry_original,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
acl_nfs4 = archive_entry_acl_count(entry_original,
ARCHIVE_ENTRY_ACL_TYPE_NFS4);
/* If there are any ACL entries, we need an extension */
if (!need_extension && (acl_access + acl_default + acl_nfs4) > 0)
need_extension = 1;
/*
* Libarchive used to include these in extended headers for
* restricted pax format, but that confused people who
@ -1127,26 +1086,43 @@ archive_write_pax_header(struct archive_write *a,
add_pax_attr(&(pax->pax_header), "SCHILY.fflags", p);
/* I use star-compatible ACL attributes. */
if (acl_access > 0) {
ret = add_pax_acl(a, entry_original, pax,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS |
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID);
if (ret == ARCHIVE_FATAL)
r = archive_entry_acl_text_l(entry_original,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS |
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID,
&p, NULL, pax->sconv_utf8);
if (r != 0) {
if (errno == ENOMEM) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory for "
"ACL.access");
return (ARCHIVE_FATAL);
}
archive_set_error(&a->archive,
ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate ACL.access to UTF-8");
ret = ARCHIVE_WARN;
} else if (p != NULL && *p != '\0') {
add_pax_attr(&(pax->pax_header),
"SCHILY.acl.access", p);
}
if (acl_default > 0) {
ret = add_pax_acl(a, entry_original, pax,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT |
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID);
if (ret == ARCHIVE_FATAL)
return (ARCHIVE_FATAL);
}
if (acl_nfs4 > 0) {
ret = add_pax_acl(a, entry_original, pax,
ARCHIVE_ENTRY_ACL_TYPE_NFS4 |
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID);
if (ret == ARCHIVE_FATAL)
r = archive_entry_acl_text_l(entry_original,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT |
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID,
&p, NULL, pax->sconv_utf8);
if (r != 0) {
if (errno == ENOMEM) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory for "
"ACL.default");
return (ARCHIVE_FATAL);
}
archive_set_error(&a->archive,
ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate ACL.default to UTF-8");
ret = ARCHIVE_WARN;
} else if (p != NULL && *p != '\0') {
add_pax_attr(&(pax->pax_header),
"SCHILY.acl.default", p);
}
/* We use GNU-tar-compatible sparse attributes. */

View File

@ -32,6 +32,9 @@ basic_head()
}
basic_body()
{
# Begin FreeBSD
atf_tc_expect_fail "dirname //usr//bin doesn't return //usr like it used to; bug # 212193"
# End FreeBSD
atf_check -o inline:"/\n" dirname /
atf_check -o inline:"/\n" dirname //
atf_check -o inline:"/usr\n" dirname /usr/bin/

View File

@ -4,7 +4,6 @@ MIASM:= ${MIASM:Nfreebsd[467]_*}
SRCS+= __vdso_gettc.c
#MDASM= ptrace.S
MDASM= cerror.S \
shmat.S \
sigreturn.S \

View File

@ -4,7 +4,7 @@
SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \
amd64_set_gsbase.c
MDASM= vfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \
sbrk.S setlogin.S sigreturn.S
# Don't generate default code for these syscalls:

View File

@ -1,67 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
.asciz "@(#)ptrace.s 5.1 (Berkeley) 4/23/90"
#endif /* SYSLIBC_SCCS and not lint */
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
.globl CNAME(__error)
.type CNAME(__error),@function
ENTRY(ptrace)
pushq %rdi /* align stack */
pushq %rdi
pushq %rsi
pushq %rdx
pushq %rcx
#ifdef PIC
callq PIC_PLT(CNAME(__error))
#else
callq CNAME(__error)
#endif
popq %rcx
popq %rdx
popq %rsi
popq %rdi
popq %rdi
movl $0,(%rax)
mov $SYS_ptrace,%eax
KERNCALL
jb HIDENAME(cerror)
ret
END(ptrace)
.section .note.GNU-stack,"",%progbits

View File

@ -2,7 +2,7 @@
SRCS+= __vdso_gettc.c
MDASM= Ovfork.S brk.S cerror.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
MDASM= Ovfork.S brk.S cerror.S sbrk.S shmat.S sigreturn.S syscall.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o

View File

@ -1,51 +0,0 @@
/* $NetBSD: ptrace.S,v 1.7 2003/08/07 16:42:04 agc Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)ptrace.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
ENTRY(ptrace)
stmfd sp!, {r0-r3, lr}
sub sp, sp, #4 /* align stack */
bl PIC_SYM(_C_LABEL(__error), PLT)
add sp, sp, #4 /* unalign stack */
mov r1, #0x00000000
str r1, [r0]
ldmfd sp!, {r0-r3, lr}
SYSTRAP(ptrace)
bcs PIC_SYM(CERROR, PLT)
RET
END(ptrace)
.section .note.GNU-stack,"",%progbits

View File

@ -7,7 +7,7 @@ SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c
SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \
i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c
MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S \
sbrk.S setlogin.S sigreturn.S syscall.S
# Don't generate default code for these syscalls:

View File

@ -1,59 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
.asciz "@(#)ptrace.s 5.1 (Berkeley) 4/23/90"
#endif /* SYSLIBC_SCCS and not lint */
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
.globl CNAME(__error)
.type CNAME(__error),@function
ENTRY(ptrace)
#ifdef PIC
PIC_PROLOGUE
call PIC_PLT(CNAME(__error))
PIC_EPILOGUE
#else
call CNAME(__error)
#endif
movl $0,(%eax)
mov $SYS_ptrace,%eax
KERNCALL
jb HIDENAME(cerror)
ret
END(ptrace)
.section .note.GNU-stack,"",%progbits

View File

@ -335,6 +335,7 @@ int __sys_openat(int, const char *, int, ...);
int __sys_pselect(int, struct fd_set *, struct fd_set *,
struct fd_set *, const struct timespec *,
const __sigset_t *);
int __sys_ptrace(int, __pid_t, char *, int);
int __sys_poll(struct pollfd *, unsigned, int);
int __sys_ppoll(struct pollfd *, unsigned, const struct timespec *,
const __sigset_t *);

View File

@ -3,7 +3,7 @@
SRCS+= trivial-vdso_tc.c
MDASM= Ovfork.S brk.S cerror.S exect.S \
ptrace.S sbrk.S syscall.S
sbrk.S syscall.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o

View File

@ -1,71 +0,0 @@
/* $NetBSD: ptrace.S,v 1.9 2003/08/07 16:42:17 agc Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
ASMSTR("from: @(#)ptrace.s 8.1 (Berkeley) 6/4/93")
ASMSTR("$NetBSD: ptrace.S,v 1.9 2003/08/07 16:42:17 agc Exp $")
#endif /* LIBC_SCCS and not lint */
NESTED_NOPROFILE(ptrace, CALLFRAME_SIZ, ra)
.mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
SETUP_GP
PTR_SUBU sp, sp, CALLFRAME_SIZ
SETUP_GP64(CALLFRAME_GP, ptrace)
SAVE_GP(CALLFRAME_GP)
PTR_S ra, CALLFRAME_RA(sp)
PTR_LA t9, _C_LABEL(__error) # locate address of errno
jalr t9
PTR_L ra, CALLFRAME_RA(sp)
INT_S zero, 0(v0) # update errno value
li v0, SYS_ptrace
syscall
# Load __cerror's address using our gp, then restore it.
PTR_LA t9, __cerror
RESTORE_GP64
PTR_ADDU sp, sp, CALLFRAME_SIZ
bne a3, zero, 1f
j ra
1: j t9
END(ptrace)

View File

@ -1,6 +1,6 @@
# $FreeBSD$
MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S
MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o yield.o

View File

@ -1,61 +0,0 @@
/*-
* Copyright (c) 2002 Peter Grehan.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $NetBSD: ptrace.S,v 1.3 2000/02/23 20:16:57 kleink Exp $ */
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
ENTRY(ptrace)
mflr %r0
stwu %r1,-32(%r1)
stw %r0,36(%r1)
stw %r3,8(%r1)
stw %r4,12(%r1)
stw %r5,16(%r1)
stw %r6,20(%r1)
bl PIC_PLT(CNAME(__error))
li %r7,0
stw %r7,0(%r3)
lwz %r3,8(%r1)
lwz %r4,12(%r1)
lwz %r5,16(%r1)
lwz %r0,36(%r1)
lwz %r6,20(%r1)
mtlr %r0
la %r1,32(%r1)
li %r0,SYS_ptrace
sc
bso 1f
blr
1:
b PIC_PLT(HIDENAME(cerror))
END(ptrace)
.section .note.GNU-stack,"",%progbits

View File

@ -1,6 +1,6 @@
# $FreeBSD$
MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S
MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o yield.o

View File

@ -1,68 +0,0 @@
/*-
* Copyright (c) 2002 Peter Grehan.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $NetBSD: ptrace.S,v 1.3 2000/02/23 20:16:57 kleink Exp $ */
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
ENTRY(ptrace)
mflr %r0
std %r0,16(%r1)
stdu %r1,-80(%r1)
stw %r3,48(%r1)
stw %r4,52(%r1)
std %r5,56(%r1)
stw %r6,64(%r1)
bl CNAME(__error)
nop
li %r7,0
stw %r7,0(%r3)
lwz %r3,48(%r1)
lwz %r4,52(%r1)
ld %r5,56(%r1)
lwz %r6,64(%r1)
ld %r1,0(%r1)
ld %r0,16(%r1)
mtlr %r0
li %r0,SYS_ptrace
sc
bso 1f
blr
1:
stdu %r1,-48(%r1) /* lr already saved */
bl HIDENAME(cerror)
nop
ld %r1,0(%r1)
ld %r0,16(%r1)
mtlr %r0
blr
END(ptrace)
.section .note.GNU-stack,"",%progbits

View File

@ -12,7 +12,7 @@ SRCS+= __sparc_sigtramp_setup.c \
CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu
MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S sigaction1.S
MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S sigaction1.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o yield.o

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: ptrace.s,v 1.2 91/12/20 01:59:00 leres Exp
* from: NetBSD: ptrace.S,v 1.4 2000/07/24 00:11:10 mycroft Exp
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
.asciz "@(#)ptrace.s 8.1 (Berkeley) 6/4/93"
#if 0
RCSID("$NetBSD: ptrace.S,v 1.4 2000/07/24 00:11:10 mycroft Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
_SYSENTRY(ptrace)
save %sp, -CCFSZ, %sp
call CNAME(__error)
nop
stw %g0, [%o0]
restore
_SYSCALL(ptrace)
retl
nop
_SYSEND(ptrace)

View File

@ -48,6 +48,7 @@ INTERPOSED = \
poll \
ppoll \
pselect \
ptrace \
read \
readv \
recvfrom \

49
lib/libc/sys/ptrace.c Normal file
View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2016 The FreeBSD Foundation.
* All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice(s), this list of conditions and the following disclaimer as
* the first lines of this file unmodified other than the possible
* addition of one or more copyright notices.
* 2. Redistributions in binary form must reproduce the above copyright
* notice(s), this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/ptrace.h>
#include <errno.h>
#include "libc_private.h"
__weak_reference(_ptrace, ptrace);
int
_ptrace(int request, pid_t pid, caddr_t addr, int data)
{
errno = 0;
return (__sys_ptrace(request, pid, addr, data));
}

File diff suppressed because it is too large Load Diff

View File

@ -132,7 +132,11 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
* Unconditionally aligning does not cost very much, so do it if unsure
*/
#ifndef STRICT_ALIGN
# define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
# if !(defined(__i386) || defined (__amd64))
# define STRICT_ALIGN 1
# else
# define STRICT_ALIGN 0
# endif
#endif
/*

View File

@ -297,6 +297,8 @@ cleandepend:
rm -rf ${CLEANDEPENDDIRS}
.endif
.endif
.ORDER: cleandepend all
.ORDER: cleandepend depend
.if !target(checkdpadd) && (defined(DPADD) || defined(LDADD))
_LDADD_FROM_DPADD= ${DPADD:R:T:C;^lib(.*)$;-l\1;g}

View File

@ -156,6 +156,7 @@ clean:
-rm -rf ${CLEANDIRS}
.endif
.endif
.ORDER: clean all
cleandir: cleanobj

View File

@ -5153,8 +5153,7 @@ out:
}
/*
* pmap_zero_page zeros the specified hardware page by mapping
* the page into KVM and using bzero to clear its contents.
* Zero the specified hardware page.
*/
void
pmap_zero_page(vm_page_t m)
@ -5165,10 +5164,8 @@ pmap_zero_page(vm_page_t m)
}
/*
* pmap_zero_page_area zeros the specified hardware page by mapping
* the page into KVM and using bzero to clear its contents.
*
* off and size may not cover an area beyond a single hardware page.
* Zero an an area within a single hardware page. off and size must not
* cover an area beyond a single hardware page.
*/
void
pmap_zero_page_area(vm_page_t m, int off, int size)
@ -5182,24 +5179,20 @@ pmap_zero_page_area(vm_page_t m, int off, int size)
}
/*
* pmap_zero_page_idle zeros the specified hardware page by mapping
* the page into KVM and using bzero to clear its contents. This
* is intended to be called from the vm_pagezero process only and
* outside of Giant.
* Zero the specified hardware page in a way that minimizes cache thrashing.
* This is intended to be called from the vm_pagezero process only and
* outside of Giant.
*/
void
pmap_zero_page_idle(vm_page_t m)
{
vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
pagezero((void *)va);
sse2_pagezero((void *)va);
}
/*
* pmap_copy_page copies the specified (machine independent)
* page by mapping the page into virtual memory and using
* bcopy to copy the page, one machine dependent page at a
* time.
* Copy 1 specified hardware page to another.
*/
void
pmap_copy_page(vm_page_t msrc, vm_page_t mdst)

View File

@ -72,6 +72,30 @@ ENTRY(pagezero)
ret
END(pagezero)
/* Address: %rdi */
ENTRY(sse2_pagezero)
PUSH_FRAME_POINTER
movq $-PAGE_SIZE,%rdx
subq %rdx,%rdi
xorl %eax,%eax
jmp 1f
/*
* The loop takes 29 bytes. Ensure that it doesn't cross a 32-byte
* cache line.
*/
.p2align 5,0x90
1:
movnti %rax,(%rdi,%rdx)
movnti %rax,8(%rdi,%rdx)
movnti %rax,16(%rdi,%rdx)
movnti %rax,24(%rdi,%rdx)
addq $32,%rdx
jne 1b
sfence
POP_FRAME_POINTER
ret
END(sse2_pagezero)
ENTRY(bcmp)
PUSH_FRAME_POINTER
movq %rdx,%rcx

View File

@ -57,6 +57,7 @@ void gsbase_load_fault(void) __asm(__STRING(gsbase_load_fault));
void fpstate_drop(struct thread *td);
void pagezero(void *addr);
void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist);
void sse2_pagezero(void *addr);
struct savefpu *get_pcb_user_save_td(struct thread *td);
struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb);

View File

@ -497,7 +497,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
char *buf, size_t *rsize)
{
struct disk_devdesc *dev = (struct disk_devdesc *)devdata;
int blks;
int blks, remaining;
#ifdef BD_SUPPORT_FRAGS /* XXX: sector size */
char fragbuf[BIOSDISK_SECSIZE];
size_t fragsize;
@ -513,14 +513,15 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
if (rsize)
*rsize = 0;
if (dblk >= BD(dev).bd_sectors) {
DEBUG("IO past disk end %llu", (unsigned long long)dblk);
return (EIO);
}
if (dblk + blks > BD(dev).bd_sectors) {
/* perform partial read */
blks = BD(dev).bd_sectors - dblk;
/*
* Perform partial read to prevent read-ahead crossing
* the end of disk - or any 32 bit aliases of the end.
* Signed arithmetic is used to handle wrap-around cases
* like we do for TCP sequence numbers.
*/
remaining = (int)(BD(dev).bd_sectors - dblk); /* truncate */
if (remaining > 0 && remaining < blks) {
blks = remaining;
size = blks * BD(dev).bd_sectorsize;
DEBUG("short read %d", blks);
}

View File

@ -317,6 +317,10 @@ void bhnd_release_resources(device_t dev,
struct bhnd_chipid bhnd_parse_chipid(uint32_t idreg,
bhnd_addr_t enum_addr);
int bhnd_chipid_fixed_ncores(
const struct bhnd_chipid *cid,
uint16_t chipc_hwrev, uint8_t *ncores);
int bhnd_read_chipid(device_t dev,
struct resource_spec *rs,
bus_size_t chipc_offset,

View File

@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <machine/resource.h>
#include <dev/bhnd/siba/sibareg.h>
#include <dev/bhnd/cores/chipc/chipcreg.h>
#include "nvram/bhnd_nvram.h"
@ -840,6 +842,63 @@ bhnd_parse_chipid(uint32_t idreg, bhnd_addr_t enum_addr)
return (result);
}
/**
* Determine the correct core count for a chip identification value that
* may contain an invalid core count.
*
* On some early siba(4) devices (see CHIPC_NCORES_MIN_HWREV()), the ChipCommon
* core does not provide a valid CHIPC_ID_NUMCORE field.
*
* @param cid The chip identification to be queried.
* @param chipc_hwrev The hardware revision of the ChipCommon core from which
* @p cid was parsed.
* @param[out] ncores On success, will be set to the correct core count.
*
* @retval 0 If the core count is already correct, or was mapped to a
* a correct value.
* @retval EINVAL If the core count is incorrect, but the chip was not
* recognized.
*/
int
bhnd_chipid_fixed_ncores(const struct bhnd_chipid *cid, uint16_t chipc_hwrev,
uint8_t *ncores)
{
/* bcma(4), and most siba(4) devices */
if (CHIPC_NCORES_MIN_HWREV(chipc_hwrev)) {
*ncores = cid->ncores;
return (0);
}
/* broken siba(4) chipsets */
switch (cid->chip_id) {
case BHND_CHIPID_BCM4306:
*ncores = 6;
break;
case BHND_CHIPID_BCM4704:
*ncores = 9;
break;
case BHND_CHIPID_BCM5365:
/*
* BCM5365 does support ID_NUMCORE in at least
* some of its revisions, but for unknown
* reasons, Broadcom's drivers always exclude
* the ChipCommon revision (0x5) used by BCM5365
* from the set of revisions supporting
* ID_NUMCORE, and instead supply a fixed value.
*
* Presumably, at least some of these devices
* shipped with a broken ID_NUMCORE value.
*/
*ncores = 7;
break;
default:
return (EINVAL);
}
return (0);
}
/**
* Allocate the resource defined by @p rs via @p dev, use it
* to read the ChipCommon ID register relative to @p chipc_offset,
@ -894,6 +953,27 @@ bhnd_read_chipid(device_t dev, struct resource_spec *rs,
*result = bhnd_parse_chipid(reg, enum_addr);
/* Fix the core count on early siba(4) devices */
if (chip_type == BHND_CHIPTYPE_SIBA) {
uint32_t idh;
uint16_t chipc_hwrev;
/*
* We need the ChipCommon revision to determine whether
* the ncore field is valid.
*
* We can safely assume the siba IDHIGH register is mapped
* within the chipc register block.
*/
idh = bus_read_4(res, SB0_REG_ABS(SIBA_CFG0_IDHIGH));
chipc_hwrev = SIBA_IDH_CORE_REV(idh);
error = bhnd_chipid_fixed_ncores(result, chipc_hwrev,
&result->ncores);
if (error)
goto cleanup;
}
cleanup:
/* Clean up */
bus_release_resource(dev, rtype, rid, res);

View File

@ -635,35 +635,12 @@ siba_add_children(device_t dev, const struct bhnd_chipid *chipid)
ccreg = bus_read_4(r, CHIPC_ID);
ccid = bhnd_parse_chipid(ccreg, SIBA_ENUM_ADDR);
if (!CHIPC_NCORES_MIN_HWREV(ccrev)) {
switch (ccid.chip_id) {
case BHND_CHIPID_BCM4306:
ccid.ncores = 6;
break;
case BHND_CHIPID_BCM4704:
ccid.ncores = 9;
break;
case BHND_CHIPID_BCM5365:
/*
* BCM5365 does support ID_NUMCORE in at least
* some of its revisions, but for unknown
* reasons, Broadcom's drivers always exclude
* the ChipCommon revision (0x5) used by BCM5365
* from the set of revisions supporting
* ID_NUMCORE, and instead supply a fixed value.
*
* Presumably, at least some of these devices
* shipped with a broken ID_NUMCORE value.
*/
ccid.ncores = 7;
break;
default:
device_printf(dev, "unable to determine core "
"count for unrecognized chipset 0x%hx\n",
ccid.chip_id);
error = ENXIO;
goto cleanup;
}
/* Fix up the core count */
error = bhnd_chipid_fixed_ncores(&ccid, ccrev, &ccid.ncores);
if (error) {
device_printf(dev, "unable to determine core count for "
"chipset 0x%hx\n", ccid.chip_id);
goto cleanup;
}
chipid = &ccid;

View File

@ -62,6 +62,8 @@
#include <dev/hyperv/include/hyperv_busdma.h>
#include <dev/hyperv/include/vmbus.h>
#include <dev/hyperv/netvsc/ndis.h>
#define HN_USE_TXDESC_BUFRING
MALLOC_DECLARE(M_NETVSC);
@ -383,6 +385,8 @@ typedef struct hn_softc {
uint32_t hn_rndis_rid;
uint32_t hn_ndis_ver;
struct ndis_rssprm_toeplitz hn_rss;
} hn_softc_t;
#define HN_FLAG_RXBUF_CONNECTED 0x0001

View File

@ -117,9 +117,11 @@ __FBSDID("$FreeBSD$");
#include <dev/hyperv/include/hyperv_busdma.h>
#include <dev/hyperv/include/vmbus_xact.h>
#include "hv_net_vsc.h"
#include "hv_rndis.h"
#include "hv_rndis_filter.h"
#include <dev/hyperv/netvsc/hv_net_vsc.h>
#include <dev/hyperv/netvsc/hv_rndis.h>
#include <dev/hyperv/netvsc/hv_rndis_filter.h>
#include <dev/hyperv/netvsc/ndis.h>
#include "vmbus_if.h"
/* Short for Hyper-V network interface */
@ -584,7 +586,7 @@ netvsc_attach(device_t dev)
}
#endif
if (device_info.link_state == 0) {
if (device_info.link_state == NDIS_MEDIA_STATE_CONNECTED) {
sc->hn_carrier = 1;
}

View File

@ -536,20 +536,6 @@ struct rndis_hash_info {
uint32_t hash_info;
} __packed;
#define NDIS_HASH_FUNCTION_MASK 0x000000FF /* see hash function */
#define NDIS_HASH_TYPE_MASK 0x00FFFF00 /* see hash type */
/* hash function */
#define NDIS_HASH_FUNCTION_TOEPLITZ 0x00000001
/* hash type */
#define NDIS_HASH_IPV4 0x00000100
#define NDIS_HASH_TCP_IPV4 0x00000200
#define NDIS_HASH_IPV6 0x00000400
#define NDIS_HASH_IPV6_EX 0x00000800
#define NDIS_HASH_TCP_IPV6 0x00001000
#define NDIS_HASH_TCP_IPV6_EX 0x00002000
typedef struct rndis_tcp_tso_info_ {
union {
struct {

View File

@ -79,8 +79,6 @@ static void hv_rf_receive_indicate_status(rndis_device *device,
const rndis_msg *response);
static void hv_rf_receive_data(struct hn_rx_ring *rxr,
const void *data, int dlen);
static int hv_rf_query_device(rndis_device *device, uint32_t oid,
void *result, uint32_t *result_size);
static inline int hv_rf_query_device_mac(rndis_device *device);
static inline int hv_rf_query_device_link_status(rndis_device *device);
static int hv_rf_set_packet_filter(rndis_device *device, uint32_t new_filter);
@ -102,6 +100,8 @@ static int hn_rndis_query(struct hn_softc *sc, uint32_t oid,
static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data,
size_t dlen);
static int hn_rndis_conf_offload(struct hn_softc *sc);
static int hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt);
static int hn_rndis_conf_rss(struct hn_softc *sc, int nchan);
static __inline uint32_t
hn_rndis_rid(struct hn_softc *sc)
@ -627,77 +627,6 @@ hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr,
return (0);
}
/*
* RNDIS filter query device
*/
static int
hv_rf_query_device(rndis_device *device, uint32_t oid, void *result,
uint32_t *result_size)
{
rndis_request *request;
uint32_t in_result_size = *result_size;
rndis_query_request *query;
rndis_query_complete *query_complete;
int ret = 0;
*result_size = 0;
request = hv_rndis_request(device, REMOTE_NDIS_QUERY_MSG,
RNDIS_MESSAGE_SIZE(rndis_query_request));
if (request == NULL) {
ret = -1;
goto cleanup;
}
/* Set up the rndis query */
query = &request->request_msg.msg.query_request;
query->oid = oid;
query->info_buffer_offset = sizeof(rndis_query_request);
query->info_buffer_length = 0;
query->device_vc_handle = 0;
if (oid == RNDIS_OID_GEN_RSS_CAPABILITIES) {
struct rndis_recv_scale_cap *cap;
request->request_msg.msg_len +=
sizeof(struct rndis_recv_scale_cap);
query->info_buffer_length = sizeof(struct rndis_recv_scale_cap);
cap = (struct rndis_recv_scale_cap *)((unsigned long)query +
query->info_buffer_offset);
cap->hdr.type = RNDIS_OBJECT_TYPE_RSS_CAPABILITIES;
cap->hdr.rev = RNDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2;
cap->hdr.size = sizeof(struct rndis_recv_scale_cap);
}
ret = hv_rf_send_request(device, request, REMOTE_NDIS_QUERY_MSG);
if (ret != 0) {
/* Fixme: printf added */
printf("RNDISFILTER request failed to Send!\n");
goto cleanup;
}
sema_wait(&request->wait_sema);
/* Copy the response back */
query_complete = &request->response_msg.msg.query_complete;
if (query_complete->info_buffer_length > in_result_size) {
ret = EINVAL;
goto cleanup;
}
memcpy(result, (void *)((unsigned long)query_complete +
query_complete->info_buffer_offset),
query_complete->info_buffer_length);
*result_size = query_complete->info_buffer_length;
cleanup:
if (request != NULL)
hv_put_rndis_request(device, request);
return (ret);
}
/*
* RNDIS filter query device MAC address
*/
@ -712,12 +641,12 @@ hv_rf_query_device_mac(rndis_device *device)
error = hn_rndis_query(sc, OID_802_3_PERMANENT_ADDRESS, NULL, 0,
device->hw_mac_addr, &hwaddr_len);
if (error)
return error;
return (error);
if (hwaddr_len != ETHER_ADDR_LEN) {
if_printf(sc->hn_ifp, "invalid hwaddr len %zu\n", hwaddr_len);
return EINVAL;
return (EINVAL);
}
return 0;
return (0);
}
/*
@ -726,13 +655,23 @@ hv_rf_query_device_mac(rndis_device *device)
static inline int
hv_rf_query_device_link_status(rndis_device *device)
{
uint32_t size = sizeof(uint32_t);
struct hn_softc *sc = device->sc;
size_t size;
int error;
return (hv_rf_query_device(device,
RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, &device->link_status, &size));
size = sizeof(uint32_t);
error = hn_rndis_query(sc, OID_GEN_MEDIA_CONNECT_STATUS, NULL, 0,
&device->link_status, &size);
if (error)
return (error);
if (size != sizeof(uint32_t)) {
if_printf(sc->hn_ifp, "invalid link status len %zu\n", size);
return (EINVAL);
}
return (0);
}
static uint8_t netvsc_hash_key[HASH_KEYLEN] = {
static uint8_t netvsc_hash_key[NDIS_HASH_KEYSIZE_TOEPLITZ] = {
0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
@ -740,106 +679,6 @@ static uint8_t netvsc_hash_key[HASH_KEYLEN] = {
0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
};
/*
* RNDIS set vRSS parameters
*/
static int
hv_rf_set_rss_param(rndis_device *device, int num_queue)
{
rndis_request *request;
rndis_set_request *set;
rndis_set_complete *set_complete;
rndis_recv_scale_param *rssp;
uint32_t extlen = sizeof(rndis_recv_scale_param) +
(4 * ITAB_NUM) + HASH_KEYLEN;
uint32_t *itab, status;
uint8_t *keyp;
int i, ret;
request = hv_rndis_request(device, REMOTE_NDIS_SET_MSG,
RNDIS_MESSAGE_SIZE(rndis_set_request) + extlen);
if (request == NULL) {
if (bootverbose)
printf("Netvsc: No memory to set vRSS parameters.\n");
ret = -1;
goto cleanup;
}
set = &request->request_msg.msg.set_request;
set->oid = RNDIS_OID_GEN_RSS_PARAMETERS;
set->info_buffer_length = extlen;
set->info_buffer_offset = sizeof(rndis_set_request);
set->device_vc_handle = 0;
/* Fill out the rssp parameter structure */
rssp = (rndis_recv_scale_param *)(set + 1);
rssp->hdr.type = RNDIS_OBJECT_TYPE_RSS_PARAMETERS;
rssp->hdr.rev = RNDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2;
rssp->hdr.size = sizeof(rndis_recv_scale_param);
rssp->flag = 0;
rssp->hashinfo = RNDIS_HASH_FUNC_TOEPLITZ | RNDIS_HASH_IPV4 |
RNDIS_HASH_TCP_IPV4 | RNDIS_HASH_IPV6 | RNDIS_HASH_TCP_IPV6;
rssp->indirect_tabsize = 4 * ITAB_NUM;
rssp->indirect_taboffset = sizeof(rndis_recv_scale_param);
rssp->hashkey_size = HASH_KEYLEN;
rssp->hashkey_offset = rssp->indirect_taboffset +
rssp->indirect_tabsize;
/* Set indirection table entries */
itab = (uint32_t *)(rssp + 1);
for (i = 0; i < ITAB_NUM; i++)
itab[i] = i % num_queue;
/* Set hash key values */
keyp = (uint8_t *)((unsigned long)rssp + rssp->hashkey_offset);
for (i = 0; i < HASH_KEYLEN; i++)
keyp[i] = netvsc_hash_key[i];
ret = hv_rf_send_request(device, request, REMOTE_NDIS_SET_MSG);
if (ret != 0) {
goto cleanup;
}
/*
* Wait for the response from the host. Another thread will signal
* us when the response has arrived. In the failure case,
* sema_timedwait() returns a non-zero status after waiting 5 seconds.
*/
ret = sema_timedwait(&request->wait_sema, 5 * hz);
if (ret == 0) {
/* Response received, check status */
set_complete = &request->response_msg.msg.set_complete;
status = set_complete->status;
if (status != RNDIS_STATUS_SUCCESS) {
/* Bad response status, return error */
if (bootverbose)
printf("Netvsc: Failed to set vRSS "
"parameters.\n");
ret = -2;
} else {
if (bootverbose)
printf("Netvsc: Successfully set vRSS "
"parameters.\n");
}
} else {
/*
* We cannot deallocate the request since we may still
* receive a send completion for it.
*/
printf("Netvsc: vRSS set timeout, id = %u, ret = %d\n",
request->request_msg.msg.init_request.request_id, ret);
goto exit;
}
cleanup:
if (request != NULL) {
hv_put_rndis_request(device, request);
}
exit:
return (ret);
}
/*
* RNDIS filter set packet filter
* Sends an rndis request with the new filter, then waits for a response
@ -1082,6 +921,51 @@ done:
return (error);
}
static int
hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt)
{
struct ndis_rss_caps in, caps;
size_t caps_len;
int error;
/*
* Only NDIS 6.30+ is supported.
*/
KASSERT(sc->hn_ndis_ver >= NDIS_VERSION_6_30,
("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver));
*rxr_cnt = 0;
memset(&in, 0, sizeof(in));
in.ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_CAPS;
in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2;
in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE;
caps_len = NDIS_RSS_CAPS_SIZE;
error = hn_rndis_query(sc, OID_GEN_RSS_CAPABILITIES,
&in, NDIS_RSS_CAPS_SIZE, &caps, &caps_len);
if (error)
return (error);
if (caps_len < NDIS_RSS_CAPS_SIZE_6_0) {
if_printf(sc->hn_ifp, "invalid NDIS RSS caps len %zu",
caps_len);
return (EINVAL);
}
if (caps.ndis_nrxr == 0) {
if_printf(sc->hn_ifp, "0 RX rings!?\n");
return (EINVAL);
}
*rxr_cnt = caps.ndis_nrxr;
if (caps_len == NDIS_RSS_CAPS_SIZE) {
if (bootverbose) {
if_printf(sc->hn_ifp, "RSS indirect table size %u\n",
caps.ndis_nind);
}
}
return (0);
}
static int
hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, size_t dlen)
{
@ -1172,6 +1056,52 @@ hn_rndis_conf_offload(struct hn_softc *sc)
return (error);
}
static int
hn_rndis_conf_rss(struct hn_softc *sc, int nchan)
{
struct ndis_rssprm_toeplitz *rss = &sc->hn_rss;
struct ndis_rss_params *prm = &rss->rss_params;
int i, error;
/*
* Only NDIS 6.30+ is supported.
*/
KASSERT(sc->hn_ndis_ver >= NDIS_VERSION_6_30,
("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver));
memset(rss, 0, sizeof(*rss));
prm->ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_PARAMS;
prm->ndis_hdr.ndis_rev = NDIS_RSS_PARAMS_REV_2;
prm->ndis_hdr.ndis_size = sizeof(*rss);
prm->ndis_hash = NDIS_HASH_FUNCTION_TOEPLITZ |
NDIS_HASH_IPV4 | NDIS_HASH_TCP_IPV4 |
NDIS_HASH_IPV6 | NDIS_HASH_TCP_IPV6;
/* TODO: Take ndis_rss_caps.ndis_nind into account */
prm->ndis_indsize = sizeof(rss->rss_ind);
prm->ndis_indoffset =
__offsetof(struct ndis_rssprm_toeplitz, rss_ind[0]);
prm->ndis_keysize = sizeof(rss->rss_key);
prm->ndis_keyoffset =
__offsetof(struct ndis_rssprm_toeplitz, rss_key[0]);
/* Setup RSS key */
memcpy(rss->rss_key, netvsc_hash_key, sizeof(rss->rss_key));
/* Setup RSS indirect table */
/* TODO: Take ndis_rss_caps.ndis_nind into account */
for (i = 0; i < NDIS_HASH_INDCNT; ++i)
rss->rss_ind[i] = i % nchan;
error = hn_rndis_set(sc, OID_GEN_RSS_PARAMETERS, rss, sizeof(*rss));
if (error) {
if_printf(sc->hn_ifp, "RSS config failed: %d\n", error);
} else {
if (bootverbose)
if_printf(sc->hn_ifp, "RSS config done\n");
}
return (error);
}
/*
* RNDIS filter init device
*/
@ -1337,8 +1267,6 @@ hv_rf_on_device_add(struct hn_softc *sc, void *additl_info,
{
int ret;
rndis_device *rndis_dev;
struct rndis_recv_scale_cap rsscaps;
uint32_t rsscaps_size = sizeof(struct rndis_recv_scale_cap);
netvsc_device_info *dev_info = (netvsc_device_info *)additl_info;
device_t dev = sc->hn_dev;
struct hn_nvs_subch_req *req;
@ -1347,6 +1275,7 @@ hv_rf_on_device_add(struct hn_softc *sc, void *additl_info,
struct vmbus_xact *xact = NULL;
uint32_t status, nsubch;
int nchan = *nchan0;
int rxr_cnt;
rndis_dev = hv_get_rndis_device();
if (rndis_dev == NULL) {
@ -1395,22 +1324,29 @@ hv_rf_on_device_add(struct hn_softc *sc, void *additl_info,
dev_info->link_state = rndis_dev->link_status;
if (sc->hn_nvs_ver < NVSP_PROTOCOL_VERSION_5 || nchan == 1)
if (sc->hn_ndis_ver < NDIS_VERSION_6_30 || nchan == 1) {
/*
* Either RSS is not supported, or multiple RX/TX rings
* are not requested.
*/
*nchan0 = 1;
return (0);
memset(&rsscaps, 0, rsscaps_size);
ret = hv_rf_query_device(rndis_dev,
RNDIS_OID_GEN_RSS_CAPABILITIES,
&rsscaps, &rsscaps_size);
if ((ret != 0) || (rsscaps.num_recv_que < 2)) {
device_printf(dev, "hv_rf_query_device failed or "
"rsscaps.num_recv_que < 2 \n");
goto out;
}
device_printf(dev, "channel, offered %u, requested %d\n",
rsscaps.num_recv_que, nchan);
if (nchan > rsscaps.num_recv_que)
nchan = rsscaps.num_recv_que;
/*
* Get RSS capabilities, e.g. # of RX rings, and # of indirect
* table entries.
*/
ret = hn_rndis_get_rsscaps(sc, &rxr_cnt);
if (ret) {
/* No RSS; this is benign. */
*nchan0 = 1;
return (0);
}
if (nchan > rxr_cnt)
nchan = rxr_cnt;
if_printf(sc->hn_ifp, "RX rings offered %u, requested %d\n",
rxr_cnt, nchan);
if (nchan == 1) {
device_printf(dev, "only 1 channel is supported, no vRSS\n");
@ -1467,8 +1403,11 @@ hv_rf_on_device_add(struct hn_softc *sc, void *additl_info,
}
nchan = nsubch + 1;
ret = hv_rf_set_rss_param(rndis_dev, nchan);
*nchan0 = nchan;
ret = hn_rndis_conf_rss(sc, nchan);
if (ret != 0)
*nchan0 = 1;
else
*nchan0 = nchan;
out:
if (xact != NULL)
vmbus_xact_put(xact);

View File

@ -29,9 +29,16 @@
#ifndef _NET_NDIS_H_
#define _NET_NDIS_H_
#define NDIS_MEDIA_STATE_CONNECTED 0
#define NDIS_MEDIA_STATE_DISCONNECTED 1
#define OID_GEN_RSS_CAPABILITIES 0x00010203
#define OID_GEN_RSS_PARAMETERS 0x00010204
#define OID_TCP_OFFLOAD_PARAMETERS 0xFC01020C
#define NDIS_OBJTYPE_DEFAULT 0x80
#define NDIS_OBJTYPE_RSS_CAPS 0x88
#define NDIS_OBJTYPE_RSS_PARAMS 0x89
/* common_set */
#define NDIS_OFFLOAD_SET_NOCHG 0
@ -41,13 +48,33 @@
/* a.k.a GRE MAC */
#define NDIS_ENCAP_TYPE_NVGRE 0x00000001
#define NDIS_HASH_FUNCTION_MASK 0x000000FF /* see hash function */
#define NDIS_HASH_TYPE_MASK 0x00FFFF00 /* see hash type */
/* hash function */
#define NDIS_HASH_FUNCTION_TOEPLITZ 0x00000001
/* hash type */
#define NDIS_HASH_IPV4 0x00000100
#define NDIS_HASH_TCP_IPV4 0x00000200
#define NDIS_HASH_IPV6 0x00000400
#define NDIS_HASH_IPV6_EX 0x00000800
#define NDIS_HASH_TCP_IPV6 0x00001000
#define NDIS_HASH_TCP_IPV6_EX 0x00002000
#define NDIS_HASH_KEYSIZE_TOEPLITZ 40
#define NDIS_HASH_INDCNT 128
struct ndis_object_hdr {
uint8_t ndis_type; /* NDIS_OBJTYPE_ */
uint8_t ndis_rev; /* type specific */
uint16_t ndis_size; /* incl. this hdr */
};
/* OID_TCP_OFFLOAD_PARAMETERS */
/*
* OID_TCP_OFFLOAD_PARAMETERS
* ndis_type: NDIS_OBJTYPE_DEFAULT
*/
struct ndis_offload_params {
struct ndis_object_hdr ndis_hdr;
uint8_t ndis_ip4csum; /* param_set */
@ -115,4 +142,76 @@ struct ndis_offload_params {
#define NDIS_OFFLOAD_RSC_OFF 1
#define NDIS_OFFLOAD_RSC_ON 2
/*
* OID_GEN_RSS_CAPABILITIES
* ndis_type: NDIS_OBJTYPE_RSS_CAPS
*/
struct ndis_rss_caps {
struct ndis_object_hdr ndis_hdr;
uint32_t ndis_flags; /* NDIS_RSS_CAP_ */
uint32_t ndis_nmsi; /* # of MSIs */
uint32_t ndis_nrxr; /* # of RX rings */
/* NDIS >= 6.30 */
uint16_t ndis_nind; /* # of indtbl ent. */
uint16_t ndis_pad;
};
#define NDIS_RSS_CAPS_SIZE \
__offsetof(struct ndis_rss_caps, ndis_pad)
#define NDIS_RSS_CAPS_SIZE_6_0 \
__offsetof(struct ndis_rss_caps, ndis_nind)
#define NDIS_RSS_CAPS_REV_1 1 /* NDIS 6.{0,1,20} */
#define NDIS_RSS_CAPS_REV_2 2 /* NDIS 6.30 */
#define NDIS_RSS_CAP_MSI 0x01000000
#define NDIS_RSS_CAP_CLASSIFY_ISR 0x02000000
#define NDIS_RSS_CAP_CLASSIFY_DPC 0x04000000
#define NDIS_RSS_CAP_MSIX 0x08000000
#define NDIS_RSS_CAP_IPV4 0x00000100
#define NDIS_RSS_CAP_IPV6 0x00000200
#define NDIS_RSS_CAP_IPV6_EX 0x00000400
#define NDIS_RSS_CAP_HASH_TOEPLITZ 0x00000001
/*
* OID_GEN_RSS_PARAMETERS
* ndis_type: NDIS_OBJTYPE_RSS_PARAMS
*/
struct ndis_rss_params {
struct ndis_object_hdr ndis_hdr;
uint16_t ndis_flags; /* NDIS_RSS_FLAG_ */
uint16_t ndis_bcpu; /* base cpu 0 */
uint32_t ndis_hash; /* NDIS_HASH_ */
uint16_t ndis_indsize; /* indirect table */
uint32_t ndis_indoffset;
uint16_t ndis_keysize; /* hash key */
uint32_t ndis_keyoffset;
/* NDIS >= 6.20 */
uint32_t ndis_cpumaskoffset;
uint32_t ndis_cpumaskcnt;
uint32_t ndis_cpumaskentsz;
};
#define NDIS_RSS_PARAMS_SIZE sizeof(struct ndis_rss_params)
#define NDIS_RSS_PARAMS_SIZE_6_0 \
__offsetof(struct ndis_rss_params, ndis_cpumaskoffset)
#define NDIS_RSS_PARAMS_REV_1 1 /* NDIS 6.0 */
#define NDIS_RSS_PARAMS_REV_2 2 /* NDIS 6.20 */
#define NDIS_RSS_FLAG_BCPU_UNCHG 0x0001
#define NDIS_RSS_FLAG_HASH_UNCHG 0x0002
#define NDIS_RSS_FLAG_IND_UNCHG 0x0004
#define NDIS_RSS_FLAG_KEY_UNCHG 0x0008
#define NDIS_RSS_FLAG_DISABLE 0x0010
/* non-standard convenient struct */
struct ndis_rssprm_toeplitz {
struct ndis_rss_params rss_params;
/* Toeplitz hash key */
uint8_t rss_key[NDIS_HASH_KEYSIZE_TOEPLITZ];
/* Indirect table */
uint32_t rss_ind[NDIS_HASH_INDCNT];
};
#endif /* !_NET_NDIS_H_ */

View File

@ -3361,7 +3361,7 @@ out:
if (cm->cm_frame->header.cmd == MFI_CMD_STP) {
for (i = 0; i < 2; i++) {
if (sc->kbuff_arr[i]) {
if (sc->mfi_kbuff_arr_busaddr != 0)
if (sc->mfi_kbuff_arr_busaddr[i] != 0)
bus_dmamap_unload(
sc->mfi_kbuff_arr_dmat[i],
sc->mfi_kbuff_arr_dmamap[i]

View File

@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$");
#include "ofw_bus_if.h"
#define OFW_COMPAT_LEN 255
int
ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *obd, phandle_t node)
{
@ -178,7 +180,8 @@ ofw_bus_status_okay(device_t dev)
}
static int
ofw_bus_node_is_compatible(const char *compat, int len, const char *onecompat)
ofw_bus_node_is_compatible_int(const char *compat, int len,
const char *onecompat)
{
int onelen, l, ret;
@ -202,6 +205,25 @@ ofw_bus_node_is_compatible(const char *compat, int len, const char *onecompat)
return (ret);
}
int
ofw_bus_node_is_compatible(phandle_t node, const char *compatstr)
{
char compat[OFW_COMPAT_LEN];
int len, rv;
if ((len = OF_getproplen(node, "compatible")) <= 0)
return (0);
bzero(compat, OFW_COMPAT_LEN);
if (OF_getprop(node, "compatible", compat, OFW_COMPAT_LEN) < 0)
return (0);
rv = ofw_bus_node_is_compatible_int(compat, len, compatstr);
return (rv);
}
int
ofw_bus_is_compatible(device_t dev, const char *onecompat)
{
@ -219,7 +241,7 @@ ofw_bus_is_compatible(device_t dev, const char *onecompat)
if ((len = OF_getproplen(node, "compatible")) <= 0)
return (0);
return (ofw_bus_node_is_compatible(compat, len, onecompat));
return (ofw_bus_node_is_compatible_int(compat, len, onecompat));
}
int
@ -689,7 +711,7 @@ ofw_bus_find_compatible(phandle_t node, const char *onecompat)
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
len = OF_getprop_alloc(child, "compatible", 1, &compat);
if (len >= 0) {
ret = ofw_bus_node_is_compatible(compat, len,
ret = ofw_bus_node_is_compatible_int(compat, len,
onecompat);
free(compat, M_OFWPROP);
if (ret != 0)

View File

@ -107,6 +107,7 @@ phandle_t ofw_bus_find_iparent(phandle_t);
/* Helper routine for checking compat prop */
int ofw_bus_is_compatible(device_t, const char *);
int ofw_bus_is_compatible_strict(device_t, const char *);
int ofw_bus_node_is_compatible(phandle_t, const char *);
/*
* Helper routine to search a list of compat properties. The table is

View File

@ -1649,6 +1649,20 @@ sc_cnterm(struct consdev *cp)
static void sccnclose(sc_softc_t *sc, struct sc_cnstate *sp);
static void sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags);
static void sccnscrlock(sc_softc_t *sc, struct sc_cnstate *sp);
static void sccnscrunlock(sc_softc_t *sc, struct sc_cnstate *sp);
static void
sccnscrlock(sc_softc_t *sc, struct sc_cnstate *sp)
{
SC_VIDEO_LOCK(sc);
}
static void
sccnscrunlock(sc_softc_t *sc, struct sc_cnstate *sp)
{
SC_VIDEO_UNLOCK(sc);
}
static void
sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags)
@ -1680,6 +1694,7 @@ sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags)
over_keyboard: ;
/* The screen is opened iff locking it succeeds. */
sccnscrlock(sc, sp);
sp->scr_opened = TRUE;
/* The screen switch is optional. */
@ -1698,6 +1713,7 @@ static void
sccnclose(sc_softc_t *sc, struct sc_cnstate *sp)
{
sp->scr_opened = FALSE;
sccnscrunlock(sc, sp);
if (!sp->kbd_opened)
return;
@ -1731,8 +1747,10 @@ sc_cngrab(struct consdev *cp)
sc = sc_console->sc;
lev = atomic_fetchadd_int(&sc->grab_level, 1);
if (lev >= 0 && lev < 2)
if (lev >= 0 && lev < 2) {
sccnopen(sc, &sc->grab_state[lev], 1 | 2);
sccnscrunlock(sc, &sc->grab_state[lev]);
}
}
static void
@ -1743,14 +1761,17 @@ sc_cnungrab(struct consdev *cp)
sc = sc_console->sc;
lev = atomic_load_acq_int(&sc->grab_level) - 1;
if (lev >= 0 && lev < 2)
if (lev >= 0 && lev < 2) {
sccnscrlock(sc, &sc->grab_state[lev]);
sccnclose(sc, &sc->grab_state[lev]);
}
atomic_add_int(&sc->grab_level, -1);
}
static void
sc_cnputc(struct consdev *cd, int c)
{
struct sc_cnstate st;
u_char buf[1];
scr_stat *scp = sc_console;
#ifndef SC_NO_HISTORY
@ -1762,7 +1783,7 @@ sc_cnputc(struct consdev *cd, int c)
/* assert(sc_console != NULL) */
SC_VIDEO_LOCK(scp->sc);
sccnopen(scp->sc, &st, 0);
#ifndef SC_NO_HISTORY
if (scp == scp->sc->cur_scp && scp->status & SLKED) {
@ -1797,7 +1818,7 @@ sc_cnputc(struct consdev *cd, int c)
s = spltty(); /* block sckbdevent and scrn_timer */
sccnupdate(scp);
splx(s);
SC_VIDEO_UNLOCK(scp->sc);
sccnclose(scp->sc, &st);
}
static int

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/ofw_machdep.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/ofw/openfirm.h>
#include <dev/uart/uart.h>
#include <dev/uart/uart_cpu.h>
@ -163,14 +164,13 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
return (ENXIO);
if (strcmp(buf, "serial") != 0)
return (ENXIO);
if (OF_getprop(input, "compatible", buf, sizeof(buf)) == -1)
return (ENXIO);
if (strncmp(buf, "chrp,es", 7) == 0) {
if (ofw_bus_node_is_compatible(input, "chrp,es")) {
class = &uart_z8530_class;
di->bas.regshft = 4;
di->bas.chan = 1;
} else if (strcmp(buf,"ns16550") == 0 || strcmp(buf,"ns8250") == 0) {
} else if (ofw_bus_node_is_compatible(input,"ns16550") ||
ofw_bus_node_is_compatible(input,"ns8250")) {
class = &uart_ns8250_class;
di->bas.regshft = 0;
di->bas.chan = 0;

View File

@ -4174,6 +4174,9 @@ out:
PMAP_UNLOCK(dst_pmap);
}
/*
* Zero 1 page of virtual memory mapped from a hardware page by the caller.
*/
static __inline void
pagezero(void *page)
{
@ -4191,8 +4194,7 @@ pagezero(void *page)
}
/*
* pmap_zero_page zeros the specified hardware page by mapping
* the page into KVM and using bzero to clear its contents.
* Zero the specified hardware page.
*/
void
pmap_zero_page(vm_page_t m)
@ -4214,10 +4216,8 @@ pmap_zero_page(vm_page_t m)
}
/*
* pmap_zero_page_area zeros the specified hardware page by mapping
* the page into KVM and using bzero to clear its contents.
*
* off and size may not cover an area beyond a single hardware page.
* Zero an an area within a single hardware page. off and size must not
* cover an area beyond a single hardware page.
*/
void
pmap_zero_page_area(vm_page_t m, int off, int size)
@ -4242,10 +4242,9 @@ pmap_zero_page_area(vm_page_t m, int off, int size)
}
/*
* pmap_zero_page_idle zeros the specified hardware page by mapping
* the page into KVM and using bzero to clear its contents. This
* is intended to be called from the vm_pagezero process only and
* outside of Giant.
* Zero the specified hardware page in a way that minimizes cache thrashing.
* This is intended to be called from the vm_pagezero process only and
* outside of Giant.
*/
void
pmap_zero_page_idle(vm_page_t m)
@ -4263,10 +4262,7 @@ pmap_zero_page_idle(vm_page_t m)
}
/*
* pmap_copy_page copies the specified (machine independent)
* page by mapping the page into virtual memory and using
* bcopy to copy the page, one machine dependent page at a
* time.
* Copy 1 specified hardware page to another.
*/
void
pmap_copy_page(vm_page_t src, vm_page_t dst)

View File

@ -69,9 +69,16 @@ ENTRY(sse2_pagezero)
movl %ecx,%eax
addl $4096,%eax
xor %ebx,%ebx
jmp 1f
/*
* The loop takes 14 bytes. Ensure that it doesn't cross a 16-byte
* cache line.
*/
.p2align 4,0x90
1:
movnti %ebx,(%ecx)
addl $4,%ecx
movnti %ebx,4(%ecx)
addl $8,%ecx
cmpl %ecx,%eax
jne 1b
sfence

View File

@ -4,6 +4,7 @@ SYSDIR?=${.CURDIR}/../..
.PATH: ${SYSDIR}/compat/cloudabi32
.PATH: ${SYSDIR}/${MACHINE_CPUARCH}/cloudabi32
.PATH: ${SYSDIR}/${MACHINE}/cloudabi32
KMOD= cloudabi32
SRCS= cloudabi32_fd.c cloudabi32_module.c cloudabi32_poll.c \

View File

@ -4,6 +4,7 @@ SYSDIR?=${.CURDIR}/../..
.PATH: ${SYSDIR}/compat/cloudabi64
.PATH: ${SYSDIR}/${MACHINE_CPUARCH}/cloudabi64
.PATH: ${SYSDIR}/${MACHINE}/cloudabi64
KMOD= cloudabi64
SRCS= cloudabi64_fd.c cloudabi64_module.c cloudabi64_poll.c \

View File

@ -20,13 +20,22 @@ begin()
# End an individual test
end()
{
local message
if [ $OK = 1 ]
then
printf 'ok '
message='ok '
else
printf 'not ok '
message='not ok '
fi
echo "$COUNT - $NAME"
message="$message $COUNT - $NAME"
if [ -n "$TODO" ]
then
message="$message # TODO $TODO"
fi
echo "$message"
}
# Make a file that can later be verified
@ -336,6 +345,9 @@ tests_time_rotate() {
sleep 1.1
(
TODO="rotate time 2-4 fail today; bug 212160"
begin "rotate time 2 ${name_postfix}"
run_newsyslog ${newsyslog_args}
ckfe ${LOGFNAME}
@ -357,6 +369,7 @@ tests_time_rotate() {
ckfe ${LOGFNAME}
chkfcnt 3 ${dir}${LOGFNAME}.*${ext}
end
)
begin "noaction ${name_postfix}"
ofiles=`ls -1 ${dir}${LOGFNAME}.*${ext} | tr -d '\n'`