Merge ^/head r285341 through r285792.

This commit is contained in:
Dimitry Andric 2015-07-22 19:55:32 +00:00
commit 8d0f10857a
571 changed files with 411927 additions and 25975 deletions

View File

@ -99,6 +99,8 @@ OLD_FILES+=usr/lib/clang/3.6.1/lib/freebsd/libclang_rt.ubsan_cxx-x86_64.a
OLD_DIRS+=usr/lib/clang/3.6.1/lib/freebsd
OLD_DIRS+=usr/lib/clang/3.6.1/lib
OLD_DIRS+=usr/lib/clang/3.6.1
# 20150719: Remove libarchive.pc
OLD_FILES+=usr/libdata/pkgconfig/libarchive.pc
# 20150705: Rename DTrace provider man pages.
OLD_FILES+=usr/share/man/man4/dtrace-io.4.gz
OLD_FILES+=usr/share/man/man4/dtrace-ip.4.gz

View File

@ -92,7 +92,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
20150616:
FreeBSD's old make (fmake) has been removed from the system. It is
available as the devel/fmake port or via pkg install fmake.
20150615:
The fix for the issue described in the 20150614 sendmail entry
below has been been committed in revision 284436. The work
@ -115,7 +115,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
this interoperability, sendmail can be configured to use a
2048 bit DH parameter by:
1. Edit /etc/mail/`hostname`.mc
1. Edit /etc/mail/`hostname`.mc
2. If a setting for confDH_PARAMETERS does not exist or
exists and is set to a string beginning with '5',
replace it with '2'.
@ -228,7 +228,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
using a local socket. Users who have already enabled the
local_unbound service should regenerate their configuration
by running "service local_unbound setup" as root.
20150102:
The GNU texinfo and GNU info pages have been removed.
To be able to view GNU info pages please install texinfo from ports.
@ -619,7 +619,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
The GNU Compiler Collection and C++ standard library (libstdc++)
are no longer built by default on platforms where clang is the system
compiler. You can enable them with the WITH_GCC and WITH_GNUCXX
options in src.conf.
options in src.conf.
20130905:
The PROCDESC kernel option is now part of the GENERIC kernel
@ -973,7 +973,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
20120727:
The sparc64 ZFS loader has been changed to no longer try to auto-
detect ZFS providers based on diskN aliases but now requires these
to be explicitly listed in the OFW boot-device environment variable.
to be explicitly listed in the OFW boot-device environment variable.
20120712:
The OpenSSL has been upgraded to 1.0.1c. Any binaries requiring

View File

@ -416,6 +416,7 @@ if necessary, to a 1MiB boundary:
.Sh SEE ALSO
.Xr cp 1 ,
.Xr mt 1 ,
.Xr recoverdisk 1 ,
.Xr tr 1 ,
.Xr geom 4
.Sh STANDARDS

View File

@ -5,12 +5,12 @@
PROG= ls
SRCS= cmp.c ls.c print.c util.c
LIBADD= util
LIBADD= util xo
.if !defined(RELEASE_CRUNCH) && \
${MK_LS_COLORS} != no
CFLAGS+= -DCOLORLS
LIBADD+= termcapw xo
LIBADD+= termcapw
.endif
.include <bsd.prog.mk>

View File

@ -119,7 +119,7 @@ static int f_nofollow; /* don't follow symbolic link arguments */
int f_nonprint; /* show unprintables as ? */
static int f_nosort; /* don't sort output */
int f_notabs; /* don't use tab-separated multi-col output */
static int f_numericonly; /* don't convert uid/gid to name */
int f_numericonly; /* don't convert uid/gid to name */
int f_octal; /* show unprintables as \xxx */
int f_octal_escape; /* like f_octal but use C escapes if possible */
static int f_recursive; /* ls subdirectories also */
@ -158,6 +158,7 @@ main(int argc, char *argv[])
struct winsize win;
int ch, fts_options, notused;
char *p;
const char *errstr = NULL;
#ifdef COLORLS
char termcapbuf[1024]; /* termcap definition buffer */
char tcapbuf[512]; /* capability buffer */
@ -170,7 +171,7 @@ main(int argc, char *argv[])
if (isatty(STDOUT_FILENO)) {
termwidth = 80;
if ((p = getenv("COLUMNS")) != NULL && *p != '\0')
termwidth = atoi(p);
termwidth = strtonum(p, 0, INT_MAX, &errstr);
else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) != -1 &&
win.ws_col > 0)
termwidth = win.ws_col;
@ -180,9 +181,12 @@ main(int argc, char *argv[])
/* retrieve environment variable, in case of explicit -C */
p = getenv("COLUMNS");
if (p)
termwidth = atoi(p);
termwidth = strtonum(p, 0, INT_MAX, &errstr);
}
if (errstr)
termwidth = 80;
fts_options = FTS_PHYSICAL;
if (getenv("LS_SAMESORT"))
f_samesort = 1;
@ -191,6 +195,7 @@ main(int argc, char *argv[])
if (argc < 0)
return (1);
xo_set_flags(NULL, XOF_COLUMNS);
xo_set_version(LS_XO_VERSION);
while ((ch = getopt(argc, argv,
"1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuwxy,")) != -1) {

View File

@ -37,6 +37,8 @@
#define HUMANVALSTR_LEN 5
#define LS_XO_VERSION "1"
extern long blocksize; /* block size units */
extern int f_accesstime; /* use time of last access */
@ -58,6 +60,7 @@ extern int f_statustime; /* use time of last mode change */
extern int f_thousands; /* show file sizes with thousands separators */
extern char *f_timeformat; /* user-specified time format */
extern int f_notabs; /* don't use tab-separated multi-col output */
extern int f_numericonly; /* don't convert uid/gid to name */
extern int f_type; /* add type character for non-regular files */
#ifdef COLORLS
extern int f_color; /* add type in color for non-regular files */

View File

@ -171,7 +171,7 @@ printlong(const DISPLAY *dp)
xo_open_list("entry");
for (p = dp->list; p; p = p->fts_link) {
char *name;
char *name, *type;
if (IS_NOPRINT(p))
continue;
xo_open_instance("entry");
@ -180,22 +180,46 @@ printlong(const DISPLAY *dp)
if (name)
xo_emit("{ke:name/%hs}", name);
if (f_inode)
xo_emit("{:inode/%*ju} ",
xo_emit("{t:inode/%*ju} ",
dp->s_inode, (uintmax_t)sp->st_ino);
if (f_size)
xo_emit("{:blocks/%*jd} ",
xo_emit("{t:blocks/%*jd} ",
dp->s_block, howmany(sp->st_blocks, blocksize));
strmode(sp->st_mode, buf);
aclmode(buf, p);
np = p->fts_pointer;
xo_attr("value", "%03o", (int) sp->st_mode & ALLPERMS);
xo_emit("{t:mode/%s} {:links/%*u} {:user/%-*s} {:group/%-*s} ",
buf, dp->s_nlink, sp->st_nlink,
dp->s_user, np->user, dp->s_group, np->group);
if (f_numericonly) {
xo_emit("{t:mode/%s}{e:mode_octal/%03o} {t:links/%*u} {td:user/%-*s}{e:user/%ju} {td:group/%-*s}{e:group/%ju} ",
buf, (int) sp->st_mode & ALLPERMS, dp->s_nlink, sp->st_nlink,
dp->s_user, np->user, sp->st_uid, dp->s_group, np->group, sp->st_gid);
} else {
xo_emit("{t:mode/%s}{e:mode_octal/%03o} {t:links/%*u} {t:user/%-*s} {t:group/%-*s} ",
buf, (int) sp->st_mode & ALLPERMS, dp->s_nlink, sp->st_nlink,
dp->s_user, np->user, dp->s_group, np->group);
}
if (S_ISBLK(sp->st_mode))
asprintf(&type, "block");
if (S_ISCHR(sp->st_mode))
asprintf(&type, "character");
if (S_ISDIR(sp->st_mode))
asprintf(&type, "directory");
if (S_ISFIFO(sp->st_mode))
asprintf(&type, "fifo");
if (S_ISLNK(sp->st_mode))
asprintf(&type, "symlink");
if (S_ISREG(sp->st_mode))
asprintf(&type, "regular");
if (S_ISSOCK(sp->st_mode))
asprintf(&type, "socket");
if (S_ISWHT(sp->st_mode))
asprintf(&type, "whiteout");
xo_emit("{e:type/%s}", type);
free(type);
if (f_flags)
xo_emit("{:flags/%-*s} ", dp->s_flags, np->flags);
if (f_label)
xo_emit("{:label/%-*s} ", dp->s_label, np->label);
xo_emit("{t:label/%-*s} ", dp->s_label, np->label);
if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
printdev(dp->s_size, sp->st_rdev);
else
@ -238,6 +262,7 @@ printstream(const DISPLAY *dp)
FTSENT *p;
int chcnt;
xo_open_list("entry");
for (p = dp->list, chcnt = 0; p; p = p->fts_link) {
if (p->fts_number == NO_PRINT)
continue;
@ -247,12 +272,15 @@ printstream(const DISPLAY *dp)
xo_emit("\n");
chcnt = 0;
}
xo_open_instance("file");
chcnt += printaname(p, dp->s_inode, dp->s_block);
xo_close_instance("file");
if (p->fts_link) {
xo_emit(", ");
chcnt += 2;
}
}
xo_close_list("entry");
if (chcnt)
xo_emit("\n");
}
@ -369,10 +397,10 @@ printaname(const FTSENT *p, u_long inodefield, u_long sizefield)
sp = p->fts_statp;
chcnt = 0;
if (f_inode)
chcnt += xo_emit("{:inode/%*ju} ",
chcnt += xo_emit("{t:inode/%*ju} ",
(int)inodefield, (uintmax_t)sp->st_ino);
if (f_size)
chcnt += xo_emit("{:size/%*jd} ",
chcnt += xo_emit("{t:size/%*jd} ",
(int)sizefield, howmany(sp->st_blocks, blocksize));
#ifdef COLORLS
if (f_color)
@ -425,9 +453,11 @@ printtime(const char *field, time_t ftime)
format = d_first ? "%e %b %Y" : "%b %e %Y";
strftime(longstring, sizeof(longstring), format, localtime(&ftime));
snprintf(fmt, sizeof(fmt), "{:%s/%%hs} ", field);
snprintf(fmt, sizeof(fmt), "{d:%s/%%hs} ", field);
xo_attr("value", "%ld", (long) ftime);
xo_emit(fmt, longstring);
snprintf(fmt, sizeof(fmt), "{en:%s/%%ld} ", field);
xo_emit(fmt, (long) ftime);
}
static int

View File

@ -738,9 +738,9 @@ Display information on all system processes:
.Xr procstat 1 ,
.Xr w 1 ,
.Xr kvm 3 ,
.Xr libxo 3
.Xr libxo 3 ,
.Xr strftime 3 ,
.Xr xo_parse_args 3
.Xr xo_parse_args 3 ,
.Xr mac 4 ,
.Xr procfs 5 ,
.Xr pstat 8 ,

View File

@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd April 18, 2015
.Dd July 11, 2015
.Dt SH 1
.Os
.Sh NAME
@ -2846,6 +2846,4 @@ The
utility does not recognize multibyte characters other than UTF-8.
Splitting using
.Va IFS
and the line editing library
.Xr editline 3
do not recognize multibyte characters.
does not recognize multibyte characters.

View File

@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -61,7 +62,7 @@ main(int argc, char *argv[])
struct info i;
enum FMT fmt;
int ch;
const char *file;
const char *file, *errstr = NULL;
fmt = NOTSET;
i.fd = STDIN_FILENO;
@ -130,7 +131,9 @@ args: argc -= optind;
if (isdigit(**argv)) {
speed_t speed;
speed = atoi(*argv);
speed = strtonum(*argv, 0, UINT_MAX, &errstr);
if (errstr)
err(1, "speed");
cfsetospeed(&i.t, speed);
cfsetispeed(&i.t, speed);
i.set = 1;

View File

@ -196,17 +196,17 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = {
"lockstat:::spin-release", NULL,
"lockstat:::spin-acquire" },
{ 'H', "Lock", "R/W writer hold", "nsec",
"lockstat::rw_wunlock:rw-release", NULL,
"lockstat::rw_wlock:rw-acquire" },
"lockstat:::rw-release", "arg1 == 0",
"lockstat:::rw-acquire" },
{ 'H', "Lock", "R/W reader hold", "nsec",
"lockstat::rw_runlock:rw-release", NULL,
"lockstat::rw_rlock:rw-acquire" },
"lockstat:::rw-release", "arg1 == 1",
"lockstat:::rw-acquire" },
{ 'H', "Lock", "SX shared hold", "nsec",
"lockstat::sx_sunlock:sx-release", NULL,
"lockstat::sx_slock:sx-acquire" },
"lockstat:::sx-release", "arg1 == 0",
"lockstat:::sx-acquire" },
{ 'H', "Lock", "SX exclusive hold", "nsec",
"lockstat::sx_xunlock:sx-release", NULL,
"lockstat::sx_xlock:sx-acquire" },
"lockstat:::sx-release", "arg1 == 1",
"lockstat:::sx-acquire" },
{ 'H', "Lock", "Unknown event (type 38)", "units" },
{ 'H', "Lock", "Unknown event (type 39)", "units" },
{ 'H', "Lock", "Unknown event (type 40)", "units" },

View File

@ -49487,9 +49487,9 @@ static void walIndexWriteHdr(Wal *pWal){
pWal->hdr.isInit = 1;
pWal->hdr.iVersion = WALINDEX_MAX_VERSION;
walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);
memcpy((void *)&aHdr[1], (void *)&pWal->hdr, sizeof(WalIndexHdr));
memcpy((void *)&aHdr[1], (const void *)&pWal->hdr, sizeof(WalIndexHdr));
walShmBarrier(pWal);
memcpy((void *)&aHdr[0], (void *)&pWal->hdr, sizeof(WalIndexHdr));
memcpy((void *)&aHdr[0], (const void *)&pWal->hdr, sizeof(WalIndexHdr));
}
/*

View File

@ -1001,6 +1001,23 @@ main(int ac, char **av)
shorthost[strcspn(thishost, ".")] = '\0';
snprintf(portstr, sizeof(portstr), "%d", options.port);
/* Find canonic host name. */
if (strchr(host, '.') == 0) {
struct addrinfo hints;
struct addrinfo *ai = NULL;
int errgai;
memset(&hints, 0, sizeof(hints));
hints.ai_family = options.address_family;
hints.ai_flags = AI_CANONNAME;
hints.ai_socktype = SOCK_STREAM;
errgai = getaddrinfo(host, NULL, &hints, &ai);
if (errgai == 0) {
if (ai->ai_canonname != NULL)
host = xstrdup(ai->ai_canonname);
freeaddrinfo(ai);
}
}
if (options.local_command != NULL) {
debug3("expanding LocalCommand: %s", options.local_command);
cp = options.local_command;

View File

@ -357,8 +357,12 @@ if [ -z "${source_periodic_confs_defined}" ]; then
*) return 0 ;;
esac
;;
'')
# Script run manually.
return 0
;;
*)
echo "ASSERTION FAILED: Unexpected value for " \
echo "ASSERTION FAILED: Unexpected value for" \
"\$PERIODIC: '$PERIODIC'" >&2
exit 127
;;

View File

@ -296,7 +296,6 @@ detach 10 {
# Button: Button pressed (0 for power, 1 for sleep)
# CMBAT: ACPI battery events
# Lid: Lid state (0 is closed, 1 is open)
# RCTL: Resource limits
# Suspend, Resume: Suspend and resume notification
# Thermal: ACPI thermal zone events
#

View File

@ -16,7 +16,7 @@ SUBDIR+= libssp
SUBDIR+= tests
.endif
.if ${MK_GDB} != "no"
.if ${MK_BINUTILS} != "no" && ${MK_GDB} != "no"
SUBDIR+= libreadline
.endif

View File

@ -16,6 +16,8 @@ SUBDIR= ${_binutils} \
sdiff \
${_tests}
SUBDIR_DEPEND_gdb= ${_binutils}
.if ${MK_CXX} != "no"
.if ${MK_GCC} != "no"
_gperf= gperf
@ -39,13 +41,14 @@ _tests= tests
.if ${MK_BINUTILS} != "no"
_binutils= binutils
.endif
.if ${MK_GCC} != "no"
_cc= cc
.endif
.if ${MK_GDB} != "no"
_gdb= gdb
.endif
.endif
.if ${MK_GCC} != "no"
_cc= cc
.endif
SUBDIR_PARALLEL=

View File

@ -37,12 +37,6 @@ CFLAGS+= -DPPMD_32BIT
.endif
NO_WCAST_ALIGN.clang=
.ifndef COMPAT_32BIT
beforeinstall:
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${.CURDIR}/libarchive.pc ${DESTDIR}${LIBDATADIR}/pkgconfig
.endif
.PATH: ${LIBARCHIVEDIR}/libarchive
# Headers to be installed in /usr/include

View File

@ -1,12 +0,0 @@
# $FreeBSD$
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libarchive
Description: library that can create and read several streaming archive formats
Version: 3.1.2
Cflags: -I${includedir}
Libs: -L${libdir} -larchive
Libs.private: -lz -lbz2 -llzma -lbsdxml -lcrypto

View File

@ -28,6 +28,7 @@ FBSD_1.0 {
vfork;
brk;
sbrk;
makecontext;
};
FBSDprivate_1.0 {
@ -35,4 +36,5 @@ FBSDprivate_1.0 {
_end;
curbrk;
minbrk;
__makecontext;
};

View File

@ -1,10 +1,12 @@
# $FreeBSD$
SRCS+= fabs.S \
SRCS+= _ctx_start.S \
fabs.S \
flt_rounds.c \
fpgetmask.c \
fpsetmask.c \
ldexp.c \
makecontext.c \
_setjmp.S \
_set_tp.c \
setjmp.S \

View File

@ -0,0 +1,38 @@
/*-
* Copyright (c) 2015 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by Andrew Turner 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, 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.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
ENTRY(_ctx_start)
blr x19 /* Call func from makecontext */
mov x0, x20 /* Load ucp saved in makecontext */
bl _C_LABEL(ctx_done)
bl _C_LABEL(abort)
END(_ctx_start)

View File

@ -0,0 +1,86 @@
/*-
* Copyright (c) 2015 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by Andrew Turner 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, 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <machine/armreg.h>
#include <inttypes.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ucontext.h>
void _ctx_start(void);
void
ctx_done(ucontext_t *ucp)
{
if (ucp->uc_link == NULL) {
exit(0);
} else {
setcontext((const ucontext_t *)ucp->uc_link);
abort();
}
}
__weak_reference(__makecontext, makecontext);
void
__makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
{
struct gpregs *gp;
va_list ap;
int i;
/* A valid context is required. */
if (ucp == NULL)
return;
if ((argc < 0) || (argc > 8))
return;
gp = &ucp->uc_mcontext.mc_gpregs;
va_start(ap, argc);
/* Pass up to eight arguments in x0-7. */
for (i = 0; i < argc && i < 8; i++)
gp->gp_x[i] = va_arg(ap, uint64_t);
va_end(ap);
/* Set the stack */
gp->gp_sp = STACKALIGN(ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
/* Arrange for return via the trampoline code. */
gp->gp_elr = (__register_t)_ctx_start;
gp->gp_x[19] = (__register_t)func;
gp->gp_x[20] = (__register_t)ucp;
}

View File

@ -28,7 +28,7 @@
.\" @(#)syslog.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd December 30, 2004
.Dd July 21, 2015
.Dt SYSLOG 3
.Os
.Sh NAME
@ -292,4 +292,4 @@ for later interpolation by
.Pp
Always use the proper secure idiom:
.Pp
.Dl syslog("%s", string);
.Dl syslog(priority, "%s", string);

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 29, 2004
.Dd July 07, 2015
.Dt WORDEXP 3
.Os
.Sh NAME
@ -202,5 +202,5 @@ but it does not use the same parser so it may be fooled.
.Pp
The current
.Fn wordexp
implementation does not recognize multibyte characters, since the
shell (which it invokes to perform expansions) does not.
implementation does not recognize multibyte characters other than UTF-8, since
the shell (which it invokes to perform expansions) does not.

View File

@ -235,6 +235,7 @@ MAN+= abort2.2 \
nanosleep.2 \
nfssvc.2 \
ntp_adjtime.2 \
numa_getaffinity.2 \
open.2 \
pathconf.2 \
pdfork.2 \
@ -395,6 +396,7 @@ MLINKS+=mount.2 nmount.2 \
MLINKS+=mq_receive.2 mq_timedreceive.2
MLINKS+=mq_send.2 mq_timedsend.2
MLINKS+=ntp_adjtime.2 ntp_gettime.2
MLINKS+=numa_getaffinity.2 numa_setaffinity.2
MLINKS+=open.2 openat.2
MLINKS+=pathconf.2 fpathconf.2
MLINKS+=pathconf.2 lpathconf.2

View File

@ -400,6 +400,8 @@ FBSD_1.4 {
futimens;
ppoll;
utimensat;
numa_setaffinity;
numa_getaffinity;
};
FBSDprivate_1.0 {

View File

@ -28,7 +28,7 @@
.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93
.\" $FreeBSD$
.\"
.Dd January 30, 2014
.Dd July 12, 2015
.Dt MADVISE 2
.Os
.Sh NAME
@ -79,9 +79,9 @@ pages in from backing store, but quickly map the pages already in memory
into the calling process.
.It Dv MADV_DONTNEED
Allows the VM system to decrease the in-memory priority
of pages in the specified range.
Additionally future references to
this address range will incur a page fault.
of pages in the specified address range.
Consequently, future references to this address range are more likely
to incur a page fault.
.It Dv MADV_FREE
Gives the VM system the freedom to free pages,
and tells the system that information in the specified page range

View File

@ -0,0 +1,197 @@
.\" Copyright (c) 2008 Christian Brueffer
.\" Copyright (c) 2008 Jeffrey Roberson
.\" Copyright (c) 2015 Adrian Chadd
.\" 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.
.\"
.\" $FreeBSD$
.\"
.Dd May 7, 2015
.Dt NUMA_GETAFFINITY 2
.Os
.Sh NAME
.Nm numa_getaffinity ,
.Nm numa_setaffinity
.Nd manage NUMA affinity
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/param.h
.In sys/numa.h
.Ft int
.Fn numa_getaffinity "cpuwhich_t which" "id_t id" "struct vm_domain_policy_entry *policy"
.Ft int
.Fn numa_setaffinity "cpuwhich_t which" "id_t id" "const struct vm_domain_policy_entry *policy"
.Sh DESCRIPTION
.Fn numa_getaffinity
and
.Fn numa_setaffinity
allow the manipulation of NUMA policies available to processes and threads.
These functions may manipulate NUMA policies that contain many processes
or affect only a single object.
.Pp
Valid values for the
.Fa which
argument are documented in
.Xr cpuset 2 .
These arguments specify which object set are used.
Only
.Dv CPU_WHICH_TID
and
.Dv CPU_WHICH_PID
can be manipulated.
.Pp
The
.Fa policy
entry contains a vm_domain_policy_entry with the following fields:
.Bd -literal
struct vm_domain_policy_entry {
vm_domain_policy_type_t policy; /* VM policy */
int domain; /* VM domain, if applicable */
}
.Ed
.Fa vm_domain_policy_type_t policy
is one these:
.Bl -tag -width VM_POLICY_NONE
.It Dv VM_POLICY_NONE
Reset the domain back to none.
Any parent object NUMA domain policy will apply.
The only valid value for
.Dv domain
is -1.
.It Dv VM_POLICY_ROUND_ROBIN
Select round-robin policy.
Pages will be allocated round-robin from each VM domain in order.
The only valid value for
.Dv domain
is -1.
.It Dv VM_POLICY_FIXED_DOMAIN
Select fixed-domain only policy.
Pages will be allocated from the given
.Dv domain
which must be set to a valid VM domain.
Pages will not be allocated from another domain if
.Dv domain
is out of free pages.
.It Dv VM_POLICY_FIXED_DOMAIN_ROUND_ROBIN
Select fixed-domain only policy.
Pages will be allocated from
.Dv domain
which must be set to a valid VM domain.
If page allocation fails, pages will be round-robin
allocated from another domain if
.Dv domain
is out of free pages.
.It Dv VM_POLICY_FIRST_TOUCH
Select first-touch policy.
Pages will be allocated from the NUMA domain which the thread
is currently scheduled upon.
Pages will not be allocated from another domain if the current domain
is out of free pages.
The only valid value for
.Dv domain
is -1.
.It Dv VM_POLICY_FIRST_TOUCH_ROUND_ROBIN
Select first-touch policy.
Pages will be allocated from the NUMA domain which the thread
is currently scheduled upon.
Pages will be allocated round-robin from another domain if the
current domain is out of free pages.
The only valid value for
.Dv domain
is -1.
.El
.Pp
Note that the VM might assign some pages from other domains.
For example, if an existing page allocation is covered by a superpage
allocation.
.Pp
.Fn numa_getaffinity
retrieves the
NUMA policy from the object specified by
.Fa which
and
.Fa id
and stores it in the space provided by
.Fa policy .
.Pp
.Fn numa_setaffinity
attempts to set the NUMA policy for the object specified by
.Fa which
and
.Fa id
to the policy in
.Fa policy .
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS
.Va errno
can contain these error codes:
.Bl -tag -width Er
.It Bq Er EINVAL
The
.Fa level
or
.Fa which
argument was not a valid value.
.It Bq Er EINVAL
The
.Fa policy
argument specified when calling
.Fn numa_setaffinity
did not contain a valid policy.
.It Bq Er EFAULT
The policy pointer passed was invalid.
.It Bq Er ESRCH
The object specified by the
.Fa id
and
.Fa which
arguments could not be found.
.It Bq Er ERANGE
The
.Fa domain
in the given policy
was out of the range of possible VM domains available.
.It Bq Er EPERM
The calling process did not have the credentials required to complete the
operation.
.El
.Sh SEE ALSO
.Xr cpuset 1 ,
.Xr numactl 1 ,
.Xr cpuset 2 ,
.Xr cpuset_getaffinity 2 ,
.Xr cpuset_getid 2 ,
.Xr cpuset_setaffinity 2 ,
.Xr cpuset_setid 2 ,
.Xr pthread_affinity_np 3 ,
.Xr pthread_attr_affinity_np 3 ,
.Xr numa 4
.Sh HISTORY
The
.Nm
family of system calls first appeared in
.Fx 11.0 .
.Sh AUTHORS
.An Adrian Chadd Aq Mt adrian@FreeBSD.org

View File

@ -362,6 +362,15 @@ field set to
and the
.Fa si_pid
field set to the process ID of the process reporting status.
For the exited process, the
.Fa si_status
field of the
.Dv siginfo_t
structure contains the full 32 bit exit status passed to
.Xr _exit 2 ;
the
.Fa status
argument of other calls only returns 8 lowest bits of the exit status.
.Pp
When the
.Dv WNOHANG
@ -656,13 +665,6 @@ is an extension;
.Tn POSIX
only permits this flag with
.Fn waitid .
.Pp
.Tn POSIX
requires
.Fn waitid
to return the full 32 bits passed to
.Xr _exit 2 ;
this implementation only returns 8 bits like the other calls.
.Sh HISTORY
The
.Fn wait

View File

@ -12,9 +12,7 @@ NETBSD_ATF_TESTS_C+= clock_gettime_test
NETBSD_ATF_TESTS_C+= connect_test
NETBSD_ATF_TESTS_C+= dup_test
NETBSD_ATF_TESTS_C+= fsync_test
.if ${MACHINE} != "arm64" # ARM64TODO: Missing makecontext
NETBSD_ATF_TESTS_C+= getcontext_test
.endif
NETBSD_ATF_TESTS_C+= getgroups_test
NETBSD_ATF_TESTS_C+= getitimer_test
NETBSD_ATF_TESTS_C+= getlogin_test

View File

@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$");
#include <sys/tty.h>
#include <sys/file.h>
#include <sys/conf.h>
#define _WANT_KW_EXITCODE
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -389,7 +391,7 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc *p,
kp->ki_siglist = proc.p_siglist;
SIGSETOR(kp->ki_siglist, mtd.td_siglist);
kp->ki_sigmask = mtd.td_sigmask;
kp->ki_xstat = proc.p_xstat;
kp->ki_xstat = KW_EXITCODE(proc.p_xexit, proc.p_xsig);
kp->ki_acflag = proc.p_acflag;
kp->ki_lock = proc.p_lock;
if (proc.p_state != PRS_ZOMBIE) {

View File

@ -48,7 +48,8 @@ CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \
# in which case:
# * macros are used to rename symbols to libcrypt internal names
# * no weak aliases are generated
CFLAGS+= -I${.CURDIR} -DWEAK_REFS
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../sys/crypto/sha2
CFLAGS+= -DWEAK_REFS
.PATH: ${.CURDIR}/${MACHINE_ARCH} ${.CURDIR}/../../sys/crypto/sha2
.if exists(${MACHINE_ARCH}/sha.S)

View File

@ -1,312 +0,0 @@
/*-
* Copyright 2005 Colin Percival
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/endian.h>
#include <sys/types.h>
#include <string.h>
#include "sha256.h"
#if BYTE_ORDER == BIG_ENDIAN
/* Copy a vector of big-endian uint32_t into a vector of bytes */
#define be32enc_vect(dst, src, len) \
memcpy((void *)dst, (const void *)src, (size_t)len)
/* Copy a vector of bytes into a vector of big-endian uint32_t */
#define be32dec_vect(dst, src, len) \
memcpy((void *)dst, (const void *)src, (size_t)len)
#else /* BYTE_ORDER != BIG_ENDIAN */
/*
* Encode a length len/4 vector of (uint32_t) into a length len vector of
* (unsigned char) in big-endian form. Assumes len is a multiple of 4.
*/
static void
be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len)
{
size_t i;
for (i = 0; i < len / 4; i++)
be32enc(dst + i * 4, src[i]);
}
/*
* Decode a big-endian length len vector of (unsigned char) into a length
* len/4 vector of (uint32_t). Assumes len is a multiple of 4.
*/
static void
be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len)
{
size_t i;
for (i = 0; i < len / 4; i++)
dst[i] = be32dec(src + i * 4);
}
#endif /* BYTE_ORDER != BIG_ENDIAN */
/* Elementary functions used by SHA256 */
#define Ch(x, y, z) ((x & (y ^ z)) ^ z)
#define Maj(x, y, z) ((x & (y | z)) | (y & z))
#define SHR(x, n) (x >> n)
#define ROTR(x, n) ((x >> n) | (x << (32 - n)))
#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))
#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))
/* SHA256 round function */
#define RND(a, b, c, d, e, f, g, h, k) \
t0 = h + S1(e) + Ch(e, f, g) + k; \
t1 = S0(a) + Maj(a, b, c); \
d += t0; \
h = t0 + t1;
/* Adjusted round function for rotating state */
#define RNDr(S, W, i, k) \
RND(S[(64 - i) % 8], S[(65 - i) % 8], \
S[(66 - i) % 8], S[(67 - i) % 8], \
S[(68 - i) % 8], S[(69 - i) % 8], \
S[(70 - i) % 8], S[(71 - i) % 8], \
W[i] + k)
/*
* SHA256 block compression function. The 256-bit state is transformed via
* the 512-bit input block to produce a new state.
*/
static void
SHA256_Transform(uint32_t * state, const unsigned char block[64])
{
uint32_t W[64];
uint32_t S[8];
uint32_t t0, t1;
int i;
/* 1. Prepare message schedule W. */
be32dec_vect(W, block, 64);
for (i = 16; i < 64; i++)
W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16];
/* 2. Initialize working variables. */
memcpy(S, state, 32);
/* 3. Mix. */
RNDr(S, W, 0, 0x428a2f98);
RNDr(S, W, 1, 0x71374491);
RNDr(S, W, 2, 0xb5c0fbcf);
RNDr(S, W, 3, 0xe9b5dba5);
RNDr(S, W, 4, 0x3956c25b);
RNDr(S, W, 5, 0x59f111f1);
RNDr(S, W, 6, 0x923f82a4);
RNDr(S, W, 7, 0xab1c5ed5);
RNDr(S, W, 8, 0xd807aa98);
RNDr(S, W, 9, 0x12835b01);
RNDr(S, W, 10, 0x243185be);
RNDr(S, W, 11, 0x550c7dc3);
RNDr(S, W, 12, 0x72be5d74);
RNDr(S, W, 13, 0x80deb1fe);
RNDr(S, W, 14, 0x9bdc06a7);
RNDr(S, W, 15, 0xc19bf174);
RNDr(S, W, 16, 0xe49b69c1);
RNDr(S, W, 17, 0xefbe4786);
RNDr(S, W, 18, 0x0fc19dc6);
RNDr(S, W, 19, 0x240ca1cc);
RNDr(S, W, 20, 0x2de92c6f);
RNDr(S, W, 21, 0x4a7484aa);
RNDr(S, W, 22, 0x5cb0a9dc);
RNDr(S, W, 23, 0x76f988da);
RNDr(S, W, 24, 0x983e5152);
RNDr(S, W, 25, 0xa831c66d);
RNDr(S, W, 26, 0xb00327c8);
RNDr(S, W, 27, 0xbf597fc7);
RNDr(S, W, 28, 0xc6e00bf3);
RNDr(S, W, 29, 0xd5a79147);
RNDr(S, W, 30, 0x06ca6351);
RNDr(S, W, 31, 0x14292967);
RNDr(S, W, 32, 0x27b70a85);
RNDr(S, W, 33, 0x2e1b2138);
RNDr(S, W, 34, 0x4d2c6dfc);
RNDr(S, W, 35, 0x53380d13);
RNDr(S, W, 36, 0x650a7354);
RNDr(S, W, 37, 0x766a0abb);
RNDr(S, W, 38, 0x81c2c92e);
RNDr(S, W, 39, 0x92722c85);
RNDr(S, W, 40, 0xa2bfe8a1);
RNDr(S, W, 41, 0xa81a664b);
RNDr(S, W, 42, 0xc24b8b70);
RNDr(S, W, 43, 0xc76c51a3);
RNDr(S, W, 44, 0xd192e819);
RNDr(S, W, 45, 0xd6990624);
RNDr(S, W, 46, 0xf40e3585);
RNDr(S, W, 47, 0x106aa070);
RNDr(S, W, 48, 0x19a4c116);
RNDr(S, W, 49, 0x1e376c08);
RNDr(S, W, 50, 0x2748774c);
RNDr(S, W, 51, 0x34b0bcb5);
RNDr(S, W, 52, 0x391c0cb3);
RNDr(S, W, 53, 0x4ed8aa4a);
RNDr(S, W, 54, 0x5b9cca4f);
RNDr(S, W, 55, 0x682e6ff3);
RNDr(S, W, 56, 0x748f82ee);
RNDr(S, W, 57, 0x78a5636f);
RNDr(S, W, 58, 0x84c87814);
RNDr(S, W, 59, 0x8cc70208);
RNDr(S, W, 60, 0x90befffa);
RNDr(S, W, 61, 0xa4506ceb);
RNDr(S, W, 62, 0xbef9a3f7);
RNDr(S, W, 63, 0xc67178f2);
/* 4. Mix local working variables into global state */
for (i = 0; i < 8; i++)
state[i] += S[i];
}
static unsigned char PAD[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* Add padding and terminating bit-count. */
static void
SHA256_Pad(SHA256_CTX * ctx)
{
unsigned char len[8];
uint32_t r, plen;
/*
* Convert length to a vector of bytes -- we do this now rather
* than later because the length will change after we pad.
*/
be64enc(len, ctx->count);
/* Add 1--64 bytes so that the resulting length is 56 mod 64 */
r = (ctx->count >> 3) & 0x3f;
plen = (r < 56) ? (56 - r) : (120 - r);
SHA256_Update(ctx, PAD, (size_t)plen);
/* Add the terminating bit-count */
SHA256_Update(ctx, len, 8);
}
/* SHA-256 initialization. Begins a SHA-256 operation. */
void
SHA256_Init(SHA256_CTX * ctx)
{
/* Zero bits processed so far */
ctx->count = 0;
/* Magic initialization constants */
ctx->state[0] = 0x6A09E667;
ctx->state[1] = 0xBB67AE85;
ctx->state[2] = 0x3C6EF372;
ctx->state[3] = 0xA54FF53A;
ctx->state[4] = 0x510E527F;
ctx->state[5] = 0x9B05688C;
ctx->state[6] = 0x1F83D9AB;
ctx->state[7] = 0x5BE0CD19;
}
/* Add bytes into the hash */
void
SHA256_Update(SHA256_CTX * ctx, const void *in, size_t len)
{
uint64_t bitlen;
uint32_t r;
const unsigned char *src = in;
/* Number of bytes left in the buffer from previous updates */
r = (ctx->count >> 3) & 0x3f;
/* Convert the length into a number of bits */
bitlen = len << 3;
/* Update number of bits */
ctx->count += bitlen;
/* Handle the case where we don't need to perform any transforms */
if (len < 64 - r) {
memcpy(&ctx->buf[r], src, len);
return;
}
/* Finish the current block */
memcpy(&ctx->buf[r], src, 64 - r);
SHA256_Transform(ctx->state, ctx->buf);
src += 64 - r;
len -= 64 - r;
/* Perform complete blocks */
while (len >= 64) {
SHA256_Transform(ctx->state, src);
src += 64;
len -= 64;
}
/* Copy left over data into buffer */
memcpy(ctx->buf, src, len);
}
/*
* SHA-256 finalization. Pads the input data, exports the hash value,
* and clears the context state.
*/
void
SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx)
{
/* Add padding */
SHA256_Pad(ctx);
/* Write the hash */
be32enc_vect(digest, ctx->state, 32);
/* Clear the context state */
memset((void *)ctx, 0, sizeof(*ctx));
}
#ifdef WEAK_REFS
/* When building libmd, provide weak references. Note: this is not
activated in the context of compiling these sources for internal
use in libcrypt.
*/
#undef SHA256_Init
__weak_reference(_libmd_SHA256_Init, SHA256_Init);
#undef SHA256_Update
__weak_reference(_libmd_SHA256_Update, SHA256_Update);
#undef SHA256_Final
__weak_reference(_libmd_SHA256_Final, SHA256_Final);
#undef SHA256_Transform
__weak_reference(_libmd_SHA256_Transform, SHA256_Transform);
#endif

View File

@ -137,15 +137,13 @@ libusb20_parse_config_desc(const void *config_desc)
* Make a copy of the config descriptor, so that the caller can free
* the inital config descriptor pointer!
*/
ptr = (void *)(lub_endpoint + nendpoint);
memcpy(LIBUSB20_ADD_BYTES(ptr, 0), config_desc, pcdesc.len);
memcpy((void *)(lub_endpoint + nendpoint), config_desc, pcdesc.len);
ptr = (const void *)(lub_endpoint + nendpoint);
pcdesc.ptr = LIBUSB20_ADD_BYTES(ptr, 0);
config_desc = LIBUSB20_ADD_BYTES(ptr, 0);
/* init config structure */
ptr = config_desc;
LIBUSB20_INIT(LIBUSB20_CONFIG_DESC, &lub_config->desc);
if (libusb20_me_decode(ptr, ptr[0], &lub_config->desc)) {

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 27, 2013
.Dd Jul 14, 2015
.Dt CACOS 3
.Os
.Sh NAME
@ -98,11 +98,7 @@ functions perform the same operations in
.Fa float
precision.
.Pp
.ie '\*[.T]'utf8'
. ds Un \[cu]
.el
. ds Un U
.
.ds Un \[cu]
There is no universal convention for defining the principal values of
these functions. The following table gives the branch cuts, and the
corresponding ranges for the return values, adopted by the C language.

View File

@ -6,8 +6,7 @@
#
VAGRANT_IMG?= ${.OBJDIR}/vagrant.vmdk
VAGRANT_UPLOAD_TGTS= vagrant-check-depends \
atlas-do-upload
VAGRANT_UPLOAD_TGTS= vagrant-check-depends
CLEANFILES+= ${VAGRANT_UPLOAD_TGTS}
.if defined(VAGRANT_UPLOAD_CONF) && !empty(VAGRANT_UPLOAD_CONF)
@ -18,16 +17,20 @@ ATLAS${VAR}:= ${VAGRANT${VAR}}
.endif
.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE"
SNAPSHOT_DATE!= date +-%Y-%m-%d
SNAPSHOT_DATE!= date +%Y%m%d
.endif
VAGRANT_VERSION?= ${REVISION}-${BRANCH}${SNAPSHOT_DATE}
VAGRANT_VERSION!= date +%Y.%m.%d
VAGRANT_TARGET:= ${OSRELEASE}-${SNAPSHOT_DATE}
.if !empty(CLOUDWARE)
. for _PROVIDER in ${CLOUDWARE}
. if ${_PROVIDER:MVAGRANT*}
VAGRANT_PROVIDERS+= ${_PROVIDER:S/VAGRANT-//:tl}
. endif
. endfor
.endif
VAGRANT_PROVIDERS?= vmware virtualbox
VAGRANT_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}.box
VAGRANT_PROVIDERS?= vmware_desktop
#VAGRANT_PROVIDERS+= virtualbox
vagrant-upload: ${VAGRANT_UPLOAD_TGTS}
vagrant-check-depends:
.for VAR in _KEY _USERNAME _VERSION
@ -47,48 +50,73 @@ vagrant-check-depends:
. endif
.endif
vagrant-do-package: cw-vagrant
vagrant-do-package-vmware: vagrant-create-vmware-vmx vagrant-do-package
@cd ${.OBJDIR} && echo '{"provider":"vmware_desktop"}' > metadata.json
cd ${.OBJDIR} && tar -czf ${VAGRANT_TARGET} metadata.json vagrant.vmx vagrant.vmdk
touch ${.OBJDIR}/${.TARGET}
atlas-do-upload: vagrant-do-package-vmware
.for PROVIDER in ${VAGRANT_PROVIDERS}
${.CURDIR}/scripts/atlas-upload.sh -b FreeBSD-${REVISION}-${BRANCH} -f ${VAGRANT_TARGET} -p ${PROVIDER} -k ${VAGRANT_KEY} -u ${VAGRANT_USERNAME} -v ${VAGRANT_VERSION}
.endfor
touch ${.OBJDIR}/${.TARGET}
CLEANFILES+= vagrant-do-package-${PROVIDER} ${VAGRANT_TARGET}.${PROVIDER}.box
CLEANDIRS+= ${PROVIDER}
VAGRANT_UPLOAD_TGTS+= vagrant-do-upload-${PROVIDER}
vagrant-create-vmware-vmx:
@cd ${.OBJDIR} && echo '.encoding = "UTF-8"' > vagrant.vmx
@cd ${.OBJDIR} && echo 'bios.bootorder = "hdd,CDROM"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'checkpoint.vmstate = ""' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'cleanshutdown = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'config.version = "8"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'displayname = "${VAGRANT_TARGET}"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.addresstype = "generated"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.bsdname = "en0"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.connectiontype = "nat"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.displayname = "Ethernet"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.linkstatepropagation.enable = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.pcislotnumber = "33"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.present = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.virtualdev = "e1000"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.wakeonpcktrcv = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'floppy0.present = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'guestos = "freebsd-64"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'gui.fullscreenatpoweron = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'gui.viewmodeatpoweron = "windowed"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'memsize = "512"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'sound.startconnected = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'softpoweroff = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0.pcislotnumber = "16"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0.present = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0.virtualdev = "lsilogic"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0:0.filename = "vagrant.vmdk"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0:0.present = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'tools.synctime = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'usb.present = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'virtualhw.productcompatibility = "hosted"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'virtualhw.version = "9"' >> vagrant.vmx
${PROVIDER}:
@mkdir -p ${PROVIDER}
${VAGRANT_TARGET}.${PROVIDER}.box: ${PROVIDER} cw-vagrant-${PROVIDER} vagrant-create-${PROVIDER}-metadata
@echo "==> PACKAGING: ${VAGRANT_TARGET}.${PROVIDER}.box in `pwd`"
@cp vagrant-${PROVIDER}.vmdk ${PROVIDER}/vagrant.vmdk
. if ${PROVIDER} == "virtualbox"
@(cd ${.OBJDIR}/${PROVIDER} && echo '{"provider":"${PROVIDER}"}' > metadata.json)
@(cd ${.OBJDIR}/${PROVIDER} && tar -czf ../${VAGRANT_TARGET}.${PROVIDER}.box metadata.json box.ovf vagrant.vmdk)
. elif ${PROVIDER} == "vmware"
@(cd ${.OBJDIR}/${PROVIDER} && echo '{"provider":"${PROVIDER}_desktop"}' > metadata.json)
@(cd ${.OBJDIR}/${PROVIDER} && tar -czf ../${VAGRANT_TARGET}.${PROVIDER}.box metadata.json vagrant.vmx vagrant.vmdk)
. endif
CLEANFILES+= vagrant-do-upload-${PROVIDER}
vagrant-do-upload-${PROVIDER}: ${VAGRANT_TARGET}.${PROVIDER}.box
. if ${PROVIDER} == "virtualbox"
${.CURDIR}/scripts/atlas-upload.sh -b ${TYPE}-${REVISION}-${BRANCH} -f ${VAGRANT_TARGET}.${PROVIDER}.box -p ${PROVIDER} -k ${VAGRANT_KEY} -u ${VAGRANT_USERNAME} -v ${VAGRANT_VERSION}
. elif ${PROVIDER} == "vmware"
${.CURDIR}/scripts/atlas-upload.sh -b ${TYPE}-${REVISION}-${BRANCH} -f ${VAGRANT_TARGET}.${PROVIDER}.box -p ${PROVIDER}_desktop -k ${VAGRANT_KEY} -u ${VAGRANT_USERNAME} -v ${VAGRANT_VERSION}
. endif
touch ${.OBJDIR}/${.TARGET}
.endfor
vagrant-upload: ${VAGRANT_UPLOAD_TGTS}
vagrant-create-virtualbox-metadata: virtualbox/box.ovf
virtualbox/box.ovf: ${.CURDIR}/scripts/box.ovf
cp ${.ALLSRC} virtualbox/
vmware/vagrant.vmx:
@(cd vmware && echo '.encoding = "UTF-8"' > vagrant.vmx)
@(cd vmware && echo 'bios.bootorder = "hdd,CDROM"' >> vagrant.vmx)
@(cd vmware && echo 'checkpoint.vmstate = ""' >> vagrant.vmx)
@(cd vmware && echo 'cleanshutdown = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'config.version = "8"' >> vagrant.vmx)
@(cd vmware && echo 'displayname = "${VAGRANT_TARGET}"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.addresstype = "generated"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.bsdname = "en0"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.connectiontype = "nat"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.displayname = "Ethernet"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.linkstatepropagation.enable = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.pcislotnumber = "33"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.present = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.virtualdev = "e1000"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.wakeonpcktrcv = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'floppy0.present = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'guestos = "freebsd-64"' >> vagrant.vmx)
@(cd vmware && echo 'gui.fullscreenatpoweron = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'gui.viewmodeatpoweron = "windowed"' >> vagrant.vmx)
@(cd vmware && echo 'memsize = "512"' >> vagrant.vmx)
@(cd vmware && echo 'sound.startconnected = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'softpoweroff = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0.pcislotnumber = "16"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0.present = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0.virtualdev = "lsilogic"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0:0.filename = "vagrant.vmdk"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0:0.present = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'tools.synctime = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'usb.present = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'virtualhw.productcompatibility = "hosted"' >> vagrant.vmx)
@(cd vmware && echo 'virtualhw.version = "9"' >> vagrant.vmx)
vagrant-create-vmware-metadata: vmware/vagrant.vmx

View File

@ -19,7 +19,8 @@ CLOUDWARE?= AZURE \
EC2 \
GCE \
OPENSTACK \
VAGRANT
VAGRANT-VIRTUALBOX \
VAGRANT-VMWARE
AZURE_FORMAT= vhdf
AZURE_DESC= Microsoft Azure platform image
AZURE_DISK= ${OSRELEASE}.${AZURE_FORMAT}
@ -32,9 +33,12 @@ GCE_DISK= disk.${GCE_FORMAT}
OPENSTACK_FORMAT=qcow2
OPENSTACK_DESC= OpenStack platform image
OPENSTACK_DISK= ${OSRELEASE}.${OPENSTACK_FORMAT}
VAGRANT_FORMAT= vmdk
VAGRANT_DESC= Vagrant Image
VAGRANT_DISK= ${OSRELEASE}.${VAGRANT_FORMAT}
VAGRANT-VIRTUALBOX_FORMAT= vmdk
VAGRANT-VIRTUALBOX_DESC= Vagrant Image for VirtualBox
VAGRANT-VIRTUALBOX_DISK= ${OSRELEASE}.vbox.${VAGRANT_FORMAT}
VAGRANT-VMWARE_FORMAT= vmdk
VAGRANT-VMWARE_DESC= Vagrant Image for VMWare
VAGRANT-VMWARE_DISK= ${OSRELEASE}.vmware.${VAGRANT_FORMAT}
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
. for _CW in ${CLOUDWARE}

View File

@ -295,6 +295,11 @@
has been updated to support <acronym>UTF</acronym>-8, which
additionally provides unicode support to &man.sh.1;.</para>
<para revision="276893" contrib="sponsor" sponsor="&ff;">The
&man.mkimg.1; utility has been updated to support the
<acronym>MBR</acronym> <acronym>EFI</acronym> partition
type.</para>
<para revision="277166" arch="powerpc">The &man.ptrace.2; system
call has been updated include support for Altivec registers on
&os;/&arch.powerpc;.</para>
@ -306,6 +311,15 @@
devices. The &man.devctl.8; utility uses the new
&man.devctl.3; library.</para>
<para revision="279122" contrib="sponsor"
sponsor="&juniper;">The &man.netstat.1; utility has been
updated to link against the &man.libxo.3; shared
library.</para>
<para revision="279139">A new flag, <literal>-c</literal>, has
been added to the &man.mkimg.1; utility, which allows
specifying the capacity of the target disk image.</para>
<para revision="279315" contrib="sponsor" sponsor="&ff;">The
&man.uefisign.8; utility has been added.</para>
@ -314,11 +328,6 @@
been updated to prevent fetching updated binary patches when
a previous upgrade has not been thoroughly completed.</para>
<para revision="279122" contrib="sponsor"
sponsor="&juniper;">The &man.netstat.1; utility has been
updated to link against the &man.libxo.3; shared
library.</para>
<para revision="280870">A regression in the &man.libarchive.3;
library that would prevent a directory from being included in
the archive when <literal>--one-file-system</literal> is used
@ -331,16 +340,22 @@
directory traversal when extracting an archive, similar to
&man.tar.1;.</para>
<para revision="281617">A race condition in &man.wc.1; that
would cause final results to be sent to &man.stderr.4; when
receiving the <literal>SIGINFO</literal> signal has been
fixed.</para>
<para revision="282208" contrib="sponsor"
sponsor="&multiplay;">The &man.chflags.1;, &man.chgrp.1;,
&man.chmod.1;, and &man.chown.8; utilities now affect symbolic
links when the <literal>-R</literal> flag is specified, as
documented in &man.symlink.7;.</para>
<para revision="281617">A race condition in &man.wc.1; that
would cause final results to be sent to &man.stderr.4; when
receiving the <literal>SIGINFO</literal> signal has been
fixed.</para>
<para revision="282608">The &man.date.1; utility has been
updated to print the modification time of the file passed as
an argument to the <literal>-r</literal> flag, improving
compatibility with the <acronym>GNU</acronym> &man.date.1;
utility behavior.</para>
<para revision="283961">The &man.pw.8; utility has been updated
with a new flag, <literal>-R</literal>, that sets the root
@ -376,6 +391,10 @@
sponsor="&scaleengine;">The &man.fstyp.8; utility has been
updated to be able to detect &man.zfs.8; and &man.geli.8;
filesystems.</para>
<para revision="285550">The &man.w.1; utility has been updated
to display the full IPv6 remote address of the host from which
a user is connected.</para>
</sect2>
<sect2 xml:id="userland-contrib">
@ -385,9 +404,6 @@
sponsor="&darpa_afrl;">&man.lldb.1; has been updated to
upstream snapshot version r196259.</para>
<para revision="259626">Timezone data files have been updated to
version 2013i.</para>
<para revision="260445">&man.byacc.1; has been updated to
version 20140101.</para>
@ -407,9 +423,6 @@
<application>Clang</application> have been updated to
version 3.4.</para>
<para revision="276577"><application>file</application> has been
updated to version 5.22.</para>
<para revision="275718">The <application>binutils</application>
suite of utilities has been updated to include upstream
patches that add new relocations for &arch.powerpc;
@ -465,8 +478,8 @@
&man.resolvconf.8; utility has been updated to version
3.7.0.</para>
<para revision="284254"><application>bmake</application> has
been updated to version 20150606.</para>
<para revision="282613">The &man.nc.1; utility has been updated
to the OpenBSD 5.7 version.</para>
<para revision="283092">The &man.acpi.4; subsystem has been
updated to version 20150515.</para>
@ -474,6 +487,12 @@
<para revision="284237">The &man.file.1; utility has been
updated to version 5.23.</para>
<para revision="284254"><application>bmake</application> has
been updated to version 20150606.</para>
<para revision="284397">Timezone data files have been updated to
version 2015e.</para>
<para revision="285229"><application>sendmail</application> has
been updated to 8.15.2. Starting with &os;&nbsp;11.0 and
sendmail 8.15, sendmail uses uncompressed IPv6 addresses by
@ -481,12 +500,12 @@
example, instead of <quote>::1</quote>, it will be
<quote>0:0:0:0:0:0:0:1</quote>. This permits a zero subnet to
have a more specific match, such as different map entries for
IPv6:0:0 vs IPv6:0. This change requires that configuration
data (including maps, files, classes, custom ruleset, etc.)
must use the same format, so make certain such configuration
data is upgrading. As a very simple check search for patterns
like 'IPv6:[0-9a-fA-F:]*::' and 'IPv6::'. To return to the
old behavior, set the m4 option
IPv6:0:0 versus IPv6:0. This change requires that
configuration data (including maps, files, classes, custom
ruleset, etc.) must use the same format, so make certain such
configuration data is upgrading. As a very simple check
search for patterns like 'IPv6:[0-9a-fA-F:]*::' and 'IPv6::'.
To return to the old behavior, set the m4 option
<literal>confUSE_COMPRESSED_IPV6_ADDRESSES</literal> or the cf
option <literal>UseCompressedIPv6Addresses</literal>.</para>
@ -533,6 +552,11 @@
If <literal>LOCALBASE</literal> is unset, it defaults to
<filename class="directory">/usr/local</filename>.</para>
<para revision="273955">A new &man.rc.8; script,
<filename>growfs</filename>, has been added, which will resize
the root filesystem on boot if <filename>/firstboot</filename>
exists.</para>
<para revision="275299">The <filename>mrouted</filename>
&man.rc.8; script has been removed from the base system. An
equivalent script is available from the <filename
@ -553,6 +577,14 @@
<filename>110.clean-tmps</filename> has been updated to avoid
crossing filesystem mount boundaries when cleaning files in
<filename class="directory">/tmp</filename>.</para>
<para revision="277216" contrib="sponsor" sponsor="&ff;">A new
&man.periodic.8; script,
<filename>510.status-world-kernel</filename>, has been added,
which evaluates the running userland and kernel versions from
the &man.uname.1; <literal>-U</literal> and
<literal>-K</literal> arguments, and prints an error if the
system userland and kernel are not in sync.</para>
</sect2>
<sect2 xml:id="userland-libraries">
@ -592,6 +624,11 @@
providing a wrapper around the &man.gpio.4; kernel
interface.</para>
<para revision="275800" contrib="sponsor" sponsor="&ff;">The
&man.procctl.2; system call has been updated to include
a facility for non-&man.init.8; processes to be declared as
the reaper of child processes and their decendants.</para>
<para revision="277610">The <literal>futimens()</literal> and
<literal>utimensat()</literal> system calls have been
added. See &man.utimensat.2; for more information.</para>
@ -670,6 +707,14 @@
and <literal>asttrapexit()</literal> functions instead of
checking within addressed kernel space.</para>
<para revision="271917">A kernel panic triggered when destroying
a &man.vnet.9; &man.jail.8; configured with &man.gif.4; has
been fixed.</para>
<para revision="271918">A kernel panic triggered when destroying
a &man.vnet.9; &man.jail.8; configured with &man.gre.4; has
been fixed.</para>
<para revision="272089">A bug in &man.ipfw.4; that could
potentially lead to a kernel panic when using &man.dummynet.4;
at layer 2 has been fixed.</para>
@ -732,6 +777,15 @@
system.</para>
</important>
<para revision="278338" arch="arm">A new module for creating
<filename>rpi.dtb</filename> has been added for the Raspberry
Pi.</para>
<para revision="278340" arch="arm">The
<filename>rpi.dtb</filename> module is now installed to
<filename class="directory">/boot/dtb/</filename> by
default for the Raspberry Pi system.</para>
<para revision="279189" contrib="sponsor" sponsor="&ff;"
arch="powerpc">Kernel support for Vector-Scalar eXtension
(<acronym>VSX</acronym>) found on POWER7 and POWER8 hardware
@ -742,6 +796,33 @@
&powerpc; processors has been overhaulded to improve
concurrency.</para>
<para revision="279824" arch="arm">A new module for creating
the <filename>dtb</filename> module for AM335x systems has
been added.</para>
<para revision="281495" contrib="sponsor" sponsor="&ff;">The
<literal>PAE_TABLES</literal> kernel configuration option has
been added for &os;/&arch.i386;, which instructs &man.pmap.9;
to use <acronym>PAE</acronym> format for page tables.</para>
<para revision="282215">The <literal>SIFTR</literal> kernel
configuration has been added, allowing building &man.siftr.4;
statically into the kernel.</para>
<para revision="282731" arch="arm">The &arch.arm; boot loader,
<filename>ubldr</filename>, is now relocatable. In addition,
<filename>ubldr.bin</filename> is now created during build
time, which is a stripped binary with an entry point of
<literal>0</literal>, providing the ability to specify the
load address by running <literal>go
&dollar;{loadaddr}</literal> in
<literal>u-boot</literal>.</para>
<para revision="282921" contrib="sponsor" sponsor="&intelcorp;"
arch="amd64,i386">The &man.nvd.4; and &man.nvme.4; drivers are
now included in the <filename>GENERIC</filename> kernel
configuration by default.</para>
<para revision="283959" contrib="sponsor"
sponsor="&limelight;">A new kernel configuration option,
<literal>EM_MULTIQUEUE</literal>, has been added which enables
@ -841,6 +922,11 @@
<para revision="280183">The <literal>drm</literal> code has
been updated to match &linux; version 3.8.13.</para>
<para revision="281440">The &man.psm.4; driver has been updated
to include improved support for newer Synaptics&nbsp;&reg;
touchpads and the ClickPad&nbsp;&reg; mouse on newer
Lenovo&nbsp;&trade; laptops.</para>
<para revision="282783" arch="powerpc">Support for the Freescale
<acronym>PCI</acronym> Root Complex device has been
added.</para>
@ -928,6 +1014,11 @@
<para revision="272730">The &man.alc.4; driver has been updated
to support AR816x and AR817x ethernet controllers.</para>
<para revision="272906">The &man.pfil.9; interface default hash
has been changed from <literal>Jenkins</literal> to
<literal>Murmur3</literal>, providing a 3-percent performance
increase in packets-per-second.</para>
<para revision="273331">The &man.vxlan.4; driver has been added,
which creates a virtual Layer 2 (Ethernet) network overlaid in
a Layer 3 (IP/UDP) network. The &man.vxlan.4; driver is
@ -939,9 +1030,20 @@
been split into two separate modules, &man.gre.4; and
&man.me.4;.</para>
<para revision="278551">The &man.ral.4; driver has been updated
to support the RT5390 and RT5392 chipsets.</para>
<para revision="283514" contrib="sponsor"
sponsor="&solarflare;">The &man.sfxge.4; driver has been
updated to support Solarflare Flareon Ultra 7000-series
chipsets.</para>
<para revision="283766" contrib="sponsor"
sponsor="&limelight;">The &man.em.4; driver has been updated
with improved transmission queue hang detection.</para>
<para revision="284125">The &man.cdce.4; driver has been updated
to include support for the RTL8153 chipset.</para>
</sect2>
</sect1>
@ -977,10 +1079,6 @@
driver has been updated to correct performance counter
sampling on G4 (MPC74xxx) and G5 class processors.</para>
<para revision="281713" arch="powerpc">The &man.hwpmc.4;
driver has been updated to support the Freescale e500
core.</para>
<para revision="275732" contrib="sponsor"
sponsor="&ff;,&netgate;">The
<application>OpenCrypto</application> framework has been
@ -988,6 +1086,10 @@
<literal>AES-GCM</literal> modes, both of which have also been
added to the &man.aesni.4; driver.</para>
<para revision="281713" arch="powerpc">The &man.hwpmc.4;
driver has been updated to support the Freescale e500
core.</para>
<para revision="283766">The &man.ig4.4; driver has been added,
providing support for the fourth generation &intel;
<acronym>I2C</acronym> SMBus.</para>
@ -1036,6 +1138,11 @@
I/O, and uses hardware virtualization extensions for all other
tasks, without the need for emulation.</para>
<para revision="273375">The &man.bhyve.8; hypervisor has been
updated to support &amd; processors with
<acronym>SVM</acronym> and <acronym>AMD-V</acronym> hardware
extensions.</para>
<para revision="273515">The &man.virtio.console.4; driver has
been added, which provides an interface to VirtIO console
devices through a &man.tty.4; device.</para>
@ -1083,6 +1190,16 @@
<para revision="260921">The &man.nand.4; device is enabled for
ARM devices by default.</para>
<para revision="266943" arch="arm">Support for the Exynos 5420
Octa system has been added.</para>
<para revision="267390" arch="arm">The <acronym>SMP</acronym>
option has been enabled for all Exynos 5 systems supported by
&os;.</para>
<para revision="268838" arch="arm">Support for the Toradex
Apalis i.MX6 development board has been added.</para>
<para revision="273264" arch="armv6">An issue that could cause
instability when detecting <acronym>SD</acronym> cards on the
Raspberry Pi <acronym>SOC</acronym> has been fixed.</para>
@ -1092,6 +1209,17 @@
frequency and voltage control on the Raspberry Pi
<acronym>SOC</acronym>.</para>
<para revision="277042" arch="arm">Support to turn off the
BeagleBone Black system with the &man.shutdown.8;
<literal>-p</literal> flag or by invoking &man.poweroff.8; has
been added.</para>
<para revision="277644" arch="arm">Audio transmission drivers
have been added for Digital Audio Multiplexer
(<acronym>AUDMUXM</acronym>), Smart Direct Memory Access
Controller (<acronym>SDMA</acronym>), and Syncronous Serial
Interface (<acronym>SSI</acronym>).</para>
<para revision="280259" contrib="sponsor" sponsor="&ff;">Initial
support for the ARM AArch64 architecture has been
added.</para>
@ -1153,6 +1281,11 @@
is administered with the &man.automount.8; userland utility,
and the &man.automountd.8; and &man.autounmountd.8;
daemons.</para>
<para revision="273849" contrib="sponsor" sponsor="&ff;">Support
for the <literal>timeo</literal>, <literal>actimeo</literal>,
<literal>noac</literal>, and <literal>proto</literal> options
have been added to &man.mount.nfs.8;.</para>
</sect2>
<sect2 xml:id="storage-zfs">
@ -1173,6 +1306,11 @@
<para revision="267359">Support for the
<literal>disklabel64</literal> partitioning scheme has been
added to &man.gpart.8;.</para>
<para revision="282465">Support for the
<literal>apple-boot</literal>, <literal>apple-hfs</literal>,
and <literal>apple-ufs</literal> <acronym>MBR</acronym>
partitioning schemes have been added to &man.gpart.8;.</para>
</sect2>
</sect1>
@ -1185,6 +1323,15 @@
<sect2 xml:id="boot-loader">
<title>Boot Loader Changes</title>
<para revision="258431" contrib="sponsor" sponsor="&ff;">The
memory test run at boot time on &os;/&arch.amd64; platforms
has been disabled by default.</para>
<para revision="262955">A new &man.ttys.5; class,
<literal>3wire</literal>, has been added. This is similar to
the existing terminal classes, but does not have a defined
baudrate.</para>
<para revision="274085">The &man.vt.4; driver has been made the
default system console driver. The &man.syscons.4; driver is
still available, and can be enabled by adding
@ -1193,15 +1340,20 @@
entering <literal>set kern.vty=sc</literal> at the
&man.loader.8; prompt.</para>
<para revision="279950">Support for <literal>bzipfs</literal>
has been added to the <acronym>EFI</acronym> loader.</para>
<para revision="281616">The boot loader has been updated to
support entering the <acronym>GELI</acronym> passphrase before
loading the kernel. To enable this behavior, add
<literal>geom_eli_passphrase_prompt="YES"</literal> to
&man.loader.conf.5;.</para>
<para revision="258431" contrib="sponsor" sponsor="&ff;">The
memory test run at boot time on &os;/&arch.amd64; platforms
has been disabled by default.</para>
<para revision="284683" contrib="sponsor" sponsor="&ff;"
arch="arm">The &man.ttys.5; file for &os;/&arch.arm; has been
updated to enable <filename>ttyu1</filename>,
<filename>ttyu2</filename>, and <filename>ttyu3</filename> by
default, if the callin port is an active console port.</para>
</sect2>
<sect2 xml:id="boot-menu">
@ -1369,6 +1521,18 @@
Release Engineering build tools have been updated to include
support for building &os;/&arch.arm64; virtual machine and
memory stick installation images.</para>
<para revision="282693" contrib="sponsor" sponsor="&ff;">The
Release Engineering build tools have been updated to support
building &os;/&arch.arm; images without external utilities for
supported boards where a corresponding
<literal>u-boot</literal> port exists in the Ports
Collection.</para>
<para revision="283307" contrib="sponsor" sponsor="&ff;">The
&os;/&arch.i386; memory stick installation images are now
created using the &man.mkimg.1; utility, matching the way
the &os;/&arch.amd64; images are created.</para>
</sect2>
</sect1>
</article>

View File

@ -27,6 +27,7 @@
<!ENTITY juniper "Juniper Networks, Inc.">
<!ENTITY intelcorp "Intel Corporation">
<!ENTITY ix "iXsystems">
<!ENTITY limelight "Limelight Networks">
@ -42,6 +43,7 @@
<!ENTITY sandvine "Sandvine, Inc.">
<!ENTITY scaleengine "ScaleEngine, Inc.">
<!ENTITY solarflare "Solarflare Communications, Inc.">
<!ENTITY spectralogic "Spectra Logic">
<!ENTITY yandex "Yandex LLC">

View File

@ -532,7 +532,11 @@ do_links() { # rootdir varname
# if no argument default to objdir/SHLIBDIRPREFIX for both
find_progs() { # programs
# logverbose "find_progs: called with $*"
local i=`realpath ${o_objdir:-${_SHLIBDIRPREFIX}/..}`
# rev.284898 removed _SHLIBDIRPREFIX so we need to reconstruct
# its value in i1
local i1=${_SHLIBDIRPREFIX:-${l_objtree}/${SRC}/tmp}
local i=`realpath ${o_objdir:-${i1}/..}`
# default values for -L and -P
local dir="-P $i"
local ldir="-L $i"

View File

@ -28,20 +28,23 @@
ATLAS_API_URL=''
ATLAS_UPLOAD_URL='https://binstore.hashicorp.com'
VERSION_DESCRIPTION="FreeBSD Snapshot Build"
DESCRIPTION="FreeBSD Snapshot Build"
usage() {
echo "${0} usage:"
echo "-b box-name -f box-to-upload -k api-key -p provider -u user -v version"
echo "-b box-name -d 'box description' -f box-to-upload -k api-key -p provider -u user -v version"
return 1
}
main () {
while getopts "b:f:k:p:u:v:" arg; do
while getopts "b:d:f:k:p:u:v:" arg; do
case "${arg}" in
b)
BOX="${OPTARG}"
;;
d)
DESCRIPTION="${OPTARG}"
;;
f)
FILE="${OPTARG}"
;;
@ -83,6 +86,7 @@ main () {
echo "Creating box: ${BOX}"
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/boxes -X POST -d "box[name]=${BOX}" -d "access_token=${KEY}" > /dev/null
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[is_private]=false" -d "access_token=${KEY}" > /dev/null
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[description]='${DESCRIPTION}'" -d "access_token=${KEY}" > /dev/null
else
echo "Box already exists"
fi
@ -97,7 +101,7 @@ main () {
if [ $? != 0 ]; then
echo "Creating version: ${VERSION}"
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/versions -X POST -d "version[version]=${VERSION}" -d "access_token=${KEY}" > /dev/null
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION} -X PUT -d "version[description]=${VERSION_DESCRIPTION}" -d "access_token=${KEY}" > /dev/null
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION} -X PUT -d "version[description]=${DESCRIPTION}" -d "access_token=${KEY}" > /dev/null
VERSIONRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}?access_token=${KEY}")
echo $VERSIONRESULT | grep "\"version\":\"${VERSION}\"" > /dev/null
if [ $? != 0 ]; then

226
release/scripts/box.ovf Normal file
View File

@ -0,0 +1,226 @@
<?xml version="1.0"?>
<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine">
<References>
<File ovf:href="vagrant.vmdk" ovf:id="file1"/>
</References>
<DiskSection>
<Info>List of the virtual disks used in the package</Info>
<Disk ovf:capacity="10632560640" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid="e349f8b6-c400-4e7a-9825-598becab2f94"/>
</DiskSection>
<NetworkSection>
<Info>Logical networks used in the package</Info>
<Network ovf:name="NAT">
<Description>Logical network used by this appliance.</Description>
</Network>
</NetworkSection>
<VirtualSystem ovf:id="freebsd">
<Info>A virtual machine</Info>
<OperatingSystemSection ovf:id="78">
<Info>The kind of installed guest operating system</Info>
<Description>FreeBSD_64</Description>
<vbox:OSType ovf:required="false">FreeBSD_64</vbox:OSType>
</OperatingSystemSection>
<VirtualHardwareSection>
<Info>Virtual hardware requirements for a virtual machine</Info>
<System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>freebsd</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>
</System>
<Item>
<rasd:Caption>1 virtual CPU</rasd:Caption>
<rasd:Description>Number of virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
</Item>
<Item>
<rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits>
<rasd:Caption>512 MB of memory</rasd:Caption>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
</Item>
<Item>
<rasd:Address>0</rasd:Address>
<rasd:Caption>ideController0</rasd:Caption>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>ideController0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceSubType>PIIX4</rasd:ResourceSubType>
<rasd:ResourceType>5</rasd:ResourceType>
</Item>
<Item>
<rasd:Address>1</rasd:Address>
<rasd:Caption>ideController1</rasd:Caption>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>ideController1</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:ResourceSubType>PIIX4</rasd:ResourceSubType>
<rasd:ResourceType>5</rasd:ResourceType>
</Item>
<Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Caption>disk1</rasd:Caption>
<rasd:Description>Disk Image</rasd:Description>
<rasd:ElementName>disk1</rasd:ElementName>
<rasd:HostResource>/disk/vmdisk1</rasd:HostResource>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</Item>
<Item>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Caption>Ethernet adapter on 'NAT'</rasd:Caption>
<rasd:Connection>NAT</rasd:Connection>
<rasd:ElementName>Ethernet adapter on 'NAT'</rasd:ElementName>
<rasd:InstanceID>6</rasd:InstanceID>
<rasd:ResourceSubType>E1000</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</Item>
</VirtualHardwareSection>
<vbox:Machine ovf:required="false" version="1.12-macosx" uuid="{8b837be7-fa96-48fc-b119-e90cfa144456}" name="freebsd" OSType="FreeBSD_64" snapshotFolder="Snapshots" lastStateChange="2014-03-13T13:50:05Z">
<ovf:Info>Complete VirtualBox machine configuration in VirtualBox format</ovf:Info>
<ExtraData>
<ExtraDataItem name="GUI/LastGuestSizeHint" value="720,400"/>
<ExtraDataItem name="GUI/LastNormalWindowPosition" value="400,183,720,421"/>
</ExtraData>
<Hardware version="2">
<CPU count="1" hotplug="false">
<HardwareVirtEx enabled="true"/>
<HardwareVirtExNestedPaging enabled="true"/>
<HardwareVirtExVPID enabled="true"/>
<HardwareVirtExUX enabled="true"/>
<PAE enabled="true"/>
<HardwareVirtExLargePages enabled="true"/>
<HardwareVirtForce enabled="false"/>
</CPU>
<Memory RAMSize="512" PageFusion="false"/>
<HID Pointing="PS2Mouse" Keyboard="PS2Keyboard"/>
<HPET enabled="false"/>
<Chipset type="PIIX3"/>
<Boot>
<Order position="1" device="HardDisk"/>
<Order position="2" device="DVD"/>
<Order position="3" device="None"/>
<Order position="4" device="None"/>
</Boot>
<Display VRAMSize="8" monitorCount="1" accelerate3D="false" accelerate2DVideo="false"/>
<VideoCapture/>
<RemoteDisplay enabled="false" authType="Null"/>
<BIOS>
<ACPI enabled="true"/>
<IOAPIC enabled="true"/>
<Logo fadeIn="true" fadeOut="true" displayTime="0"/>
<BootMenu mode="MessageAndMenu"/>
<TimeOffset value="0"/>
<PXEDebug enabled="false"/>
</BIOS>
<USBController enabled="false" enabledEhci="false"/>
<Network>
<Adapter slot="0" enabled="true" MACAddress="080027D14C66" cable="true" speed="0" type="82540EM">
<DisabledModes/>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</Adapter>
<Adapter slot="1" enabled="false" MACAddress="080027058FF2" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="2" enabled="false" MACAddress="08002763A181" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="3" enabled="false" MACAddress="0800279C6D17" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="4" enabled="false" MACAddress="08002760C885" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="5" enabled="false" MACAddress="0800279ECE95" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="6" enabled="false" MACAddress="08002730E8BE" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="7" enabled="false" MACAddress="080027AD8EF8" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
</Network>
<UART>
<Port slot="0" enabled="false" IOBase="0x3f8" IRQ="4" hostMode="Disconnected"/>
<Port slot="1" enabled="false" IOBase="0x2f8" IRQ="3" hostMode="Disconnected"/>
</UART>
<LPT>
<Port slot="0" enabled="false" IOBase="0x378" IRQ="7"/>
<Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/>
</LPT>
<AudioAdapter controller="AC97" driver="CoreAudio" enabled="false"/>
<RTC localOrUTC="local"/>
<SharedFolders/>
<Clipboard mode="Disabled"/>
<DragAndDrop mode="Disabled"/>
<IO>
<IoCache enabled="true" size="5"/>
<BandwidthGroups/>
</IO>
<HostPci>
<Devices/>
</HostPci>
<EmulatedUSB>
<CardReader enabled="false"/>
</EmulatedUSB>
<Guest memoryBalloonSize="0"/>
<GuestProperties>
<GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="en_US" timestamp="1394718154090069000" flags=""/>
</GuestProperties>
</Hardware>
<StorageControllers>
<StorageController name="IDE Controller" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
<AttachedDevice type="HardDisk" port="0" device="0">
<Image uuid="{e349f8b6-c400-4e7a-9825-598becab2f94}"/>
</AttachedDevice>
</StorageController>
</StorageControllers>
</vbox:Machine>
</VirtualSystem>
</Envelope>

View File

@ -112,10 +112,6 @@ arm_install_base() {
>> ${CHROOTDIR}/${DESTDIR}/etc/fstab
echo "md /tmp mfs rw,noatime,-s30m 0 0" \
>> ${CHROOTDIR}/${DESTDIR}/etc/fstab
echo "md /var/log mfs rw,noatime,-s15m 0 0" \
>> ${CHROOTDIR}/${DESTDIR}/etc/fstab
echo "md /var/tmp mfs rw,noatime,-s12m 0 0" \
>> ${CHROOTDIR}/${DESTDIR}/etc/fstab
local hostname
hostname="$(echo ${KERNEL} | tr '[:upper:]' '[:lower:]')"

View File

@ -0,0 +1,18 @@
#!/bin/sh
#
# $FreeBSD$
#
. ${WORLDDIR}/release/tools/vagrant.conf
export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} virtualbox-ose-additions"
vm_extra_pre_umount () {
# VirtualBox first boot pkgs
echo 'firstboot_pkgs_list="sudo rsync virtualbox-ose-additions"' >> ${DESTDIR}/etc/rc.conf
echo 'vboxguest_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vboxservice_enable="YES"' >> ${DESTDIR}/etc/rc.conf
# Setup the Vagrant common items
vagrant_common
}

View File

@ -0,0 +1,22 @@
#!/bin/sh
#
# $FreeBSD$
#
. ${WORLDDIR}/release/tools/vagrant.conf
export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} open-vm-tools-nox11"
vm_extra_pre_umount () {
# VMWare first boot pkgs
echo 'firstboot_pkgs_list="sudo rsync open-vm-tools-nox11"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guest_vmblock_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guest_vmhgfs_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guest_vmmemctl_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guest_vmxnet_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guestd_enable="YES"' >> ${DESTDIR}/etc/rc.conf
# Setup the Vagrant common items
vagrant_common
}

View File

@ -10,18 +10,15 @@ export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs"
# Set to a list of third-party software to enable in rc.conf(5).
export VM_RC_LIST="firstboot_freebsd_update firstboot_pkgs"
vm_extra_pre_umount() {
vagrant_common () {
# The firstboot_pkgs rc.d script will download the repository
# catalogue and install or update pkg when the instance first
# launches, so these files would just be replaced anyway; removing
# them from the image allows it to boot faster.
env ASSUME_ALWAYS_YES=yes pkg -c ${DESTDIR} clean -y -a
env ASSUME_ALWAYS_YES=yes pkg -c ${DESTDIR} delete -f -y pkg
rm ${DESTDIR}/var/db/pkg/repo-*.sqlite
# The size of the EC2 root disk can be configured at instance launch
# time; expand our filesystem to fill the disk.
echo 'growfs_enable="YES"' >> ${DESTDIR}/etc/rc.conf
# Vagrant instances use DHCP to get their network configuration.
echo 'ifconfig_DEFAULT="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf
@ -36,9 +33,6 @@ vm_extra_pre_umount() {
echo 'sendmail_outbound_enable="NO"' >> ${DESTDIR}/etc/rc.conf
echo 'sendmail_msp_queue_enable="NO"' >> ${DESTDIR}/etc/rc.conf
# sudo is required
echo 'firstboot_pkgs_list="sudo rsync"' >> ${DESTDIR}/etc/rc.conf
# Create the vagrant user with a password of vagrant
/usr/sbin/pw -R ${DESTDIR} \
groupadd vagrant -g 1001

View File

@ -41,7 +41,7 @@
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\"
.Dd May 13, 2015
.Dd July 11, 2015
.Dt DEVD.CONF 5
.Os
.Sh NAME
@ -332,10 +332,34 @@ Battery events.
Lid state ($notify=0x00 is closed, 0x01 is open).
.It Li PROCESSOR
Processor state/configuration ($notify=0x81 is a change in available Cx states).
.It Li Resume
Resume notification.
.It Li Suspend
Suspend notification.
.It Li Thermal
Thermal zone events.
.El
.Pp
.It Li CARP
Events related to the
.Xr carp 8
protocol.
.Bl -tag -width ".Sy Subsystem" -compact
.It Sy Subsystem
.It Ar vhid@interface
The
.Dq subsystem
contains the actual CARP vhid and the name of the network interface
on which the event took place.
.Bl -tag -width ".Li MASTER" -compact
.It Sy Type
.It Li MASTER
Node become the master for a virtual host.
.It Li BACKUP
Node become the backup for a virtual host.
.El
.El
.Pp
.It Li IFNET
Events related to the network subsystem.
.Bl -tag -width ".Sy Subsystem" -compact

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd June 11, 2015
.Dd July 18, 2015
.Dt GMULTIPATH 8
.Os
.Sh NAME
@ -107,10 +107,10 @@ When using the
.Dq manual
method, no metadata are stored on the devices, so the multipath
device has to be configured by hand every time it is needed.
Additional device paths also won't be detected automatically.
Additional device paths also will not be detected automatically.
The
.Dq automatic
method uses on-disk metadata to detect device and all it's paths.
method uses on-disk metadata to detect device and all its paths.
Metadata use the last sector of the underlying disk device and
include device name and UUID.
The UUID guarantees uniqueness in a shared storage environment
@ -350,6 +350,14 @@ GEOM_MULTIPATH: da0 added to FRED
GEOM_MULTIPATH: da0 is now active path in FRED
GEOM_MULTIPATH: da2 added to FRED
.Ed
.Pp
To load the
.Nm
module at boot time, add this entry to
.Pa /boot/loader.conf :
.Bd -literal -offset ident
geom_multipath_load="YES"
.Ed
.Sh SEE ALSO
.Xr geom 4 ,
.Xr isp 4 ,

View File

@ -1106,14 +1106,11 @@ gpart_write_partcode(struct ggeom *gp, int idx, void *code, ssize_t size)
if (pp != NULL) {
snprintf(dsf, sizeof(dsf), "/dev/%s", pp->lg_name);
if (pp->lg_mediasize < size)
errx(EXIT_FAILURE, "%s: not enough space", dsf);
fd = open(dsf, O_WRONLY);
if (fd == -1)
err(EXIT_FAILURE, "%s", dsf);
if (lseek(fd, size, SEEK_SET) != size)
errx(EXIT_FAILURE, "%s: not enough space", dsf);
if (lseek(fd, 0, SEEK_SET) != 0)
err(EXIT_FAILURE, "%s", dsf);
/*
* When writing to a disk device, the write must be
* sector aligned and not write to any partial sectors,
@ -1152,11 +1149,11 @@ gpart_write_partcode_vtoc8(struct ggeom *gp, int idx, void *code)
if (pp->lg_sectorsize != sizeof(struct vtoc8))
errx(EXIT_FAILURE, "%s: unexpected sector "
"size (%d)\n", dsf, pp->lg_sectorsize);
if (pp->lg_mediasize < VTOC_BOOTSIZE)
continue;
fd = open(dsf, O_WRONLY);
if (fd == -1)
err(EXIT_FAILURE, "%s", dsf);
if (lseek(fd, VTOC_BOOTSIZE, SEEK_SET) != VTOC_BOOTSIZE)
continue;
/*
* We ignore the first VTOC_BOOTSIZE bytes of boot code in
* order to avoid overwriting the label.

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 5, 2015
.Dd July 14, 2015
.Dt GPART 8
.Os
.Sh NAME
@ -933,6 +933,12 @@ start-up script.
See
.Xr gptboot 8
for more details.
.It Cm lenovofix
Setting this attribute overwrites the Protective MBR with a new one where
the 0xee partition is the second, rather than the first record.
This resolves a BIOS compatibility issue with some Lenovo models including the
X220, T420, and T520, allowing them to boot from GPT partitioned disks
without using EFI.
.El
.Pp
The scheme-specific attributes for MBR:

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 2, 2015
.Dd July 14, 2015
.Dt GGATEC 8
.Os
.Sh NAME
@ -71,8 +71,8 @@ utility is a network client for the GEOM Gate class.
It is responsible for the creation of
.Nm ggate
devices and forwarding I/O requests between the
.Nm geom_gate.ko
kernel module and the
.Nm GEOM Gate
kernel subsystem and the
.Xr ggated 8
network daemon.
Available commands:
@ -111,7 +111,7 @@ Do not use
.Dv TCP_NODELAY
option on TCP sockets.
.It Fl o Cm ro | wo | rw
Specify permission to use when opening the file or device: read-only
Specify permissions to use when opening the file or device: read-only
.Pq Cm ro ,
write-only
.Pq Cm wo ,
@ -136,7 +136,7 @@ Default is 131072 (128kB).
Sector size for
.Nm ggate
provider.
If not specified, it is taken from device, or set to 512 bytes for files.
If not specified, it is taken from the device, or set to 512 bytes for files.
.It Fl t Ar timeout
Number of seconds to wait before an I/O request will be canceled.
Default is 0, which means no timeout.

View File

@ -447,6 +447,7 @@ g_gatec_create(void)
/*
* Ok, got both sockets, time to create provider.
*/
memset(&ggioc, 0, sizeof(ggioc));
ggioc.gctl_version = G_GATE_VERSION;
ggioc.gctl_mediasize = mediasize;
ggioc.gctl_sectorsize = sectorsize;

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 29, 2004
.Dd July 14, 2015
.Dt GGATED 8
.Os
.Sh NAME
@ -43,14 +43,14 @@
.Sh DESCRIPTION
The
.Nm
utility is a network server for GEOM Gate class.
utility is a network server for the GEOM Gate class.
It runs on a server machine to service GEOM Gate requests from workers
placed on a client machine.
Keep in mind, that connection between
Keep in mind, that connections between
.Xr ggatec 8
and
.Nm
is not encrypted.
are not encrypted.
.Pp
Available options:
.Bl -tag -width ".Ar exports\ file"
@ -65,7 +65,7 @@ option on TCP sockets.
.It Fl p Ar port
Port on which
.Nm
listens for connection.
listens for connections.
Default is 3080.
.It Fl R Ar rcvbuf
Size of receive buffer to use.
@ -74,7 +74,7 @@ Default is 131072 (128kB).
Size of send buffer to use.
Default is 131072 (128kB).
.It Fl v
Do not fork, run in foreground and print debug informations on standard
Do not fork, run in foreground and print debug information on standard
output.
.It Ar "exports file"
An alternate location for the exports file.

View File

@ -906,8 +906,8 @@ handshake(struct sockaddr *from, int sfd)
ex = exports_find(from, &cinit, conn);
if (ex == NULL) {
connection_remove(conn);
sendfail(sfd, errno, NULL);
connection_remove(conn);
return (0);
}
if (conn->c_mediasize == 0) {

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 9, 2015
.Dd July 14, 2015
.Dt GGATEL 8
.Os
.Sh NAME
@ -62,7 +62,7 @@ It can be used as a replacement for
devices or as a
.Dq GEOMificator
for non GEOM-aware devices, but it was mainly created as an example
on how to use and how to communicate with the GEOM Gate kernel module.
on how to use and how to communicate with the GEOM Gate kernel subsystem.
.Pp
Available commands:
.Bl -tag -width ".Cm destroy"
@ -82,7 +82,8 @@ providers.
Take over a previously created provider and handle pending and future
requests. This is useful if the initial
.Nm
process died. To prevent data loss, the given path must lead to the
process died.
To prevent data loss, the given path must lead to the
regular file or device that was used to create the provider.
.El
.Pp
@ -93,7 +94,7 @@ Forcibly destroy
.Nm ggate
provider (cancels all pending requests).
.It Fl o Cm ro | wo | rw
Specify permission to use when opening the file or device: read-only
Specify permissions to use when opening the file or device: read-only
.Pq Cm ro ,
write-only
.Pq Cm wo ,
@ -105,7 +106,7 @@ Default is
Sector size for
.Nm ggate
provider.
If not specified, it is taken from device, or set to 512 bytes for files.
If not specified, it is taken from the device, or set to 512 bytes for files.
.It Fl t Ar timeout
Number of seconds to wait before an I/O request will be canceled.
0 means no timeout.
@ -131,7 +132,7 @@ the
.Dq Li fd0
device and use
.Xr gbde 8
to encrypt data on a floppy.
to encrypt data on a floppy disk.
.Bd -literal -offset indent
ggatel create -u 5 /dev/fd0
gbde init /dev/ggate5

View File

@ -173,6 +173,7 @@ g_gatel_create(void)
fd = open(path, g_gate_openflags(flags) | O_DIRECT | O_FSYNC);
if (fd == -1)
err(EXIT_FAILURE, "Cannot open %s", path);
memset(&ggioc, 0, sizeof(ggioc));
ggioc.gctl_version = G_GATE_VERSION;
ggioc.gctl_unit = unit;
ggioc.gctl_mediasize = g_gate_mediasize(fd);

View File

@ -28,7 +28,7 @@
.\" @(#)newfs.8 8.6 (Berkeley) 5/3/95
.\" $FreeBSD$
.\"
.Dd October 1, 2013
.Dd July 15, 2015
.Dt NEWFS 8
.Os
.Sh NAME
@ -152,7 +152,7 @@ The expected average number of files per directory on the file system.
.It Fl i Ar bytes
Specify the density of inodes in the file system.
The default is to create an inode for every
.Pq 4 * Ar frag-size
.Pq 2 * Ar frag-size
bytes of data space.
If fewer inodes are desired, a larger number should be used;
to create more inodes a smaller number should be given.
@ -173,7 +173,7 @@ Clustering the metadata blocks speeds up random file access
and decreases the running time of
.Xr fsck 8 .
By default
.Xr newfs 8
.Nm
sets it to half of the space reserved to minfree.
.It Fl l
Enable multilabel MAC on the new file system.
@ -228,7 +228,7 @@ for more details on how to set this option.
The partition name (a..h) you want to use in case the underlying image
is a file, so you do not have access to individual partitions through the
filesystem.
Can also be used with a device, e.g.
Can also be used with a device, e.g.,
.Nm
.Fl p Ar f
.Ar /dev/da1s3

View File

@ -1924,7 +1924,7 @@ pfctl_test_altqsupport(int dev, int opts)
if (ioctl(dev, DIOCGETALTQS, &pa)) {
if (errno == ENODEV) {
if (!(opts & PF_OPT_QUIET))
if (opts & PF_OPT_VERBOSE)
fprintf(stderr, "No ALTQ support in kernel\n"
"ALTQ related functions disabled\n");
return (0);

View File

@ -364,6 +364,7 @@ MAN= aac.4 \
nsp.4 \
${_ntb.4} \
null.4 \
numa.4 \
${_nvd.4} \
${_nvme.4} \
${_nvram.4} \

View File

@ -23,7 +23,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd July 3, 2015
.Dd July 11, 2015
.Dt CTL 4
.Os
.Sh NAME
@ -100,11 +100,14 @@ Defaults to 1.
The number of outstanding commands to advertise to the iSCSI initiator.
Technically, it is the difference between ExpCmdSN and MaxCmdSN fields
in the iSCSI PDU.
Defaults to 256.
.It Va kern.cam.ctl.iscsi.ping_timeout
The number of seconds to wait for the iSCSI initiator to respond to a NOP-In
PDU.
In the event that there is no response within that time the session gets
forcibly terminated.
Set to 0 to disable sending NOP-In PDUs.
Defaults to 5.
.Sh SEE ALSO
.Xr ctladm 8 ,
.Xr ctld 8 ,

View File

@ -23,7 +23,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd June 20, 2015
.Dd July 11, 2015
.Dt ISCSI 4
.Os
.Sh NAME
@ -77,20 +77,25 @@ The number of seconds to wait for the target to respond to a NOP-Out
PDU.
In the event that there is no response within that time the session gets
forcibly restarted.
Set to 0 to disable sending NOP-Out PDUs.
Defaults to 5.
.It Va kern.iscsi.iscsid_timeout
The number of seconds to wait for
.Xr ctld 8
.Xr iscsid 8
to establish a session.
After that time
.Nm
will abort and retry.
Defaults to 60.
.It Va kern.iscsi.login_timeout
The number of seconds to wait for a login attempt to succeed.
After that time
.Nm
will abort and retry.
Defaults to 60.
.It Va kern.iscsi.maxtags
The maximum number of outstanding IO requests.
Defaults to 255.
.It Va kern.iscsi.fail_on_disconnection
Controls the behavior after an iSCSI connection has been dropped due to
network problems.

172
share/man/man4/numa.4 Normal file
View File

@ -0,0 +1,172 @@
.\" Copyright (c) 2015 Adrian Chadd <adrian@FreeBSD.org>
.\" 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 AUTHORS 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 AUTHORS 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.
.\"
.\" $FreeBSD$
.\"
.Dd May 10, 2015
.Dt NUMA 4
.Os
.Sh NAME
.Nm NUMA
.Nd Non-Uniform Memory Access
.Sh SYNOPSIS
.Cd options SMP
.Cd options MAXMEMDOM=16
.Pp
.In sys/numa.h
.In sys/cpuset.h
.In sys/bus.h
.Sh DESCRIPTION
Non-Uniform Memory Access is a computer architecture design which
involves unequal costs between processors, memory and IO devices
in a given system.
.Pp
In a
.Nm
architecture, the latency to access specific memory or IO devices
depends upon which processor the memory or device is attached to.
Accessing memory local to a processor is faster than accessing memory
that is connected to one of the other processors.
.Pp
.Nm
is enabled when the
.Cd MAXMEMDOM
option is used in a kernel configuration
file and is set to a value greater than 1.
.Pp
Thread and process
.Nm
policies are controlled with the
.Xr numa_setaffinity 2
and
.Xr numa_getaffinity 2
syscalls.
.Pp
The
.Xr numactl 1
tool is available for starting processes with a non-default
policy, or to change the policy of an existing thread or process.
.Pp
Systems with non-uniform access to I/O devices may mark those devices
with the local VM domain identifier.
Drivers can find out their local domain information by calling
.Xr bus_get_domain 9 .
.Ss MIB Variables
The operation of
.Nm
is controlled and exposes information with these
.Xr sysctl 8
MIB variables:
.Pp
.Bl -tag -width indent -compact
.It Va vm.ndomains
The number of VM domains which have been detected.
.Pp
.It Va vm.default_policy
The default VM domain allocation policy.
Defaults to "first-touch-rr".
The valid values are "first-touch", "first-touch-rr",
"rr", where "rr" is a short-hand for "round-robin."
See
.Xr numa_setaffinity 2
for more information about the available policies.
.Pp
.It Va vm.phys_locality
A table indicating the relative cost of each VM domain to each other.
A value of 10 indicates equal cost.
A value of -1 means the locality map is not available or no
locality information is available.
.Pp
.It Va vm.phys_segs
The map of physical memory, grouped by VM domain.
.El
.Sh IMPLEMENTATION NOTES
The current
.Nm
implementation is VM-focused.
The hardware
.Nm
domains are mapped into a contiguous, non-sparse
VM domain space, starting from 0.
Thus, VM domain information (for example, the domain identifier) is not
necessarily the same as is found in the hardware specific information.
.Pp
The
.Nm
allocation policies are implemented as a policy and iterator in
.Pa sys/vm/vm_domain.c
and
.Pa sys/vm/vm_domain.h .
Policy information is available in both struct thread and struct proc.
Processes inherit
.Nm
policy from parent processes and threads inherit
.Nm
policy from parent threads.
Note that threads do not explicitly inherit their
.Nm
policy from processes.
Instead, if no thread policy is set, the system
will fall back to the process policy.
.Pp
For now,
.Nm
domain policies only influence physical page allocation in
.Pa sys/vm/vm_phys.c .
This is useful for userland memory allocation, but not for kernel
and driver memory allocation.
These features will be implemented in future work.
.Sh SEE ALSO
.Xr numactl 1 ,
.Xr numa_getaffinity 2 ,
.Xr numa_setaffinity 2 ,
.Xr bus_get_domain 9
.Sh HISTORY
.Nm
first appeared in
.Fx 9.0
as a first-touch allocation policy with a fail-over to round-robin allocation
and was not configurable.
It was then modified in
.Fx 10.0
to implement a round-robin allocation policy and was also not configurable.
.Pp
The
.Xr numa_getaffinity 2
and
.Xr numa_setaffinity 2
syscalls first appeared in
.Fx 11.0 .
.Pp
The
.Xr numactl 1
tool first appeared in
.Fx 11.0 .
.Sh AUTHORS
This manual page written by
.An Adrian Chadd Aq Mt adrian@FreeBSD.org .
.Sh NOTES
No statistics are kept to indicate how often
.Nm
allocation policies succeed or fail.

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 3, 2015
.Dd July 19, 2015
.Dt PROTO 4
.Os
.\"
@ -47,6 +47,12 @@ module at boot time, place the following line in
.Bd -literal -offset indent
proto_load="YES"
.Ed
.Pp
To have the driver attach to a device instead of its regular driver,
mention it in the list of devices assigned to the following loader variable:
.Bd -ragged -offset indent
hw.proto.attach="desc[,desc]"
.Ed
.\"
.Sh DESCRIPTION
The

View File

@ -62,7 +62,7 @@ This sysctl will not return
random bytes unless
the
.Xr random 4
is seeded.
device is seeded.
.Pp
This initial seeding
of random number generators

View File

@ -1281,6 +1281,7 @@ MLINKS+=psignal.9 gsignal.9 \
MLINKS+=random.9 arc4rand.9 \
random.9 arc4random.9 \
random.9 read_random.9 \
random.9 read_random_uio.9 \
random.9 srandom.9
MLINKS+=refcount.9 refcount_acquire.9 \
refcount.9 refcount_init.9 \

View File

@ -17,7 +17,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 8, 2015
.Dd July 10, 2015
.Dt CRYPTO 9
.Os
.Sh NAME
@ -40,6 +40,8 @@
.Ft void
.Fn crypto_kdone "struct cryptkop *"
.Ft int
.Fn crypto_find_driver "const char *"
.Ft int
.Fn crypto_newsession "uint64_t *" "struct cryptoini *" int
.Ft int
.Fn crypto_freesession uint64_t
@ -157,15 +159,28 @@ was a fatal error in verifying the arguments).
For session initialization and teardown there is no callback mechanism used.
.Pp
The
.Fn crypto_find_driver
function may be called to return the specific id of the provided name.
If the specified driver could not be found, the returned id is -1.
.Pp
The
.Fn crypto_newsession
routine is called by consumers of cryptographic services (such as the
.Xr ipsec 4
stack) that wish to establish a new session with the framework.
On success, the first argument will contain the Session Identifier (SID).
The second argument contains all the necessary information for
the driver to establish the session.
The third argument indicates whether a
hardware driver (1) should be used or not (0).
The third argument is either a specific driver id, or one or both
of
.Dv CRYPTOCAP_F_HARDWARE ,
to select hardware devices,
or
.Dv CRYPTOCAP_F_SOFTWARE ,
to select software devices.
If both are specified, a hardware device will be returned
before a software device will be.
On success, the value pointed to by the first argument will be the
Session IDentifier (SID).
The various fields in the
.Vt cryptoini
structure are:

View File

@ -66,7 +66,7 @@
.Ft int
.Fn nvlist_error "const nvlist_t *nvl"
.Ft void
.Fn nvlist_set_error "nvlist_t *nvl, int error"
.Fn nvlist_set_error "nvlist_t *nvl" "int error"
.Ft bool
.Fn nvlist_empty "const nvlist_t *nvl"
.Ft int
@ -76,9 +76,9 @@
.Fn nvlist_clone "const nvlist_t *nvl"
.\"
.Ft void
.Fn nvlist_dump "const nvlist_t *nvl, int fd"
.Fn nvlist_dump "const nvlist_t *nvl" "int fd"
.Ft void
.Fn nvlist_fdump "const nvlist_t *nvl, FILE *fp"
.Fn nvlist_fdump "const nvlist_t *nvl" "FILE *fp"
.\"
.Ft size_t
.Fn nvlist_size "const nvlist_t *nvl"

View File

@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\" "
.Dd June 30, 2015
.Dd July 16, 2015
.Dt RANDOM 9
.Os
.Sh NAME
@ -34,6 +34,7 @@
.Nm arc4random ,
.Nm random ,
.Nm read_random ,
.Nm read_random_uio ,
.Nm srandom
.Nd supply pseudo-random numbers
.Sh SYNOPSIS
@ -50,6 +51,8 @@
.In sys/random.h
.Ft int
.Fn read_random "void *buffer" "int count"
.Ft int
.Fn read_random_uio "struct uio *uio" "bool nonblock"
.Sh DESCRIPTION
The
.Fn random
@ -117,11 +120,27 @@ necessary to know
that no entropy
has been returned.
.Pp
The
.Fn read_random_uio
function behaves identically to
.Xr read 2
on
.Pa /dev/random .
The
.Fa uio
argument points to a buffer where random data should be stored.
This function only returns data if the random device is seeded.
It blocks if unseeded,
except when the
.Fa nonblock
argument is true.
.Pp
All the bits returned by
.Fn random ,
.Fn arc4rand
.Fn arc4rand ,
.Fn read_random ,
and
.Fn read_random
.Fn read_random_uio
are usable.
For example,
.Sq Li random()&01
@ -168,6 +187,22 @@ The
function returns
the number of bytes placed in
.Fa buffer .
.Pp
.Fn read_random_uio
returns zero when successful,
otherwise an error code is returned.
.Sh ERRORS
.Fn read_random_uio
may fail if:
.Bl -tag -width Er
.It Bq Er EFAULT
.Fa uio
points to an invalid memory region.
.It Bq Er EWOULDBLOCK
The random device is unseeded and
.Fa nonblock
is true.
.El
.Sh AUTHORS
.An Dan Moschuk
wrote

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd June 30, 2015
.Dd July 13, 2015
.Dt RANDOM_HARVEST 9
.Os
.Sh NAME
@ -96,7 +96,7 @@ from harvesting,
as they are high-rate
sources.
Some entropy is sacrificed,
but the hig rate of supply
but the high rate of supply
will compensate for this.
.Pp
The
@ -121,7 +121,7 @@ and pass this in
.Fa bits .
.Pp
Interrupt harvesting has been
in part simplified simplified
in part simplified
for the kernel programmer.
If a device driver registers an interrupt handler
with

View File

@ -52,17 +52,8 @@ __FBSDID("$FreeBSD$");
#include <ddb/db_sym.h>
#include <ddb/db_variables.h>
static db_varfcn_t db_dr0;
static db_varfcn_t db_dr1;
static db_varfcn_t db_dr2;
static db_varfcn_t db_dr3;
static db_varfcn_t db_dr4;
static db_varfcn_t db_dr5;
static db_varfcn_t db_dr6;
static db_varfcn_t db_dr7;
static db_varfcn_t db_frame;
static db_varfcn_t db_rsp;
static db_varfcn_t db_ss;
static db_varfcn_t db_frame_seg;
CTASSERT(sizeof(struct dbreg) == sizeof(((struct pcpu *)NULL)->pc_dbreg));
@ -71,17 +62,17 @@ CTASSERT(sizeof(struct dbreg) == sizeof(((struct pcpu *)NULL)->pc_dbreg));
*/
#define DB_OFFSET(x) (db_expr_t *)offsetof(struct trapframe, x)
struct db_variable db_regs[] = {
{ "cs", DB_OFFSET(tf_cs), db_frame },
{ "ds", DB_OFFSET(tf_ds), db_frame },
{ "es", DB_OFFSET(tf_es), db_frame },
{ "fs", DB_OFFSET(tf_fs), db_frame },
{ "gs", DB_OFFSET(tf_gs), db_frame },
{ "ss", NULL, db_ss },
{ "cs", DB_OFFSET(tf_cs), db_frame_seg },
{ "ds", DB_OFFSET(tf_ds), db_frame_seg },
{ "es", DB_OFFSET(tf_es), db_frame_seg },
{ "fs", DB_OFFSET(tf_fs), db_frame_seg },
{ "gs", DB_OFFSET(tf_gs), db_frame_seg },
{ "ss", DB_OFFSET(tf_ss), db_frame_seg },
{ "rax", DB_OFFSET(tf_rax), db_frame },
{ "rcx", DB_OFFSET(tf_rcx), db_frame },
{ "rdx", DB_OFFSET(tf_rdx), db_frame },
{ "rbx", DB_OFFSET(tf_rbx), db_frame },
{ "rsp", NULL, db_rsp },
{ "rsp", DB_OFFSET(tf_rsp), db_frame },
{ "rbp", DB_OFFSET(tf_rbp), db_frame },
{ "rsi", DB_OFFSET(tf_rsi), db_frame },
{ "rdi", DB_OFFSET(tf_rdi), db_frame },
@ -95,46 +86,23 @@ struct db_variable db_regs[] = {
{ "r15", DB_OFFSET(tf_r15), db_frame },
{ "rip", DB_OFFSET(tf_rip), db_frame },
{ "rflags", DB_OFFSET(tf_rflags), db_frame },
#define DB_N_SHOW_REGS 24 /* Don't show registers after here. */
{ "dr0", NULL, db_dr0 },
{ "dr1", NULL, db_dr1 },
{ "dr2", NULL, db_dr2 },
{ "dr3", NULL, db_dr3 },
{ "dr4", NULL, db_dr4 },
{ "dr5", NULL, db_dr5 },
{ "dr6", NULL, db_dr6 },
{ "dr7", NULL, db_dr7 },
};
struct db_variable *db_eregs = db_regs + DB_N_SHOW_REGS;
struct db_variable *db_eregs = db_regs + nitems(db_regs);
#define DB_DRX_FUNC(reg) \
static int \
db_ ## reg (vp, valuep, op) \
struct db_variable *vp; \
db_expr_t * valuep; \
int op; \
{ \
if (op == DB_VAR_GET) \
*valuep = r ## reg (); \
else \
load_ ## reg (*valuep); \
return (1); \
}
DB_DRX_FUNC(dr0)
DB_DRX_FUNC(dr1)
DB_DRX_FUNC(dr2)
DB_DRX_FUNC(dr3)
DB_DRX_FUNC(dr4)
DB_DRX_FUNC(dr5)
DB_DRX_FUNC(dr6)
DB_DRX_FUNC(dr7)
static __inline long
get_rsp(struct trapframe *tf)
static int
db_frame_seg(struct db_variable *vp, db_expr_t *valuep, int op)
{
return ((ISPL(tf->tf_cs)) ? tf->tf_rsp :
(db_expr_t)tf + offsetof(struct trapframe, tf_rsp));
uint16_t *reg;
if (kdb_frame == NULL)
return (0);
reg = (uint16_t *)((uintptr_t)kdb_frame + (db_expr_t)vp->valuep);
if (op == DB_VAR_GET)
*valuep = *reg;
else
*reg = *valuep;
return (1);
}
static int
@ -153,34 +121,6 @@ db_frame(struct db_variable *vp, db_expr_t *valuep, int op)
return (1);
}
static int
db_rsp(struct db_variable *vp, db_expr_t *valuep, int op)
{
if (kdb_frame == NULL)
return (0);
if (op == DB_VAR_GET)
*valuep = get_rsp(kdb_frame);
else if (ISPL(kdb_frame->tf_cs))
kdb_frame->tf_rsp = *valuep;
return (1);
}
static int
db_ss(struct db_variable *vp, db_expr_t *valuep, int op)
{
if (kdb_frame == NULL)
return (0);
if (op == DB_VAR_GET)
*valuep = (ISPL(kdb_frame->tf_cs)) ? kdb_frame->tf_ss : rss();
else if (ISPL(kdb_frame->tf_cs))
kdb_frame->tf_ss = *valuep;
return (1);
}
#define NORMAL 0
#define TRAP 1
#define INTERRUPT 2
@ -188,9 +128,7 @@ db_ss(struct db_variable *vp, db_expr_t *valuep, int op)
#define TRAP_INTERRUPT 5
static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread *);
static int db_numargs(struct amd64_frame *);
static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t,
void *);
static void db_print_stack_entry(const char *, db_addr_t, void *);
static void decode_syscall(int, struct thread *);
static const char * watchtype_str(int type);
@ -198,62 +136,11 @@ int amd64_set_watch(int watchnum, unsigned long watchaddr, int size,
int access, struct dbreg *d);
int amd64_clr_watch(int watchnum, struct dbreg *d);
/*
* Figure out how many arguments were passed into the frame at "fp".
*/
static int
db_numargs(fp)
struct amd64_frame *fp;
{
#if 1
return (0); /* regparm, needs dwarf2 info */
#else
long *argp;
int inst;
int args;
argp = (long *)db_get_value((long)&fp->f_retaddr, 8, FALSE);
/*
* XXX etext is wrong for LKMs. We should attempt to interpret
* the instruction at the return address in all cases. This
* may require better fault handling.
*/
if (argp < (long *)btext || argp >= (long *)etext) {
args = 5;
} else {
inst = db_get_value((long)argp, 4, FALSE);
if ((inst & 0xff) == 0x59) /* popl %ecx */
args = 1;
else if ((inst & 0xffff) == 0xc483) /* addl $Ibs, %esp */
args = ((inst >> 16) & 0xff) / 4;
else
args = 5;
}
return (args);
#endif
}
static void
db_print_stack_entry(name, narg, argnp, argp, callpc, frame)
const char *name;
int narg;
char **argnp;
long *argp;
db_addr_t callpc;
void *frame;
db_print_stack_entry(const char *name, db_addr_t callpc, void *frame)
{
db_printf("%s(", name);
#if 0
while (narg) {
if (argnp)
db_printf("%s=", *argnp++);
db_printf("%lr", (long)db_get_value((long)argp, 8, FALSE));
argp++;
if (--narg != 0)
db_printf(",");
}
#endif
db_printf(") at ");
db_printf("%s() at ", name != NULL ? name : "??");
db_printsym(callpc, DB_STGY_PROC);
if (frame != NULL)
db_printf("/frame 0x%lx", (register_t)frame);
@ -348,7 +235,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, struct thread *td)
return;
}
db_print_stack_entry(name, 0, 0, 0, rip, &(*fp)->f_frame);
db_print_stack_entry(name, rip, &(*fp)->f_frame);
/*
* Point to base of trapframe which is just above the
@ -357,7 +244,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, struct thread *td)
tf = (struct trapframe *)((long)*fp + 16);
if (INKERNEL((long) tf)) {
rsp = get_rsp(tf);
rsp = tf->tf_rsp;
rip = tf->tf_rip;
rbp = tf->tf_rbp;
switch (frame_type) {
@ -384,17 +271,13 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, struct thread *td)
}
static int
db_backtrace(struct thread *td, struct trapframe *tf,
struct amd64_frame *frame, db_addr_t pc, int count)
db_backtrace(struct thread *td, struct trapframe *tf, struct amd64_frame *frame,
db_addr_t pc, register_t sp, int count)
{
struct amd64_frame *actframe;
#define MAXNARG 16
char *argnames[MAXNARG], **argnp = NULL;
const char *name;
long *argp;
db_expr_t offset;
c_db_sym_t sym;
int narg;
boolean_t first;
if (count == -1)
@ -418,48 +301,51 @@ db_backtrace(struct thread *td, struct trapframe *tf,
*/
actframe = frame;
if (first) {
if (tf != NULL) {
first = FALSE;
if (sym == C_DB_SYM_NULL && sp != 0) {
/*
* If a symbol couldn't be found, we've probably
* jumped to a bogus location, so try and use
* the return address to find our caller.
*/
db_print_stack_entry(name, pc, NULL);
pc = db_get_value(sp, 8, FALSE);
if (db_search_symbol(pc, DB_STGY_PROC,
&offset) == C_DB_SYM_NULL)
break;
continue;
} else if (tf != NULL) {
int instr;
instr = db_get_value(pc, 4, FALSE);
if ((instr & 0xffffffff) == 0xe5894855) {
/* pushq %rbp; movq %rsp, %rbp */
actframe = (void *)(get_rsp(tf) - 8);
actframe = (void *)(tf->tf_rsp - 8);
} else if ((instr & 0xffffff) == 0xe58948) {
/* movq %rsp, %rbp */
actframe = (void *)get_rsp(tf);
actframe = (void *)tf->tf_rsp;
if (tf->tf_rbp == 0) {
/* Fake frame better. */
frame = actframe;
}
} else if ((instr & 0xff) == 0xc3) {
/* ret */
actframe = (void *)(get_rsp(tf) - 8);
actframe = (void *)(tf->tf_rsp - 8);
} else if (offset == 0) {
/* Probably an assembler symbol. */
actframe = (void *)(get_rsp(tf) - 8);
actframe = (void *)(tf->tf_rsp - 8);
}
} else if (strcmp(name, "fork_trampoline") == 0) {
/*
* Don't try to walk back on a stack for a
* process that hasn't actually been run yet.
*/
db_print_stack_entry(name, 0, 0, 0, pc,
actframe);
db_print_stack_entry(name, pc, actframe);
break;
}
first = FALSE;
}
argp = &actframe->f_arg0;
narg = MAXNARG;
if (sym != NULL && db_sym_numargs(sym, &narg, argnames)) {
argnp = argnames;
} else {
narg = db_numargs(frame);
}
db_print_stack_entry(name, narg, argnp, argp, pc, actframe);
db_print_stack_entry(name, pc, actframe);
if (actframe != frame) {
/* `frame' belongs to caller. */
@ -473,7 +359,7 @@ db_backtrace(struct thread *td, struct trapframe *tf,
if (INKERNEL((long)pc) && !INKERNEL((long)frame)) {
sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
db_symbol_values(sym, &name, NULL);
db_print_stack_entry(name, 0, 0, 0, pc, frame);
db_print_stack_entry(name, pc, frame);
break;
}
if (!INKERNEL((long) frame)) {
@ -495,17 +381,19 @@ db_trace_self(void)
frame = (struct amd64_frame *)rbp;
callpc = (db_addr_t)db_get_value((long)&frame->f_retaddr, 8, FALSE);
frame = frame->f_frame;
db_backtrace(curthread, NULL, frame, callpc, -1);
db_backtrace(curthread, NULL, frame, callpc, 0, -1);
}
int
db_trace_thread(struct thread *thr, int count)
{
struct pcb *ctx;
struct trapframe *tf;
ctx = kdb_thr_ctx(thr);
return (db_backtrace(thr, NULL, (struct amd64_frame *)ctx->pcb_rbp,
ctx->pcb_rip, count));
tf = thr == kdb_thread ? kdb_frame : NULL;
return (db_backtrace(thr, tf, (struct amd64_frame *)ctx->pcb_rbp,
ctx->pcb_rip, ctx->pcb_rsp, count));
}
int

View File

@ -878,11 +878,26 @@ DB_SHOW_COMMAND(sysregs, db_show_sysregs)
db_printf("cr2\t0x%016lx\n", rcr2());
db_printf("cr3\t0x%016lx\n", rcr3());
db_printf("cr4\t0x%016lx\n", rcr4());
db_printf("EFER\t%016lx\n", rdmsr(MSR_EFER));
db_printf("FEATURES_CTL\t%016lx\n", rdmsr(MSR_IA32_FEATURE_CONTROL));
db_printf("DEBUG_CTL\t%016lx\n", rdmsr(MSR_DEBUGCTLMSR));
db_printf("PAT\t%016lx\n", rdmsr(MSR_PAT));
db_printf("GSBASE\t%016lx\n", rdmsr(MSR_GSBASE));
if (rcr4() & CR4_XSAVE)
db_printf("xcr0\t0x%016lx\n", rxcr(0));
db_printf("EFER\t0x%016lx\n", rdmsr(MSR_EFER));
if (cpu_feature2 & (CPUID2_VMX | CPUID2_SMX))
db_printf("FEATURES_CTL\t%016lx\n",
rdmsr(MSR_IA32_FEATURE_CONTROL));
db_printf("DEBUG_CTL\t0x%016lx\n", rdmsr(MSR_DEBUGCTLMSR));
db_printf("PAT\t0x%016lx\n", rdmsr(MSR_PAT));
db_printf("GSBASE\t0x%016lx\n", rdmsr(MSR_GSBASE));
}
DB_SHOW_COMMAND(dbregs, db_show_dbregs)
{
db_printf("dr0\t0x%016lx\n", rdr0());
db_printf("dr1\t0x%016lx\n", rdr1());
db_printf("dr2\t0x%016lx\n", rdr2());
db_printf("dr3\t0x%016lx\n", rdr3());
db_printf("dr6\t0x%016lx\n", rdr6());
db_printf("dr7\t0x%016lx\n", rdr7());
}
#endif

View File

@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
#include <vm/pmap.h>
static void
stack_capture(struct stack *st, register_t rbp)
stack_capture(struct thread *td, struct stack *st, register_t rbp)
{
struct amd64_frame *frame;
vm_offset_t callpc;
@ -56,8 +56,8 @@ stack_capture(struct stack *st, register_t rbp)
if (stack_put(st, callpc) == -1)
break;
if (frame->f_frame <= frame ||
(vm_offset_t)frame->f_frame >=
(vm_offset_t)rbp + KSTACK_PAGES * PAGE_SIZE)
(vm_offset_t)frame->f_frame >= td->td_kstack +
td->td_kstack_pages * PAGE_SIZE)
break;
frame = frame->f_frame;
}
@ -74,7 +74,7 @@ stack_save_td(struct stack *st, struct thread *td)
panic("stack_save_td: running");
rbp = td->td_pcb->pcb_rbp;
stack_capture(st, rbp);
stack_capture(td, st, rbp);
}
void
@ -83,5 +83,5 @@ stack_save(struct stack *st)
register_t rbp;
__asm __volatile("movq %%rbp,%0" : "=r" (rbp));
stack_capture(st, rbp);
stack_capture(curthread, st, rbp);
}

View File

@ -0,0 +1,264 @@
/*-
* Copyright (c) 2015 Nuxi, https://nuxi.nl/
*
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/exec.h>
#include <sys/imgact.h>
#include <sys/imgact_elf.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/proc.h>
#include <sys/smp.h>
#include <sys/sysent.h>
#include <sys/systm.h>
#include <vm/pmap.h>
#include <vm/vm.h>
#include <machine/frame.h>
#include <machine/pcb.h>
#include <machine/pmap.h>
#include <machine/psl.h>
#include <machine/vmparam.h>
#include <compat/cloudabi/cloudabi_util.h>
#include <compat/cloudabi64/cloudabi64_syscall.h>
#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
#include <compat/cloudabi64/cloudabi64_util.h>
extern const char *cloudabi64_syscallnames[];
extern struct sysent cloudabi64_sysent[];
static register_t *
cloudabi64_copyout_strings(struct image_params *imgp)
{
uintptr_t begin;
size_t len;
/* Copy out program arguments. */
len = imgp->args->begin_envv - imgp->args->begin_argv;
begin = rounddown2(USRSTACK - len, sizeof(register_t));
copyout(imgp->args->begin_argv, (void *)begin, len);
return ((register_t *)begin);
}
static int
cloudabi64_fixup(register_t **stack_base, struct image_params *imgp)
{
char canarybuf[64];
Elf64_Auxargs *args;
void *argdata, *canary;
size_t argdatalen;
int error;
/* Store canary for stack smashing protection. */
argdata = *stack_base;
arc4rand(canarybuf, sizeof(canarybuf), 0);
*stack_base -= howmany(sizeof(canarybuf), sizeof(register_t));
canary = *stack_base;
error = copyout(canarybuf, canary, sizeof(canarybuf));
if (error != 0)
return (error);
/*
* Compute length of program arguments. As the argument data is
* binary safe, we had to add a trailing null byte in
* exec_copyin_data_fds(). Undo this by reducing the length.
*/
args = (Elf64_Auxargs *)imgp->auxargs;
argdatalen = imgp->args->begin_envv - imgp->args->begin_argv;
if (argdatalen > 0)
--argdatalen;
/* Write out an auxiliary vector. */
cloudabi64_auxv_t auxv[] = {
#define VAL(type, val) { .a_type = (type), .a_val = (val) }
#define PTR(type, ptr) { .a_type = (type), .a_ptr = (uintptr_t)(ptr) }
PTR(CLOUDABI_AT_ARGDATA, argdata),
VAL(CLOUDABI_AT_ARGDATALEN, argdatalen),
PTR(CLOUDABI_AT_CANARY, canary),
VAL(CLOUDABI_AT_CANARYLEN, sizeof(canarybuf)),
VAL(CLOUDABI_AT_NCPUS, mp_ncpus),
VAL(CLOUDABI_AT_PAGESZ, args->pagesz),
PTR(CLOUDABI_AT_PHDR, args->phdr),
VAL(CLOUDABI_AT_PHNUM, args->phnum),
VAL(CLOUDABI_AT_TID, curthread->td_tid),
#undef VAL
#undef PTR
{ .a_type = CLOUDABI_AT_NULL },
};
*stack_base -= howmany(sizeof(auxv), sizeof(register_t));
return (copyout(auxv, *stack_base, sizeof(auxv)));
}
static int
cloudabi64_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
{
struct trapframe *frame = td->td_frame;
/* Obtain system call number. */
sa->code = frame->tf_rax;
if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL)
return (ENOSYS);
sa->callp = &cloudabi64_sysent[sa->code];
/* Fetch system call arguments. */
sa->args[0] = frame->tf_rdi;
sa->args[1] = frame->tf_rsi;
sa->args[2] = frame->tf_rdx;
sa->args[3] = frame->tf_rcx; /* Actually %r10. */
sa->args[4] = frame->tf_r8;
sa->args[5] = frame->tf_r9;
/* Default system call return values. */
td->td_retval[0] = 0;
td->td_retval[1] = frame->tf_rdx;
return (0);
}
static void
cloudabi64_set_syscall_retval(struct thread *td, int error)
{
struct trapframe *frame = td->td_frame;
switch (error) {
case 0:
/* System call succeeded. */
frame->tf_rax = td->td_retval[0];
frame->tf_rdx = td->td_retval[1];
frame->tf_rflags &= ~PSL_C;
break;
case ERESTART:
/* Restart system call. */
frame->tf_rip -= frame->tf_err;
frame->tf_r10 = frame->tf_rcx;
set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
break;
case EJUSTRETURN:
break;
default:
/* System call returned an error. */
frame->tf_rax = cloudabi_convert_errno(error);
frame->tf_rflags |= PSL_C;
break;
}
}
static void
cloudabi64_schedtail(struct thread *td)
{
struct trapframe *frame = td->td_frame;
/* Initial register values for processes returning from fork. */
frame->tf_rax = CLOUDABI_PROCESS_CHILD;
frame->tf_rdx = td->td_tid;
}
void
cloudabi64_thread_setregs(struct thread *td,
const cloudabi64_threadattr_t *attr)
{
struct trapframe *frame;
stack_t stack;
/* Perform standard register initialization. */
stack.ss_sp = (void *)attr->stack;
stack.ss_size = attr->stack_size;
cpu_set_upcall_kse(td, (void *)attr->entry_point, NULL, &stack);
/*
* Pass in the thread ID of the new thread and the argument
* pointer provided by the parent thread in as arguments to the
* entry point.
*/
frame = td->td_frame;
frame->tf_rdi = td->td_tid;
frame->tf_rsi = attr->argument;
}
static struct sysentvec cloudabi64_elf_sysvec = {
.sv_size = CLOUDABI64_SYS_MAXSYSCALL,
.sv_table = cloudabi64_sysent,
.sv_fixup = cloudabi64_fixup,
.sv_name = "CloudABI ELF64",
.sv_coredump = elf64_coredump,
.sv_pagesize = PAGE_SIZE,
.sv_minuser = VM_MIN_ADDRESS,
.sv_maxuser = VM_MAXUSER_ADDRESS,
.sv_usrstack = USRSTACK,
.sv_stackprot = VM_PROT_READ | VM_PROT_WRITE,
.sv_copyout_strings = cloudabi64_copyout_strings,
.sv_flags = SV_ABI_CLOUDABI,
.sv_set_syscall_retval = cloudabi64_set_syscall_retval,
.sv_fetch_syscall_args = cloudabi64_fetch_syscall_args,
.sv_syscallnames = cloudabi64_syscallnames,
.sv_schedtail = cloudabi64_schedtail,
};
INIT_SYSENTVEC(elf_sysvec, &cloudabi64_elf_sysvec);
static Elf64_Brandinfo cloudabi64_brand = {
.brand = ELFOSABI_CLOUDABI,
.machine = EM_X86_64,
.sysvec = &cloudabi64_elf_sysvec,
.compat_3_brand = "CloudABI",
};
static int
cloudabi64_modevent(module_t mod, int type, void *data)
{
switch (type) {
case MOD_LOAD:
if (elf64_insert_brand_entry(&cloudabi64_brand) < 0) {
printf("Failed to add CloudABI ELF brand handler\n");
return (EINVAL);
}
return (0);
case MOD_UNLOAD:
if (elf64_brand_inuse(&cloudabi64_brand))
return (EBUSY);
if (elf64_remove_brand_entry(&cloudabi64_brand) < 0) {
printf("Failed to remove CloudABI ELF brand handler\n");
return (EINVAL);
}
return (0);
default:
return (EOPNOTSUPP);
}
}
static moduledata_t cloudabi64_module = {
"cloudabi64",
cloudabi64_modevent,
NULL
};
DECLARE_MODULE_TIED(cloudabi64, cloudabi64_module, SI_SUB_EXEC, SI_ORDER_ANY);
MODULE_DEPEND(cloudabi64, cloudabi, 1, 1, 1);

View File

@ -170,6 +170,7 @@ device ida # Compaq Smart RAID
device mfi # LSI MegaRAID SAS
device mlx # Mylex DAC960 family
device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s
device pmspcv # PMC-Sierra SAS/SATA Controller driver
#XXX pointer/int warnings
#device pst # Promise Supertrak SX6000
device twe # 3ware ATA RAID
@ -364,5 +365,5 @@ device vmx # VMware VMXNET3 Ethernet
# Netmap provides direct access to TX/RX rings on supported NICs
device netmap # netmap(4) support
# The cypto framework is required by IPSEC
# The crypto framework is required by IPSEC
device crypto # Required by IPSEC

View File

@ -22,7 +22,6 @@ options KDTRACE_HOOKS
#device dtrace
# DTrace modules
#device dtrace_lockstat
#device dtrace_profile
#device dtrace_sdt
#device dtrace_fbt
@ -485,6 +484,10 @@ options ISCI_LOGGING # enable debugging in isci HAL
device nvme # base NVMe driver
device nvd # expose NVMe namespaces as disks, depends on nvme
#
# PMC-Sierra SAS/SATA controller
device pmspcv
#
# SafeNet crypto driver: can be moved to the MI NOTES as soon as
# it's tested on a big-endian machine
@ -617,6 +620,9 @@ options COMPAT_FREEBSD32
# Emulate spx device for client side of SVR3 local X interface
#XXX#options SPX_HACK
# Enable 64-bit runtime support for CloudABI binaries.
options COMPAT_CLOUDABI64
# Enable Linux ABI emulation
#XXX#options COMPAT_LINUX

View File

@ -82,18 +82,16 @@ struct a10_gpio_softc {
bus_space_tag_t sc_bst;
bus_space_handle_t sc_bsh;
void * sc_intrhand;
int sc_gpio_npins;
struct gpio_pin sc_gpio_pins[A10_GPIO_PINS];
};
#define A10_GPIO_LOCK(_sc) mtx_lock(&_sc->sc_mtx)
#define A10_GPIO_UNLOCK(_sc) mtx_unlock(&_sc->sc_mtx)
#define A10_GPIO_LOCK_ASSERT(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED)
#define A10_GPIO_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx)
#define A10_GPIO_UNLOCK(_sc) mtx_unlock_spin(&(_sc)->sc_mtx)
#define A10_GPIO_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
#define A10_GPIO_GP_CFG(_bank, _pin) 0x00 + ((_bank) * 0x24) + ((_pin)<<2)
#define A10_GPIO_GP_CFG(_bank, _idx) 0x00 + ((_bank) * 0x24) + ((_idx) << 2)
#define A10_GPIO_GP_DAT(_bank) 0x10 + ((_bank) * 0x24)
#define A10_GPIO_GP_DRV(_bank, _pin) 0x14 + ((_bank) * 0x24) + ((_pin)<<2)
#define A10_GPIO_GP_PUL(_bank, _pin) 0x1c + ((_bank) * 0x24) + ((_pin)<<2)
#define A10_GPIO_GP_DRV(_bank, _idx) 0x14 + ((_bank) * 0x24) + ((_idx) << 2)
#define A10_GPIO_GP_PUL(_bank, _idx) 0x1c + ((_bank) * 0x24) + ((_idx) << 2)
#define A10_GPIO_GP_INT_CFG0 0x200
#define A10_GPIO_GP_INT_CFG1 0x204
@ -116,106 +114,106 @@ a10_gpio_get_function(struct a10_gpio_softc *sc, uint32_t pin)
{
uint32_t bank, func, offset;
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
bank = pin / 32;
pin = pin - 32 * bank;
func = pin >> 3;
pin = pin % 32;
offset = ((pin & 0x07) << 2);
A10_GPIO_LOCK(sc);
func = (A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, func)) >> offset) & 7;
A10_GPIO_UNLOCK(sc);
return (func);
}
static uint32_t
a10_gpio_func_flag(uint32_t nfunc)
{
switch (nfunc) {
func = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, pin >> 3));
switch ((func >> offset) & 0x7) {
case A10_GPIO_INPUT:
return (GPIO_PIN_INPUT);
case A10_GPIO_OUTPUT:
return (GPIO_PIN_OUTPUT);
}
return (0);
}
static void
a10_gpio_set_function(struct a10_gpio_softc *sc, uint32_t pin, uint32_t f)
{
uint32_t bank, func, data, offset;
uint32_t bank, data, offset;
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
bank = pin / 32;
pin = pin - 32 * bank;
func = pin >> 3;
pin = pin % 32;
offset = ((pin & 0x07) << 2);
data = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, func));
data = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, pin >> 3));
data &= ~(7 << offset);
data |= (f << offset);
A10_GPIO_WRITE(sc, A10_GPIO_GP_CFG(bank, func), data);
A10_GPIO_WRITE(sc, A10_GPIO_GP_CFG(bank, pin >> 3), data);
}
static uint32_t
a10_gpio_get_pud(struct a10_gpio_softc *sc, uint32_t pin)
{
uint32_t bank, offset, val;
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
bank = pin / 32;
pin = pin % 32;
offset = ((pin & 0x0f) << 1);
val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pin >> 4));
switch ((val >> offset) & 0x3) {
case A10_GPIO_PULLDOWN:
return (GPIO_PIN_PULLDOWN);
case A10_GPIO_PULLUP:
return (GPIO_PIN_PULLUP);
}
return (0);
}
static void
a10_gpio_set_pud(struct a10_gpio_softc *sc, uint32_t pin, uint32_t state)
{
uint32_t bank, offset, pull, val;
uint32_t bank, offset, val;
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
bank = pin / 32;
pin = pin - 32 * bank;
pull = pin >> 4;
pin = pin % 32;
offset = ((pin & 0x0f) << 1);
val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pull));
val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pin >> 4));
val &= ~(0x03 << offset);
val |= (state << offset);
A10_GPIO_WRITE(sc, A10_GPIO_GP_PUL(bank, pull), val);
A10_GPIO_WRITE(sc, A10_GPIO_GP_PUL(bank, pin >> 4), val);
}
static void
a10_gpio_pin_configure(struct a10_gpio_softc *sc, struct gpio_pin *pin,
unsigned int flags)
a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint32_t pin, uint32_t flags)
{
A10_GPIO_LOCK(sc);
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
/*
* Manage input/output.
*/
if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) {
pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT);
if (flags & GPIO_PIN_OUTPUT) {
pin->gp_flags |= GPIO_PIN_OUTPUT;
a10_gpio_set_function(sc, pin->gp_pin,
A10_GPIO_OUTPUT);
} else {
pin->gp_flags |= GPIO_PIN_INPUT;
a10_gpio_set_function(sc, pin->gp_pin,
A10_GPIO_INPUT);
}
/* Manage input/output. */
if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) {
if (flags & GPIO_PIN_OUTPUT)
a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT);
else
a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
}
/* Manage Pull-up/pull-down. */
pin->gp_flags &= ~(GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN);
if (flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) {
if (flags & GPIO_PIN_PULLUP) {
pin->gp_flags |= GPIO_PIN_PULLUP;
a10_gpio_set_pud(sc, pin->gp_pin, A10_GPIO_PULLUP);
} else {
pin->gp_flags |= GPIO_PIN_PULLDOWN;
a10_gpio_set_pud(sc, pin->gp_pin, A10_GPIO_PULLDOWN);
}
if (flags & (GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)) {
if (flags & GPIO_PIN_PULLUP)
a10_gpio_set_pud(sc, pin, A10_GPIO_PULLUP);
else
a10_gpio_set_pud(sc, pin, A10_GPIO_PULLDOWN);
} else
a10_gpio_set_pud(sc, pin->gp_pin, A10_GPIO_NONE);
A10_GPIO_UNLOCK(sc);
a10_gpio_set_pud(sc, pin, A10_GPIO_NONE);
}
static device_t
@ -239,20 +237,11 @@ a10_gpio_pin_max(device_t dev, int *maxpin)
static int
a10_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
{
struct a10_gpio_softc *sc = device_get_softc(dev);
int i;
for (i = 0; i < sc->sc_gpio_npins; i++) {
if (sc->sc_gpio_pins[i].gp_pin == pin)
break;
}
if (i >= sc->sc_gpio_npins)
if (pin >= A10_GPIO_PINS)
return (EINVAL);
A10_GPIO_LOCK(sc);
*caps = sc->sc_gpio_pins[i].gp_caps;
A10_GPIO_UNLOCK(sc);
*caps = A10_GPIO_DEFAULT_CAPS;
return (0);
}
@ -260,19 +249,15 @@ a10_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
static int
a10_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
{
struct a10_gpio_softc *sc = device_get_softc(dev);
int i;
struct a10_gpio_softc *sc;
for (i = 0; i < sc->sc_gpio_npins; i++) {
if (sc->sc_gpio_pins[i].gp_pin == pin)
break;
}
if (i >= sc->sc_gpio_npins)
if (pin >= A10_GPIO_PINS)
return (EINVAL);
sc = device_get_softc(dev);
A10_GPIO_LOCK(sc);
*flags = sc->sc_gpio_pins[i].gp_flags;
*flags = a10_gpio_get_function(sc, pin);
*flags |= a10_gpio_get_pud(sc, pin);
A10_GPIO_UNLOCK(sc);
return (0);
@ -281,20 +266,15 @@ a10_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
static int
a10_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
{
struct a10_gpio_softc *sc = device_get_softc(dev);
int i;
uint32_t bank;
for (i = 0; i < sc->sc_gpio_npins; i++) {
if (sc->sc_gpio_pins[i].gp_pin == pin)
break;
}
if (i >= sc->sc_gpio_npins)
if (pin >= A10_GPIO_PINS)
return (EINVAL);
A10_GPIO_LOCK(sc);
memcpy(name, sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME);
A10_GPIO_UNLOCK(sc);
bank = pin / 32;
snprintf(name, GPIOMAXNAME - 1, "pin %d (P%c%d)",
pin, bank + 'A', pin % 32);
name[GPIOMAXNAME - 1] = '\0';
return (0);
}
@ -302,18 +282,15 @@ a10_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
static int
a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
{
struct a10_gpio_softc *sc = device_get_softc(dev);
int i;
struct a10_gpio_softc *sc;
for (i = 0; i < sc->sc_gpio_npins; i++) {
if (sc->sc_gpio_pins[i].gp_pin == pin)
break;
}
if (i >= sc->sc_gpio_npins)
if (pin >= A10_GPIO_PINS)
return (EINVAL);
a10_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags);
sc = device_get_softc(dev);
A10_GPIO_LOCK(sc);
a10_gpio_pin_configure(sc, pin, flags);
A10_GPIO_UNLOCK(sc);
return (0);
}
@ -321,28 +298,22 @@ a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
static int
a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
{
struct a10_gpio_softc *sc = device_get_softc(dev);
uint32_t bank, offset, data;
int i;
struct a10_gpio_softc *sc;
uint32_t bank, data;
for (i = 0; i < sc->sc_gpio_npins; i++) {
if (sc->sc_gpio_pins[i].gp_pin == pin)
break;
}
if (i >= sc->sc_gpio_npins)
if (pin >= A10_GPIO_PINS)
return (EINVAL);
bank = pin / 32;
pin = pin - 32 * bank;
offset = pin & 0x1f;
pin = pin % 32;
sc = device_get_softc(dev);
A10_GPIO_LOCK(sc);
data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank));
if (value)
data |= (1 << offset);
data |= (1 << pin);
else
data &= ~(1 << offset);
data &= ~(1 << pin);
A10_GPIO_WRITE(sc, A10_GPIO_GP_DAT(bank), data);
A10_GPIO_UNLOCK(sc);
@ -352,26 +323,20 @@ a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
static int
a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val)
{
struct a10_gpio_softc *sc = device_get_softc(dev);
uint32_t bank, offset, reg_data;
int i;
struct a10_gpio_softc *sc;
uint32_t bank, reg_data;
for (i = 0; i < sc->sc_gpio_npins; i++) {
if (sc->sc_gpio_pins[i].gp_pin == pin)
break;
}
if (i >= sc->sc_gpio_npins)
if (pin >= A10_GPIO_PINS)
return (EINVAL);
bank = pin / 32;
pin = pin - 32 * bank;
offset = pin & 0x1f;
pin = pin % 32;
sc = device_get_softc(dev);
A10_GPIO_LOCK(sc);
reg_data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank));
A10_GPIO_UNLOCK(sc);
*val = (reg_data & (1 << offset)) ? 1 : 0;
*val = (reg_data & (1 << pin)) ? 1 : 0;
return (0);
}
@ -379,28 +344,22 @@ a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val)
static int
a10_gpio_pin_toggle(device_t dev, uint32_t pin)
{
struct a10_gpio_softc *sc = device_get_softc(dev);
uint32_t bank, data, offset;
int i;
struct a10_gpio_softc *sc;
uint32_t bank, data;
for (i = 0; i < sc->sc_gpio_npins; i++) {
if (sc->sc_gpio_pins[i].gp_pin == pin)
break;
}
if (i >= sc->sc_gpio_npins)
if (pin >= A10_GPIO_PINS)
return (EINVAL);
bank = pin / 32;
pin = pin - 32 * bank;
offset = pin & 0x1f;
pin = pin % 32;
sc = device_get_softc(dev);
A10_GPIO_LOCK(sc);
data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank));
if (data & (1 << offset))
data &= ~(1 << offset);
if (data & (1 << pin))
data &= ~(1 << pin);
else
data |= (1 << offset);
data |= (1 << pin);
A10_GPIO_WRITE(sc, A10_GPIO_GP_DAT(bank), data);
A10_GPIO_UNLOCK(sc);
@ -424,14 +383,14 @@ a10_gpio_probe(device_t dev)
static int
a10_gpio_attach(device_t dev)
{
struct a10_gpio_softc *sc = device_get_softc(dev);
uint32_t func;
int i, rid;
int rid;
phandle_t gpio;
struct a10_gpio_softc *sc;
sc = device_get_softc(dev);
sc->sc_dev = dev;
mtx_init(&sc->sc_mtx, "a10 gpio", "gpio", MTX_DEF);
mtx_init(&sc->sc_mtx, "a10 gpio", "gpio", MTX_SPIN);
rid = 0;
sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
@ -454,21 +413,10 @@ a10_gpio_attach(device_t dev)
/* Find our node. */
gpio = ofw_bus_get_node(sc->sc_dev);
if (!OF_hasprop(gpio, "gpio-controller"))
/* Node is not a GPIO controller. */
goto fail;
/* Initialize the software controlled pins. */
for (i = 0; i < A10_GPIO_PINS; i++) {
snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME,
"pin %d", i);
func = a10_gpio_get_function(sc, i);
sc->sc_gpio_pins[i].gp_pin = i;
sc->sc_gpio_pins[i].gp_caps = A10_GPIO_DEFAULT_CAPS;
sc->sc_gpio_pins[i].gp_flags = a10_gpio_func_flag(func);
}
sc->sc_gpio_npins = i;
a10_gpio_sc = sc;
sc->sc_busdev = gpiobus_attach_bus(dev);
if (sc->sc_busdev == NULL)
@ -493,6 +441,14 @@ a10_gpio_detach(device_t dev)
return (EBUSY);
}
static phandle_t
a10_gpio_get_node(device_t dev, device_t bus)
{
/* We only have one child, the GPIO bus, which needs our own node. */
return (ofw_bus_get_node(dev));
}
static device_method_t a10_gpio_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, a10_gpio_probe),
@ -510,6 +466,9 @@ static device_method_t a10_gpio_methods[] = {
DEVMETHOD(gpio_pin_set, a10_gpio_pin_set),
DEVMETHOD(gpio_pin_toggle, a10_gpio_pin_toggle),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_node, a10_gpio_get_node),
DEVMETHOD_END
};

View File

@ -44,6 +44,7 @@
#include "opt_compat.h"
#include "opt_ddb.h"
#include "opt_kstack_pages.h"
#include "opt_platform.h"
#include "opt_sched.h"
#include "opt_timer.h"

View File

@ -542,8 +542,8 @@ abort_handler(struct trapframe *tf, int prefetch)
return;
}
ksig.sig = (rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV;
ksig.code = 0;
ksig.sig = SIGSEGV;
ksig.code = (rv == KERN_PROTECTION_FAILURE) ? SEGV_ACCERR : SEGV_MAPERR;
ksig.addr = far;
do_trapsignal:

View File

@ -43,6 +43,7 @@
* Created : 17/09/94
*/
#include "opt_kstack_pages.h"
#include "opt_platform.h"
#include <sys/cdefs.h>

View File

@ -38,6 +38,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_kstack_pages.h"
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>

View File

@ -32,7 +32,7 @@ makeoptions MODULES_EXTRA="dtb/am335x"
options KDTRACE_HOOKS # Kernel DTrace hooks
options DDB_CTF # all architectures - kernel ELF linker loads CTF data
makeoptions WITH_CTF=1
makeoptions MODULES_EXTRA+="opensolaris dtrace dtrace/lockstat dtrace/profile dtrace/fbt"
makeoptions MODULES_EXTRA+="opensolaris dtrace dtrace/profile dtrace/fbt"
options HZ=100
options SCHED_4BSD # 4BSD scheduler

View File

@ -98,7 +98,6 @@ options KDTRACE_HOOKS
#device dtrace
# DTrace modules
#device dtrace_lockstat
#device dtrace_profile
#device dtrace_sdt
#device dtrace_fbt

View File

@ -32,6 +32,7 @@ options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed.
options KBD_INSTALL_CDEV # install a CDEV entry in /dev
options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8)
options VFP # Enable floating point hardware support

442
sys/arm/include/atomic-v4.h Normal file
View File

@ -0,0 +1,442 @@
/* $NetBSD: atomic.h,v 1.1 2002/10/19 12:22:34 bsh Exp $ */
/*-
* Copyright (C) 2003-2004 Olivier Houchard
* Copyright (C) 1994-1997 Mark Brinicombe
* Copyright (C) 1994 Brini
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of Brini may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI 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.
*
* $FreeBSD$
*/
#ifndef _MACHINE_ATOMIC_V4_H_
#define _MACHINE_ATOMIC_V4_H_
#ifndef _MACHINE_ATOMIC_H_
#error Do not include this file directly, use <machine/atomic.h>
#endif
#if __ARM_ARCH <= 5
#define isb() __asm __volatile("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory")
#define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory")
#define dmb() dsb()
#else
#error Only use this file with ARMv5 and earlier
#endif
#define mb() dmb()
#define wmb() dmb()
#define rmb() dmb()
#define __with_interrupts_disabled(expr) \
do { \
u_int cpsr_save, tmp; \
\
__asm __volatile( \
"mrs %0, cpsr;" \
"orr %1, %0, %2;" \
"msr cpsr_fsxc, %1;" \
: "=r" (cpsr_save), "=r" (tmp) \
: "I" (PSR_I | PSR_F) \
: "cc" ); \
(expr); \
__asm __volatile( \
"msr cpsr_fsxc, %0" \
: /* no output */ \
: "r" (cpsr_save) \
: "cc" ); \
} while(0)
static __inline uint32_t
__swp(uint32_t val, volatile uint32_t *ptr)
{
__asm __volatile("swp %0, %2, [%3]"
: "=&r" (val), "=m" (*ptr)
: "r" (val), "r" (ptr), "m" (*ptr)
: "memory");
return (val);
}
#ifdef _KERNEL
#define ARM_HAVE_ATOMIC64
static __inline void
atomic_add_32(volatile u_int32_t *p, u_int32_t val)
{
__with_interrupts_disabled(*p += val);
}
static __inline void
atomic_add_64(volatile u_int64_t *p, u_int64_t val)
{
__with_interrupts_disabled(*p += val);
}
static __inline void
atomic_clear_32(volatile uint32_t *address, uint32_t clearmask)
{
__with_interrupts_disabled(*address &= ~clearmask);
}
static __inline void
atomic_clear_64(volatile uint64_t *address, uint64_t clearmask)
{
__with_interrupts_disabled(*address &= ~clearmask);
}
static __inline u_int32_t
atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval)
{
int ret;
__with_interrupts_disabled(
{
if (*p == cmpval) {
*p = newval;
ret = 1;
} else {
ret = 0;
}
});
return (ret);
}
static __inline u_int64_t
atomic_cmpset_64(volatile u_int64_t *p, volatile u_int64_t cmpval, volatile u_int64_t newval)
{
int ret;
__with_interrupts_disabled(
{
if (*p == cmpval) {
*p = newval;
ret = 1;
} else {
ret = 0;
}
});
return (ret);
}
static __inline uint32_t
atomic_fetchadd_32(volatile uint32_t *p, uint32_t v)
{
uint32_t value;
__with_interrupts_disabled(
{
value = *p;
*p += v;
});
return (value);
}
static __inline uint64_t
atomic_fetchadd_64(volatile uint64_t *p, uint64_t v)
{
uint64_t value;
__with_interrupts_disabled(
{
value = *p;
*p += v;
});
return (value);
}
static __inline uint64_t
atomic_load_64(volatile uint64_t *p)
{
uint64_t value;
__with_interrupts_disabled(value = *p);
return (value);
}
static __inline void
atomic_set_32(volatile uint32_t *address, uint32_t setmask)
{
__with_interrupts_disabled(*address |= setmask);
}
static __inline void
atomic_set_64(volatile uint64_t *address, uint64_t setmask)
{
__with_interrupts_disabled(*address |= setmask);
}
static __inline void
atomic_store_64(volatile uint64_t *p, uint64_t value)
{
__with_interrupts_disabled(*p = value);
}
static __inline void
atomic_subtract_32(volatile u_int32_t *p, u_int32_t val)
{
__with_interrupts_disabled(*p -= val);
}
static __inline void
atomic_subtract_64(volatile u_int64_t *p, u_int64_t val)
{
__with_interrupts_disabled(*p -= val);
}
#else /* !_KERNEL */
static __inline void
atomic_add_32(volatile u_int32_t *p, u_int32_t val)
{
int start, ras_start = ARM_RAS_START;
__asm __volatile("1:\n"
"adr %1, 1b\n"
"str %1, [%0]\n"
"adr %1, 2f\n"
"str %1, [%0, #4]\n"
"ldr %1, [%2]\n"
"add %1, %1, %3\n"
"str %1, [%2]\n"
"2:\n"
"mov %1, #0\n"
"str %1, [%0]\n"
"mov %1, #0xffffffff\n"
"str %1, [%0, #4]\n"
: "+r" (ras_start), "=r" (start), "+r" (p), "+r" (val)
: : "memory");
}
static __inline void
atomic_clear_32(volatile uint32_t *address, uint32_t clearmask)
{
int start, ras_start = ARM_RAS_START;
__asm __volatile("1:\n"
"adr %1, 1b\n"
"str %1, [%0]\n"
"adr %1, 2f\n"
"str %1, [%0, #4]\n"
"ldr %1, [%2]\n"
"bic %1, %1, %3\n"
"str %1, [%2]\n"
"2:\n"
"mov %1, #0\n"
"str %1, [%0]\n"
"mov %1, #0xffffffff\n"
"str %1, [%0, #4]\n"
: "+r" (ras_start), "=r" (start), "+r" (address), "+r" (clearmask)
: : "memory");
}
static __inline u_int32_t
atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval)
{
register int done, ras_start = ARM_RAS_START;
__asm __volatile("1:\n"
"adr %1, 1b\n"
"str %1, [%0]\n"
"adr %1, 2f\n"
"str %1, [%0, #4]\n"
"ldr %1, [%2]\n"
"cmp %1, %3\n"
"streq %4, [%2]\n"
"2:\n"
"mov %1, #0\n"
"str %1, [%0]\n"
"mov %1, #0xffffffff\n"
"str %1, [%0, #4]\n"
"moveq %1, #1\n"
"movne %1, #0\n"
: "+r" (ras_start), "=r" (done)
,"+r" (p), "+r" (cmpval), "+r" (newval) : : "cc", "memory");
return (done);
}
static __inline uint32_t
atomic_fetchadd_32(volatile uint32_t *p, uint32_t v)
{
uint32_t start, tmp, ras_start = ARM_RAS_START;
__asm __volatile("1:\n"
"adr %1, 1b\n"
"str %1, [%0]\n"
"adr %1, 2f\n"
"str %1, [%0, #4]\n"
"ldr %1, [%3]\n"
"mov %2, %1\n"
"add %2, %2, %4\n"
"str %2, [%3]\n"
"2:\n"
"mov %2, #0\n"
"str %2, [%0]\n"
"mov %2, #0xffffffff\n"
"str %2, [%0, #4]\n"
: "+r" (ras_start), "=r" (start), "=r" (tmp), "+r" (p), "+r" (v)
: : "memory");
return (start);
}
static __inline void
atomic_set_32(volatile uint32_t *address, uint32_t setmask)
{
int start, ras_start = ARM_RAS_START;
__asm __volatile("1:\n"
"adr %1, 1b\n"
"str %1, [%0]\n"
"adr %1, 2f\n"
"str %1, [%0, #4]\n"
"ldr %1, [%2]\n"
"orr %1, %1, %3\n"
"str %1, [%2]\n"
"2:\n"
"mov %1, #0\n"
"str %1, [%0]\n"
"mov %1, #0xffffffff\n"
"str %1, [%0, #4]\n"
: "+r" (ras_start), "=r" (start), "+r" (address), "+r" (setmask)
: : "memory");
}
static __inline void
atomic_subtract_32(volatile u_int32_t *p, u_int32_t val)
{
int start, ras_start = ARM_RAS_START;
__asm __volatile("1:\n"
"adr %1, 1b\n"
"str %1, [%0]\n"
"adr %1, 2f\n"
"str %1, [%0, #4]\n"
"ldr %1, [%2]\n"
"sub %1, %1, %3\n"
"str %1, [%2]\n"
"2:\n"
"mov %1, #0\n"
"str %1, [%0]\n"
"mov %1, #0xffffffff\n"
"str %1, [%0, #4]\n"
: "+r" (ras_start), "=r" (start), "+r" (p), "+r" (val)
: : "memory");
}
#endif /* _KERNEL */
static __inline uint32_t
atomic_readandclear_32(volatile u_int32_t *p)
{
return (__swp(0, p));
}
#define atomic_cmpset_rel_32 atomic_cmpset_32
#define atomic_cmpset_acq_32 atomic_cmpset_32
#define atomic_set_rel_32 atomic_set_32
#define atomic_set_acq_32 atomic_set_32
#define atomic_clear_rel_32 atomic_clear_32
#define atomic_clear_acq_32 atomic_clear_32
#define atomic_add_rel_32 atomic_add_32
#define atomic_add_acq_32 atomic_add_32
#define atomic_subtract_rel_32 atomic_subtract_32
#define atomic_subtract_acq_32 atomic_subtract_32
#define atomic_store_rel_32 atomic_store_32
#define atomic_store_rel_long atomic_store_long
#define atomic_load_acq_32 atomic_load_32
#define atomic_load_acq_long atomic_load_long
#define atomic_add_acq_long atomic_add_long
#define atomic_add_rel_long atomic_add_long
#define atomic_subtract_acq_long atomic_subtract_long
#define atomic_subtract_rel_long atomic_subtract_long
#define atomic_clear_acq_long atomic_clear_long
#define atomic_clear_rel_long atomic_clear_long
#define atomic_set_acq_long atomic_set_long
#define atomic_set_rel_long atomic_set_long
#define atomic_cmpset_acq_long atomic_cmpset_long
#define atomic_cmpset_rel_long atomic_cmpset_long
#define atomic_load_acq_long atomic_load_long
#undef __with_interrupts_disabled
static __inline void
atomic_add_long(volatile u_long *p, u_long v)
{
atomic_add_32((volatile uint32_t *)p, v);
}
static __inline void
atomic_clear_long(volatile u_long *p, u_long v)
{
atomic_clear_32((volatile uint32_t *)p, v);
}
static __inline int
atomic_cmpset_long(volatile u_long *dst, u_long old, u_long newe)
{
return (atomic_cmpset_32((volatile uint32_t *)dst, old, newe));
}
static __inline u_long
atomic_fetchadd_long(volatile u_long *p, u_long v)
{
return (atomic_fetchadd_32((volatile uint32_t *)p, v));
}
static __inline void
atomic_readandclear_long(volatile u_long *p)
{
atomic_readandclear_32((volatile uint32_t *)p);
}
static __inline void
atomic_set_long(volatile u_long *p, u_long v)
{
atomic_set_32((volatile uint32_t *)p, v);
}
static __inline void
atomic_subtract_long(volatile u_long *p, u_long v)
{
atomic_subtract_32((volatile uint32_t *)p, v);
}
#endif /* _MACHINE_ATOMIC_H_ */

599
sys/arm/include/atomic-v6.h Normal file
View File

@ -0,0 +1,599 @@
/* $NetBSD: atomic.h,v 1.1 2002/10/19 12:22:34 bsh Exp $ */
/*-
* Copyright (C) 2003-2004 Olivier Houchard
* Copyright (C) 1994-1997 Mark Brinicombe
* Copyright (C) 1994 Brini
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of Brini may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI 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.
*
* $FreeBSD$
*/
#ifndef _MACHINE_ATOMIC_V6_H_
#define _MACHINE_ATOMIC_V6_H_
#ifndef _MACHINE_ATOMIC_H_
#error Do not include this file directly, use <machine/atomic.h>
#endif
#if __ARM_ARCH >= 7
#define isb() __asm __volatile("isb" : : : "memory")
#define dsb() __asm __volatile("dsb" : : : "memory")
#define dmb() __asm __volatile("dmb" : : : "memory")
#elif __ARM_ARCH >= 6
#define isb() __asm __volatile("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory")
#define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory")
#define dmb() __asm __volatile("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory")
#else
#error Only use this file with ARMv6 and later
#endif
#define mb() dmb()
#define wmb() dmb()
#define rmb() dmb()
#define ARM_HAVE_ATOMIC64
#define ATOMIC_ACQ_REL_LONG(NAME) \
static __inline void \
atomic_##NAME##_acq_long(__volatile u_long *p, u_long v) \
{ \
atomic_##NAME##_long(p, v); \
dmb(); \
} \
\
static __inline void \
atomic_##NAME##_rel_long(__volatile u_long *p, u_long v) \
{ \
dmb(); \
atomic_##NAME##_long(p, v); \
}
#define ATOMIC_ACQ_REL(NAME, WIDTH) \
static __inline void \
atomic_##NAME##_acq_##WIDTH(__volatile uint##WIDTH##_t *p, uint##WIDTH##_t v)\
{ \
atomic_##NAME##_##WIDTH(p, v); \
dmb(); \
} \
\
static __inline void \
atomic_##NAME##_rel_##WIDTH(__volatile uint##WIDTH##_t *p, uint##WIDTH##_t v)\
{ \
dmb(); \
atomic_##NAME##_##WIDTH(p, v); \
}
static __inline void
atomic_add_32(volatile uint32_t *p, uint32_t val)
{
uint32_t tmp = 0, tmp2 = 0;
__asm __volatile(
"1: ldrex %0, [%2] \n"
" add %0, %0, %3 \n"
" strex %1, %0, [%2] \n"
" cmp %1, #0 \n"
" it ne \n"
" bne 1b \n"
: "=&r" (tmp), "+r" (tmp2)
,"+r" (p), "+r" (val) : : "cc", "memory");
}
static __inline void
atomic_add_64(volatile uint64_t *p, uint64_t val)
{
uint64_t tmp;
uint32_t exflag;
__asm __volatile(
"1: \n"
" ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n"
" adds %Q[tmp], %Q[val] \n"
" adc %R[tmp], %R[tmp], %R[val] \n"
" strexd %[exf], %Q[tmp], %R[tmp], [%[ptr]] \n"
" teq %[exf], #0 \n"
" it ne \n"
" bne 1b \n"
: [exf] "=&r" (exflag),
[tmp] "=&r" (tmp)
: [ptr] "r" (p),
[val] "r" (val)
: "cc", "memory");
}
static __inline void
atomic_add_long(volatile u_long *p, u_long val)
{
atomic_add_32((volatile uint32_t *)p, val);
}
ATOMIC_ACQ_REL(add, 32)
ATOMIC_ACQ_REL(add, 64)
ATOMIC_ACQ_REL_LONG(add)
static __inline void
atomic_clear_32(volatile uint32_t *address, uint32_t setmask)
{
uint32_t tmp = 0, tmp2 = 0;
__asm __volatile(
"1: ldrex %0, [%2] \n"
" bic %0, %0, %3 \n"
" strex %1, %0, [%2] \n"
" cmp %1, #0 \n"
" it ne \n"
" bne 1b \n"
: "=&r" (tmp), "+r" (tmp2), "+r" (address), "+r" (setmask)
: : "cc", "memory");
}
static __inline void
atomic_clear_64(volatile uint64_t *p, uint64_t val)
{
uint64_t tmp;
uint32_t exflag;
__asm __volatile(
"1: \n"
" ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n"
" bic %Q[tmp], %Q[val] \n"
" bic %R[tmp], %R[val] \n"
" strexd %[exf], %Q[tmp], %R[tmp], [%[ptr]] \n"
" teq %[exf], #0 \n"
" it ne \n"
" bne 1b \n"
: [exf] "=&r" (exflag),
[tmp] "=&r" (tmp)
: [ptr] "r" (p),
[val] "r" (val)
: "cc", "memory");
}
static __inline void
atomic_clear_long(volatile u_long *address, u_long setmask)
{
atomic_clear_32((volatile uint32_t *)address, setmask);
}
ATOMIC_ACQ_REL(clear, 32)
ATOMIC_ACQ_REL(clear, 64)
ATOMIC_ACQ_REL_LONG(clear)
static __inline uint32_t
atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
{
uint32_t ret;
__asm __volatile(
"1: ldrex %0, [%1] \n"
" cmp %0, %2 \n"
" itt ne \n"
" movne %0, #0 \n"
" bne 2f \n"
" strex %0, %3, [%1] \n"
" cmp %0, #0 \n"
" ite eq \n"
" moveq %0, #1 \n"
" bne 1b \n"
"2:"
: "=&r" (ret), "+r" (p), "+r" (cmpval), "+r" (newval)
: : "cc", "memory");
return (ret);
}
static __inline int
atomic_cmpset_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval)
{
uint64_t tmp;
uint32_t ret;
__asm __volatile(
"1: \n"
" ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n"
" teq %Q[tmp], %Q[cmpval] \n"
" itee eq \n"
" teqeq %R[tmp], %R[cmpval] \n"
" movne %[ret], #0 \n"
" bne 2f \n"
" strexd %[ret], %Q[newval], %R[newval], [%[ptr]]\n"
" teq %[ret], #0 \n"
" it ne \n"
" bne 1b \n"
" mov %[ret], #1 \n"
"2: \n"
: [ret] "=&r" (ret),
[tmp] "=&r" (tmp)
: [ptr] "r" (p),
[cmpval] "r" (cmpval),
[newval] "r" (newval)
: "cc", "memory");
return (ret);
}
static __inline u_long
atomic_cmpset_long(volatile u_long *p, u_long cmpval, u_long newval)
{
return (atomic_cmpset_32((volatile uint32_t *)p, cmpval, newval));
}
static __inline uint32_t
atomic_cmpset_acq_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
{
uint32_t ret;
ret = atomic_cmpset_32(p, cmpval, newval);
dmb();
return (ret);
}
static __inline uint64_t
atomic_cmpset_acq_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval)
{
uint64_t ret;
ret = atomic_cmpset_64(p, cmpval, newval);
dmb();
return (ret);
}
static __inline u_long
atomic_cmpset_acq_long(volatile u_long *p, u_long cmpval, u_long newval)
{
u_long ret;
ret = atomic_cmpset_long(p, cmpval, newval);
dmb();
return (ret);
}
static __inline uint32_t
atomic_cmpset_rel_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
{
dmb();
return (atomic_cmpset_32(p, cmpval, newval));
}
static __inline uint64_t
atomic_cmpset_rel_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval)
{
dmb();
return (atomic_cmpset_64(p, cmpval, newval));
}
static __inline u_long
atomic_cmpset_rel_long(volatile u_long *p, u_long cmpval, u_long newval)
{
dmb();
return (atomic_cmpset_long(p, cmpval, newval));
}
static __inline uint32_t
atomic_fetchadd_32(volatile uint32_t *p, uint32_t val)
{
uint32_t tmp = 0, tmp2 = 0, ret = 0;
__asm __volatile(
"1: ldrex %0, [%3] \n"
" add %1, %0, %4 \n"
" strex %2, %1, [%3] \n"
" cmp %2, #0 \n"
" it ne \n"
" bne 1b \n"
: "+r" (ret), "=&r" (tmp), "+r" (tmp2), "+r" (p), "+r" (val)
: : "cc", "memory");
return (ret);
}
static __inline uint64_t
atomic_fetchadd_64(volatile uint64_t *p, uint64_t val)
{
uint64_t ret, tmp;
uint32_t exflag;
__asm __volatile(
"1: \n"
" ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n"
" adds %Q[tmp], %Q[ret], %Q[val] \n"
" adc %R[tmp], %R[ret], %R[val] \n"
" strexd %[exf], %Q[tmp], %R[tmp], [%[ptr]] \n"
" teq %[exf], #0 \n"
" it ne \n"
" bne 1b \n"
: [ret] "=&r" (ret),
[exf] "=&r" (exflag),
[tmp] "=&r" (tmp)
: [ptr] "r" (p),
[val] "r" (val)
: "cc", "memory");
return (ret);
}
static __inline u_long
atomic_fetchadd_long(volatile u_long *p, u_long val)
{
return (atomic_fetchadd_32((volatile uint32_t *)p, val));
}
static __inline uint32_t
atomic_load_acq_32(volatile uint32_t *p)
{
uint32_t v;
v = *p;
dmb();
return (v);
}
static __inline uint64_t
atomic_load_64(volatile uint64_t *p)
{
uint64_t ret;
/*
* The only way to atomically load 64 bits is with LDREXD which puts the
* exclusive monitor into the exclusive state, so reset it to open state
* with CLREX because we don't actually need to store anything.
*/
__asm __volatile(
"ldrexd %Q[ret], %R[ret], [%[ptr]] \n"
"clrex \n"
: [ret] "=&r" (ret)
: [ptr] "r" (p)
: "cc", "memory");
return (ret);
}
static __inline uint64_t
atomic_load_acq_64(volatile uint64_t *p)
{
uint64_t ret;
ret = atomic_load_64(p);
dmb();
return (ret);
}
static __inline u_long
atomic_load_acq_long(volatile u_long *p)
{
u_long v;
v = *p;
dmb();
return (v);
}
static __inline uint32_t
atomic_readandclear_32(volatile uint32_t *p)
{
uint32_t ret, tmp = 0, tmp2 = 0;
__asm __volatile(
"1: ldrex %0, [%3] \n"
" mov %1, #0 \n"
" strex %2, %1, [%3] \n"
" cmp %2, #0 \n"
" it ne \n"
" bne 1b \n"
: "=r" (ret), "=&r" (tmp), "+r" (tmp2), "+r" (p)
: : "cc", "memory");
return (ret);
}
static __inline uint64_t
atomic_readandclear_64(volatile uint64_t *p)
{
uint64_t ret, tmp;
uint32_t exflag;
__asm __volatile(
"1: \n"
" ldrexd %Q[ret], %R[ret], [%[ptr]] \n"
" mov %Q[tmp], #0 \n"
" mov %R[tmp], #0 \n"
" strexd %[exf], %Q[tmp], %R[tmp], [%[ptr]] \n"
" teq %[exf], #0 \n"
" it ne \n"
" bne 1b \n"
: [ret] "=&r" (ret),
[exf] "=&r" (exflag),
[tmp] "=&r" (tmp)
: [ptr] "r" (p)
: "cc", "memory");
return (ret);
}
static __inline u_long
atomic_readandclear_long(volatile u_long *p)
{
return (atomic_readandclear_32((volatile uint32_t *)p));
}
static __inline void
atomic_set_32(volatile uint32_t *address, uint32_t setmask)
{
uint32_t tmp = 0, tmp2 = 0;
__asm __volatile(
"1: ldrex %0, [%2] \n"
" orr %0, %0, %3 \n"
" strex %1, %0, [%2] \n"
" cmp %1, #0 \n"
" it ne \n"
" bne 1b \n"
: "=&r" (tmp), "+r" (tmp2), "+r" (address), "+r" (setmask)
: : "cc", "memory");
}
static __inline void
atomic_set_64(volatile uint64_t *p, uint64_t val)
{
uint64_t tmp;
uint32_t exflag;
__asm __volatile(
"1: \n"
" ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n"
" orr %Q[tmp], %Q[val] \n"
" orr %R[tmp], %R[val] \n"
" strexd %[exf], %Q[tmp], %R[tmp], [%[ptr]] \n"
" teq %[exf], #0 \n"
" it ne \n"
" bne 1b \n"
: [exf] "=&r" (exflag),
[tmp] "=&r" (tmp)
: [ptr] "r" (p),
[val] "r" (val)
: "cc", "memory");
}
static __inline void
atomic_set_long(volatile u_long *address, u_long setmask)
{
atomic_set_32((volatile uint32_t *)address, setmask);
}
ATOMIC_ACQ_REL(set, 32)
ATOMIC_ACQ_REL(set, 64)
ATOMIC_ACQ_REL_LONG(set)
static __inline void
atomic_subtract_32(volatile uint32_t *p, uint32_t val)
{
uint32_t tmp = 0, tmp2 = 0;
__asm __volatile(
"1: ldrex %0, [%2] \n"
" sub %0, %0, %3 \n"
" strex %1, %0, [%2] \n"
" cmp %1, #0 \n"
" it ne \n"
" bne 1b \n"
: "=&r" (tmp), "+r" (tmp2), "+r" (p), "+r" (val)
: : "cc", "memory");
}
static __inline void
atomic_subtract_64(volatile uint64_t *p, uint64_t val)
{
uint64_t tmp;
uint32_t exflag;
__asm __volatile(
"1: \n"
" ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n"
" subs %Q[tmp], %Q[val] \n"
" sbc %R[tmp], %R[tmp], %R[val] \n"
" strexd %[exf], %Q[tmp], %R[tmp], [%[ptr]] \n"
" teq %[exf], #0 \n"
" it ne \n"
" bne 1b \n"
: [exf] "=&r" (exflag),
[tmp] "=&r" (tmp)
: [ptr] "r" (p),
[val] "r" (val)
: "cc", "memory");
}
static __inline void
atomic_subtract_long(volatile u_long *p, u_long val)
{
atomic_subtract_32((volatile uint32_t *)p, val);
}
ATOMIC_ACQ_REL(subtract, 32)
ATOMIC_ACQ_REL(subtract, 64)
ATOMIC_ACQ_REL_LONG(subtract)
static __inline void
atomic_store_64(volatile uint64_t *p, uint64_t val)
{
uint64_t tmp;
uint32_t exflag;
/*
* The only way to atomically store 64 bits is with STREXD, which will
* succeed only if paired up with a preceeding LDREXD using the same
* address, so we read and discard the existing value before storing.
*/
__asm __volatile(
"1: \n"
" ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n"
" strexd %[exf], %Q[val], %R[val], [%[ptr]] \n"
" teq %[exf], #0 \n"
" it ne \n"
" bne 1b \n"
: [tmp] "=&r" (tmp),
[exf] "=&r" (exflag)
: [ptr] "r" (p),
[val] "r" (val)
: "cc", "memory");
}
static __inline void
atomic_store_rel_32(volatile uint32_t *p, uint32_t v)
{
dmb();
*p = v;
}
static __inline void
atomic_store_rel_64(volatile uint64_t *p, uint64_t val)
{
dmb();
atomic_store_64(p, val);
}
static __inline void
atomic_store_rel_long(volatile u_long *p, u_long v)
{
dmb();
*p = v;
}
#undef ATOMIC_ACQ_REL
#undef ATOMIC_ACQ_REL_LONG
#endif /* _MACHINE_ATOMIC_V6_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,7 @@
*/
#include "opt_ddb.h"
#include "opt_kstack_pages.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

View File

@ -48,6 +48,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_kstack_pages.h"
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>

View File

@ -48,6 +48,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_kstack_pages.h"
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>

View File

@ -48,6 +48,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_kstack_pages.h"
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>

View File

@ -48,6 +48,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_kstack_pages.h"
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>

View File

@ -46,6 +46,7 @@
*/
#include "opt_ddb.h"
#include "opt_kstack_pages.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

View File

@ -0,0 +1,76 @@
/*-
* Copyright (c) 2015 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by Semihalf under
* the sponsorship of 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, 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <machine/pci_cfgreg.h>
/*
* This file contains stubs for ACPI PCI functions
*/
/*
* Read configuration space register
*/
uint32_t
pci_cfgregread(int bus, int slot, int func, int reg, int bytes)
{
/* ARM64TODO */
panic("pci_cfgregread not implemented");
return (0);
}
/*
* Write configuration space register
*/
void
pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes)
{
/* ARM64TODO */
panic("pci_cfgregwrite not implemented");
}
/*
* Initialize access to configuration space
*/
int
pci_cfgregopen(void)
{
/* ARM64TODO */
panic("pci_cfgregopen not implemented");
return (0);
}

View File

@ -61,17 +61,18 @@ __FBSDID("$FreeBSD$");
add x1, x1, x2 /* Add these to the size */
bic x0, x0, x4 /* Clear the low bit of the address */
1:
dc \dcop, x0
dsb ish
.if \ic != 0
ic \icop, x0
dsb ish
.endif
dc \dcop, x0
add x0, x0, x3 /* Move to the next line */
subs x1, x1, x3 /* Reduce the size */
b.hi 1b /* Check if we are done */
.if \ic != 0
isb
.endif
dsb ish
ret
.endm

View File

@ -52,6 +52,7 @@ static struct ofw_compat_data compat_data[] = {
{"arm,cortex-a7-gic", true},
{"arm,arm11mp-gic", true},
{"brcm,brahma-b15-gic", true},
{"qcom,msm-qgic2", true},
{NULL, false}
};

View File

@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/mutex.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <vm/vm.h>
@ -89,6 +90,7 @@ static void its_free_tables(struct gic_v3_its_softc *);
static void its_init_commandq(struct gic_v3_its_softc *);
static int its_init_cpu(struct gic_v3_its_softc *);
static void its_init_cpu_collection(struct gic_v3_its_softc *);
static uint32_t its_get_devid(device_t);
static int its_cmd_send(struct gic_v3_its_softc *, struct its_cmd_desc *);
@ -133,6 +135,23 @@ const char *its_ptab_type[] = {
[GITS_BASER_TYPE_RES7] = "Reserved (7)",
};
/*
* Vendor specific quirks.
* One needs to add appropriate entry to its_quirks[]
* table if the imlementation varies from the generic ARM ITS.
*/
/* Cavium ThunderX PCI devid acquire function */
static uint32_t its_get_devid_thunder(device_t);
static const struct its_quirks its_quirks[] = {
{
.cpuid = CPU_ID_RAW(CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 0, 0),
.cpuid_mask = CPU_IMPL_MASK | CPU_PART_MASK,
.devid_func = its_get_devid_thunder,
},
};
static struct gic_v3_its_softc *its_sc;
#define gic_its_read(sc, len, reg) \
@ -794,6 +813,26 @@ lpi_alloc_chunk(struct gic_v3_its_softc *sc, struct lpi_chunk *lpic,
return (0);
}
static void
lpi_free_chunk(struct gic_v3_its_softc *sc, struct lpi_chunk *lpic)
{
int start, end;
uint8_t *bitmap;
bitmap = (uint8_t *)sc->its_lpi_bitmap;
KASSERT((lpic->lpi_free == lpic->lpi_num),
("Trying to free LPI chunk that is still in use.\n"));
/* First bit of this chunk in a global bitmap */
start = lpic->lpi_base - GIC_FIRST_LPI;
/* and last bit of this chunk... */
end = start + lpic->lpi_num - 1;
/* Finally free this chunk */
bit_nclear(bitmap, start, end);
}
static void
lpi_configure(struct gic_v3_its_softc *sc, struct its_dev *its_dev,
uint32_t lpinum, boolean_t unmask)
@ -1300,10 +1339,13 @@ its_device_alloc_locked(struct gic_v3_its_softc *sc, device_t pci_dev,
if (newdev != NULL)
return (newdev);
devid = PCI_DEVID(pci_dev);
devid = its_get_devid(pci_dev);
/* There was no previously created device. Create one now */
newdev = malloc(sizeof(*newdev), M_GIC_V3_ITS, (M_WAITOK | M_ZERO));
newdev = malloc(sizeof(*newdev), M_GIC_V3_ITS, (M_NOWAIT | M_ZERO));
if (newdev == NULL)
return (NULL);
newdev->pci_dev = pci_dev;
newdev->devid = devid;
@ -1321,7 +1363,12 @@ its_device_alloc_locked(struct gic_v3_its_softc *sc, device_t pci_dev,
*/
newdev->itt = (vm_offset_t)contigmalloc(
roundup2(roundup2(nvecs, 2) * esize, 0x100), M_GIC_V3_ITS,
(M_WAITOK | M_ZERO), 0, ~0UL, 0x100, 0);
(M_NOWAIT | M_ZERO), 0, ~0UL, 0x100, 0);
if (newdev->itt == 0) {
lpi_free_chunk(sc, &newdev->lpis);
free(newdev, M_GIC_V3_ITS);
return (NULL);
}
/*
* XXX ARM64TODO: Currently all interrupts are going
@ -1353,6 +1400,77 @@ its_device_asign_lpi_locked(struct gic_v3_its_softc *sc,
its_dev->lpis.lpi_free);
its_dev->lpis.lpi_free--;
}
/*
* ITS quirks.
* Add vendor specific PCI devid function here.
*/
static uint32_t
its_get_devid_thunder(device_t pci_dev)
{
int bsf;
int pem;
uint32_t bus;
bus = pci_get_bus(pci_dev);
bsf = PCI_RID(pci_get_bus(pci_dev), pci_get_slot(pci_dev),
pci_get_function(pci_dev));
/* ECAM is on bus=0 */
if (bus == 0) {
return ((pci_get_domain(pci_dev) << PCI_RID_DOMAIN_SHIFT) |
bsf);
/* PEM otherwise */
} else {
/* PEM (PCIe MAC/root complex) number is equal to domain */
pem = pci_get_domain(pci_dev);
/*
* Set appropriate device ID (passed by the HW along with
* the transaction to memory) for different root complex
* numbers using hard-coded domain portion for each group.
*/
if (pem < 3)
return ((0x1 << PCI_RID_DOMAIN_SHIFT) | bsf);
if (pem < 6)
return ((0x3 << PCI_RID_DOMAIN_SHIFT) | bsf);
if (pem < 9)
return ((0x9 << PCI_RID_DOMAIN_SHIFT) | bsf);
if (pem < 12)
return ((0xB << PCI_RID_DOMAIN_SHIFT) | bsf);
}
return (0);
}
static __inline uint32_t
its_get_devid_default(device_t pci_dev)
{
return (PCI_DEVID_GENERIC(pci_dev));
}
static uint32_t
its_get_devid(device_t pci_dev)
{
const struct its_quirks *quirk;
size_t i;
for (i = 0; i < nitems(its_quirks); i++) {
quirk = &its_quirks[i];
if (CPU_MATCH_RAW(quirk->cpuid_mask, quirk->cpuid)) {
if (quirk->devid_func != NULL)
return ((*quirk->devid_func)(pci_dev));
}
}
return (its_get_devid_default(pci_dev));
}
/*
* Message signalled interrupts handling.
*/

View File

@ -234,6 +234,15 @@ struct gic_v3_its_softc {
struct mtx its_spin_mtx;
};
/* Stuff that is specific to the vendor's implementation */
typedef uint32_t (*its_devid_func_t)(device_t);
struct its_quirks {
uint64_t cpuid;
uint64_t cpuid_mask;
its_devid_func_t devid_func;
};
extern devclass_t gic_v3_its_devclass;
int gic_v3_its_detach(device_t);
@ -277,13 +286,12 @@ void lpi_mask_irq(device_t, uint32_t);
reg, val); \
})
#define PCI_DEVID(pci_dev) \
({ \
(((pci_get_domain(pci_dev) >> 2) << 19) | \
((pci_get_domain(pci_dev) % 4) << 16) | \
(pci_get_bus(pci_dev) << 8) | \
(pci_get_slot(pci_dev) << 3) | \
(pci_get_function(pci_dev) << 0)); \
#define PCI_DEVID_GENERIC(pci_dev) \
({ \
((pci_get_domain(pci_dev) << PCI_RID_DOMAIN_SHIFT) | \
(pci_get_bus(pci_dev) << PCI_RID_BUS_SHIFT) | \
(pci_get_slot(pci_dev) << PCI_RID_SLOT_SHIFT) | \
(pci_get_function(pci_dev) << PCI_RID_FUNC_SHIFT)); \
})
/*

View File

@ -451,8 +451,7 @@ void
arm_setup_ipihandler(driver_filter_t *filt, u_int ipi)
{
/* ARM64TODO: The hard coded 16 will be fixed with am_intrng */
arm_setup_intr("ipi", filt, NULL, (void *)((uintptr_t)ipi | 1<<16), ipi + 16,
arm_setup_intr("ipi", filt, NULL, (void *)((uintptr_t)ipi | 1<<16), ipi,
INTR_TYPE_MISC | INTR_EXCL, NULL);
arm_unmask_ipi(ipi);
}
@ -460,7 +459,8 @@ arm_setup_ipihandler(driver_filter_t *filt, u_int ipi)
void
arm_unmask_ipi(u_int ipi)
{
PIC_UNMASK(root_pic, ipi + 16);
PIC_UNMASK(root_pic, ipi);
}
void
@ -494,9 +494,6 @@ ipi_cpu(int cpu, u_int ipi)
CPU_ZERO(&cpus);
CPU_SET(cpu, &cpus);
/* ARM64TODO: This will be fixed with arm_intrng */
ipi += 16;
CTR2(KTR_SMP, "ipi_cpu: cpu: %d, ipi: %x", cpu, ipi);
PIC_IPI_SEND(root_pic, cpus, ipi);
}
@ -505,9 +502,6 @@ void
ipi_selected(cpuset_t cpus, u_int ipi)
{
/* ARM64TODO: This will be fixed with arm_intrng */
ipi += 16;
CTR1(KTR_SMP, "ipi_selected: ipi: %x", ipi);
PIC_IPI_SEND(root_pic, cpus, ipi);
}

View File

@ -27,6 +27,7 @@
*/
#include "assym.s"
#include "opt_kstack_pages.h"
#include <sys/syscall.h>
#include <machine/asm.h>
#include <machine/armreg.h>
@ -51,8 +52,6 @@
* We are loaded at a 2MiB aligned address
*/
#define INIT_STACK_SIZE (PAGE_SIZE * 4)
.text
.globl _start
_start:
@ -180,8 +179,7 @@ ENTRY(mpentry)
mp_virtdone:
ldr x4, =secondary_stacks
mov x5, #(PAGE_SIZE * KSTACK_PAGES)
sub x1, x0, #1
mul x5, x1, x5
mul x5, x0, x5
add sp, x4, x5
b init_secondary
@ -469,6 +467,9 @@ build_block_pagetable:
lsl x12, x7, #2
orr x12, x12, #L2_BLOCK
orr x12, x12, #(ATTR_AF)
#ifdef SMP
orr x12, x12, ATTR_SH(ATTR_SH_IS)
#endif
/* Only use the output address bits */
lsr x9, x9, #L2_SHIFT
@ -532,7 +533,8 @@ mair:
/* Device Normal, no cache Normal, write-back */
.quad MAIR_ATTR(0x00, 0) | MAIR_ATTR(0x44, 1) | MAIR_ATTR(0xff, 2)
tcr:
.quad (TCR_TxSZ(64 - VIRT_BITS) | TCR_ASID_16 | TCR_TG1_4K)
.quad (TCR_TxSZ(64 - VIRT_BITS) | TCR_ASID_16 | TCR_TG1_4K | \
TCR_CACHE_ATTRS | TCR_SMP_ATTRS)
sctlr_set:
/* Bits to set */
.quad (SCTLR_UCI | SCTLR_nTWE | SCTLR_nTWI | SCTLR_UCT | SCTLR_DZE | \

Some files were not shown because too many files have changed in this diff Show More