mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
MFhead@r323343
This commit is contained in:
commit
5be4ad9e80
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/runtime-coverage/; revision=323344
@ -1787,7 +1787,8 @@ update: .PHONY
|
||||
|
||||
# ELF Tool Chain libraries are needed for ELF tools and dtrace tools.
|
||||
# r296685 fix cross-endian objcopy
|
||||
.if ${BOOTSTRAPPING} < 1100102
|
||||
# r310724 fixed PR 215350, a crash in libdwarf with objects built by GCC 6.2.
|
||||
.if ${BOOTSTRAPPING} < 1200020
|
||||
_elftoolchain_libs= lib/libelf lib/libdwarf
|
||||
.endif
|
||||
|
||||
|
@ -4,4 +4,7 @@
|
||||
PACKAGE=runtime
|
||||
PROG= chflags
|
||||
|
||||
HAS_TESTS=
|
||||
SUBDIR.${MK_TESTS}+= tests
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
5
bin/chflags/tests/Makefile
Normal file
5
bin/chflags/tests/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
ATF_TESTS_SH+= chflags_test
|
||||
|
||||
.include <bsd.test.mk>
|
63
bin/chflags/tests/chflags_test.sh
Normal file
63
bin/chflags/tests/chflags_test.sh
Normal file
@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright 2017 Shivansh Rai
|
||||
# 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$
|
||||
#
|
||||
|
||||
usage_output='usage: chflags'
|
||||
|
||||
atf_test_case invalid_usage
|
||||
invalid_usage_head()
|
||||
{
|
||||
atf_set "descr" "Verify that an invalid usage with a supported option produces a valid error message"
|
||||
}
|
||||
|
||||
invalid_usage_body()
|
||||
{
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" chflags -f
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" chflags -H
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" chflags -h
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" chflags -L
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" chflags -P
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" chflags -R
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" chflags -v
|
||||
}
|
||||
|
||||
atf_test_case no_arguments
|
||||
no_arguments_head()
|
||||
{
|
||||
atf_set "descr" "Verify that chflags(1) fails and generates a valid usage message when no arguments are supplied"
|
||||
}
|
||||
|
||||
no_arguments_body()
|
||||
{
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" chflags
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case invalid_usage
|
||||
atf_add_test_case no_arguments
|
||||
}
|
@ -4,4 +4,7 @@
|
||||
PACKAGE=runtime
|
||||
PROG= mkdir
|
||||
|
||||
HAS_TESTS=
|
||||
SUBDIR.${MK_TESTS}+= tests
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
5
bin/mkdir/tests/Makefile
Normal file
5
bin/mkdir/tests/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
ATF_TESTS_SH+= mkdir_test
|
||||
|
||||
.include <bsd.test.mk>
|
61
bin/mkdir/tests/mkdir_test.sh
Normal file
61
bin/mkdir/tests/mkdir_test.sh
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# Copyright 2017 Shivansh Rai
|
||||
# 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$
|
||||
#
|
||||
|
||||
usage_output='usage: mkdir'
|
||||
|
||||
atf_test_case invalid_usage
|
||||
invalid_usage_head()
|
||||
{
|
||||
atf_set "descr" "Verify that an invalid usage with a supported option produces a valid error message"
|
||||
}
|
||||
|
||||
invalid_usage_body()
|
||||
{
|
||||
atf_check -s not-exit:0 -e inline:"mkdir: option requires an argument -- m
|
||||
usage: mkdir [-pv] [-m mode] directory_name ...
|
||||
" mkdir -m
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" mkdir -p
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" mkdir -v
|
||||
}
|
||||
|
||||
atf_test_case no_arguments
|
||||
no_arguments_head()
|
||||
{
|
||||
atf_set "descr" "Verify that mkdir(1) fails and generates a valid usage message when no arguments are supplied"
|
||||
}
|
||||
|
||||
no_arguments_body()
|
||||
{
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" mkdir
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case invalid_usage
|
||||
atf_add_test_case no_arguments
|
||||
}
|
@ -262,9 +262,9 @@ state(KINFO *k, VARENT *ve __unused)
|
||||
cp++;
|
||||
if (!(flag & P_INMEM))
|
||||
*cp++ = 'W';
|
||||
if (k->ki_p->ki_nice < NZERO)
|
||||
if (k->ki_p->ki_nice < NZERO || k->ki_p->ki_pri.pri_class == PRI_REALTIME)
|
||||
*cp++ = '<';
|
||||
else if (k->ki_p->ki_nice > NZERO)
|
||||
else if (k->ki_p->ki_nice > NZERO || k->ki_p->ki_pri.pri_class == PRI_IDLE)
|
||||
*cp++ = 'N';
|
||||
if (flag & P_TRACED)
|
||||
*cp++ = 'X';
|
||||
@ -274,6 +274,8 @@ state(KINFO *k, VARENT *ve __unused)
|
||||
*cp++ = 'V';
|
||||
if ((flag & P_SYSTEM) || k->ki_p->ki_lock > 0)
|
||||
*cp++ = 'L';
|
||||
if ((k->ki_p->ki_cr_flags & CRED_FLAG_CAPMODE) != 0)
|
||||
*cp++ = 'C';
|
||||
if (k->ki_p->ki_kiflag & KI_SLEADER)
|
||||
*cp++ = 's';
|
||||
if ((flag & P_CONTROLT) && k->ki_p->ki_pgid == k->ki_p->ki_tpgid)
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 25, 2017
|
||||
.Dd September 7, 2017
|
||||
.Dt PS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -436,6 +436,10 @@ information:
|
||||
The process is in the foreground process group of its control terminal.
|
||||
.It Li <
|
||||
The process has raised CPU scheduling priority.
|
||||
.It Li C
|
||||
The process is in
|
||||
.Xr capsicum 4
|
||||
capability mode.
|
||||
.It Li E
|
||||
The process is trying to exit.
|
||||
.It Li J
|
||||
@ -541,7 +545,7 @@ short-term CPU usage factor (for scheduling)
|
||||
.It Cm dsiz
|
||||
data size (in Kbytes)
|
||||
.It Cm emul
|
||||
system-call emulation environment
|
||||
system-call emulation environment (ABI)
|
||||
.It Cm etime
|
||||
elapsed running time, format
|
||||
.Op days- Ns
|
||||
|
@ -11,4 +11,7 @@ PACKAGE=rcmds
|
||||
BINOWN= root
|
||||
BINMODE=4555
|
||||
|
||||
HAS_TESTS=
|
||||
SUBDIR.${MK_TESTS}+= tests
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
5
bin/rcp/tests/Makefile
Normal file
5
bin/rcp/tests/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
ATF_TESTS_SH+= rcp_test
|
||||
|
||||
.include <bsd.test.mk>
|
60
bin/rcp/tests/rcp_test.sh
Normal file
60
bin/rcp/tests/rcp_test.sh
Normal file
@ -0,0 +1,60 @@
|
||||
#
|
||||
# Copyright 2017 Shivansh Rai
|
||||
# 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$
|
||||
#
|
||||
|
||||
usage_output='usage: rcp'
|
||||
|
||||
atf_test_case invalid_usage
|
||||
invalid_usage_head()
|
||||
{
|
||||
atf_set "descr" "Verify that an invalid usage with a supported option produces a valid error message"
|
||||
}
|
||||
|
||||
invalid_usage_body()
|
||||
{
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" rcp -4
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" rcp -6
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" rcp -p
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" rcp -r
|
||||
}
|
||||
|
||||
atf_test_case no_arguments
|
||||
no_arguments_head()
|
||||
{
|
||||
atf_set "descr" "Verify that rcp(1) fails and generates a valid usage message when no arguments are supplied"
|
||||
}
|
||||
|
||||
no_arguments_body()
|
||||
{
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" rcp
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case invalid_usage
|
||||
atf_add_test_case no_arguments
|
||||
}
|
@ -4,4 +4,7 @@
|
||||
PACKAGE=runtime
|
||||
PROG= rmdir
|
||||
|
||||
HAS_TESTS=
|
||||
SUBDIR.${MK_TESTS}+= tests
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
5
bin/rmdir/tests/Makefile
Normal file
5
bin/rmdir/tests/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
ATF_TESTS_SH+= rmdir_test
|
||||
|
||||
.include <bsd.test.mk>
|
58
bin/rmdir/tests/rmdir_test.sh
Normal file
58
bin/rmdir/tests/rmdir_test.sh
Normal file
@ -0,0 +1,58 @@
|
||||
#
|
||||
# Copyright 2017 Shivansh Rai
|
||||
# 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$
|
||||
#
|
||||
|
||||
usage_output='usage: rmdir'
|
||||
|
||||
atf_test_case invalid_usage
|
||||
invalid_usage_head()
|
||||
{
|
||||
atf_set "descr" "Verify that an invalid usage with a supported option produces a valid error message"
|
||||
}
|
||||
|
||||
invalid_usage_body()
|
||||
{
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" rmdir -p
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" rmdir -v
|
||||
}
|
||||
|
||||
atf_test_case no_arguments
|
||||
no_arguments_head()
|
||||
{
|
||||
atf_set "descr" "Verify that rmdir(1) fails and generates a valid usage message when no arguments are supplied"
|
||||
}
|
||||
|
||||
no_arguments_body()
|
||||
{
|
||||
atf_check -s not-exit:0 -e match:"$usage_output" rmdir
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case invalid_usage
|
||||
atf_add_test_case no_arguments
|
||||
}
|
@ -74,7 +74,7 @@ zmount(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
char *dataptr, int datalen, char *optptr, int optlen)
|
||||
{
|
||||
struct iovec *iov;
|
||||
char *optstr, *os, *p;
|
||||
char *optstr, *os, *p, *tofree;
|
||||
int iovlen, rv;
|
||||
|
||||
assert(spec != NULL);
|
||||
@ -87,7 +87,7 @@ zmount(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
assert(optptr != NULL);
|
||||
assert(optlen > 0);
|
||||
|
||||
optstr = strdup(optptr);
|
||||
tofree = optstr = strdup(optptr);
|
||||
assert(optstr != NULL);
|
||||
|
||||
iov = NULL;
|
||||
@ -98,11 +98,9 @@ zmount(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir),
|
||||
(size_t)-1);
|
||||
build_iovec(&iov, &iovlen, "from", __DECONST(char *, spec), (size_t)-1);
|
||||
for (p = optstr; p != NULL; strsep(&p, ",/ ")) {
|
||||
if (*p != '\0')
|
||||
while ((p = strsep(&optstr, ",/")) != NULL)
|
||||
build_iovec(&iov, &iovlen, p, NULL, (size_t)-1);
|
||||
}
|
||||
rv = nmount(iov, iovlen, 0);
|
||||
free(optstr);
|
||||
free(tofree);
|
||||
return (rv);
|
||||
}
|
||||
|
@ -963,7 +963,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
|
||||
|
||||
(void) snprintf(path, sizeof (path), "/dev/dtrace/%s", p1);
|
||||
|
||||
if ((fd = open(path, O_RDONLY)) == -1)
|
||||
if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1)
|
||||
continue; /* failed to open driver; just skip it */
|
||||
|
||||
if (((prov = malloc(sizeof (dt_provmod_t))) == NULL) ||
|
||||
@ -1100,7 +1100,7 @@ dt_vopen(int version, int flags, int *errp,
|
||||
*/
|
||||
dt_provmod_open(&provmod, &df);
|
||||
|
||||
dtfd = open("/dev/dtrace/dtrace", O_RDWR);
|
||||
dtfd = open("/dev/dtrace/dtrace", O_RDWR | O_CLOEXEC);
|
||||
err = errno; /* save errno from opening dtfd */
|
||||
#if defined(__FreeBSD__)
|
||||
/*
|
||||
@ -1116,7 +1116,7 @@ dt_vopen(int version, int flags, int *errp,
|
||||
#ifdef illumos
|
||||
ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR);
|
||||
#else
|
||||
ftfd = open("/dev/dtrace/fasttrap", O_RDWR);
|
||||
ftfd = open("/dev/dtrace/fasttrap", O_RDWR | O_CLOEXEC);
|
||||
#endif
|
||||
fterr = ftfd == -1 ? errno : 0; /* save errno from open ftfd */
|
||||
|
||||
@ -1146,9 +1146,6 @@ dt_vopen(int version, int flags, int *errp,
|
||||
return (set_open_errno(dtp, errp, err));
|
||||
}
|
||||
|
||||
(void) fcntl(dtfd, F_SETFD, FD_CLOEXEC);
|
||||
(void) fcntl(ftfd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
alloc:
|
||||
if ((dtp = malloc(sizeof (dtrace_hdl_t))) == NULL) {
|
||||
dt_provmod_destroy(&provmod);
|
||||
|
@ -54,6 +54,7 @@ DSRCS= errno.d \
|
||||
siftr.d \
|
||||
signal.d \
|
||||
tcp.d \
|
||||
socket.d \
|
||||
udp.d \
|
||||
unistd.d
|
||||
|
||||
|
301
cddl/lib/libdtrace/socket.d
Normal file
301
cddl/lib/libdtrace/socket.d
Normal file
@ -0,0 +1,301 @@
|
||||
/*
|
||||
* Copyright (c) 2017 George V. Neville-Neil
|
||||
* 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$
|
||||
*
|
||||
* Translators and flags for the socket structure. FreeBSD specific code.
|
||||
*/
|
||||
|
||||
#pragma D depends_on module kernel
|
||||
|
||||
/*
|
||||
* Option flags per-socket.
|
||||
*/
|
||||
#pragma D binding "1.13" SO_DEBUG
|
||||
inline int SO_DEBUG = 0x0001; /* turn on debugging info recording */
|
||||
#pragma D binding "1.13" SO_ACCEPTCONN
|
||||
inline int SO_ACCEPTCONN = 0x0002; /* socket has had listen() */
|
||||
#pragma D binding "1.13" SO_REUSEADDR
|
||||
inline int SO_REUSEADDR = 0x0004; /* allow local address reuse */
|
||||
#pragma D binding "1.13" SO_KEEPALIVE
|
||||
inline int SO_KEEPALIVE = 0x0008; /* keep connections alive */
|
||||
#pragma D binding "1.13" SO_DONTROUTE
|
||||
inline int SO_DONTROUTE = 0x0010; /* just use interface addresses */
|
||||
#pragma D binding "1.13" SO_BROADCAST
|
||||
inline int SO_BROADCAST = 0x0020; /* permit sending of broadcast msgs */
|
||||
#pragma D binding "1.13" SO_USELOOPBACK
|
||||
inline int SO_USELOOPBACK = 0x0040; /* bypass hardware when possible */
|
||||
#pragma D binding "1.13" SO_LINGER
|
||||
inline int SO_LINGER = 0x0080; /* linger on close if data present */
|
||||
#pragma D binding "1.13" SO_OOBINLINE
|
||||
inline int SO_OOBINLINE = 0x0100; /* leave received OOB data in line */
|
||||
#pragma D binding "1.13" SO_REUSEPORT
|
||||
inline int SO_REUSEPORT = 0x0200; /* allow local address & port reuse */
|
||||
#pragma D binding "1.13" SO_TIMESTAMP
|
||||
inline int SO_TIMESTAMP = 0x0400; /* timestamp received dgram traffic */
|
||||
#pragma D binding "1.13" SO_NOSIGPIPE
|
||||
inline int SO_NOSIGPIPE = 0x0800; /* no SIGPIPE from EPIPE */
|
||||
#pragma D binding "1.13" SO_ACCEPTFILTER
|
||||
inline int SO_ACCEPTFILTER = 0x1000; /* there is an accept filter */
|
||||
#pragma D binding "1.13" SO_BINTIME
|
||||
inline int SO_BINTIME = 0x2000; /* timestamp received dgram traffic */
|
||||
#pragma D binding "1.13" SO_NO_OFFLOAD
|
||||
inline int SO_NO_OFFLOAD = 0x4000; /* socket cannot be offloaded */
|
||||
#pragma D binding "1.13" SO_NO_DDP
|
||||
inline int SO_NO_DDP = 0x8000; /* disable direct data placement */
|
||||
|
||||
/*
|
||||
* Additional options, not kept in so_options.
|
||||
*/
|
||||
#pragma D binding "1.13" SO_SNDBUF
|
||||
inline int SO_SNDBUF = 0x1001; /* send buffer size */
|
||||
#pragma D binding "1.13" SO_RCVBUF
|
||||
inline int SO_RCVBUF = 0x1002; /* receive buffer size */
|
||||
#pragma D binding "1.13" SO_SNDLOWAT
|
||||
inline int SO_SNDLOWAT = 0x1003; /* send low-water mark */
|
||||
#pragma D binding "1.13" SO_RCVLOWAT
|
||||
inline int SO_RCVLOWAT = 0x1004; /* receive low-water mark */
|
||||
#pragma D binding "1.13" SO_SNDTIMEO
|
||||
inline int SO_SNDTIMEO = 0x1005; /* send timeout */
|
||||
#pragma D binding "1.13" SO_RCVTIMEO
|
||||
inline int SO_RCVTIMEO = 0x1006; /* receive timeout */
|
||||
#pragma D binding "1.13" SO_ERROR
|
||||
inline int SO_ERROR = 0x1007; /* get error status and clear */
|
||||
#pragma D binding "1.13" SO_TYPE
|
||||
inline int SO_TYPE = 0x1008; /* get socket type */
|
||||
#pragma D binding "1.13" SO_LABEL
|
||||
inline int SO_LABEL = 0x1009; /* socket's MAC label */
|
||||
#pragma D binding "1.13" SO_PEERLABEL
|
||||
inline int SO_PEERLABEL = 0x1010; /* socket's peer's MAC label */
|
||||
#pragma D binding "1.13" SO_LISTENQLIMIT
|
||||
inline int SO_LISTENQLIMIT = 0x1011; /* socket's backlog limit */
|
||||
#pragma D binding "1.13" SO_LISTENQLEN
|
||||
inline int SO_LISTENQLEN = 0x1012; /* socket's complete queue length */
|
||||
#pragma D binding "1.13" SO_LISTENINCQLEN
|
||||
inline int SO_LISTENINCQLEN = 0x1013; /* socket's incomplete queue length */
|
||||
#pragma D binding "1.13" SO_SETFIB
|
||||
inline int SO_SETFIB = 0x1014; /* use this FIB to route */
|
||||
#pragma D binding "1.13" SO_USER_COOKIE
|
||||
inline int SO_USER_COOKIE = 0x1015; /* user cookie (dummynet etc.) */
|
||||
#pragma D binding "1.13" SO_PROTOCOL
|
||||
inline int SO_PROTOCOL = 0x1016; /* get socket protocol (Linux name) */
|
||||
#pragma D binding "1.13" SO_PROTOTYPE
|
||||
inline int SO_PROTOTYPE = SO_PROTOCOL; /* alias for SO_PROTOCOL (SunOS name) */
|
||||
#pragma D binding "1.13" SO_TS_CLOCK
|
||||
inline int SO_TS_CLOCK = 0x1017; /* clock type used for SO_TIMESTAMP */
|
||||
#pragma D binding "1.13" SO_MAX_PACING_RATE
|
||||
inline int SO_MAX_PACING_RATE = 0x1018; /* socket's max TX pacing rate (Linux name) */
|
||||
|
||||
#pragma D binding "1.13" SO_TS_REALTIME_MICRO
|
||||
inline int SO_TS_REALTIME_MICRO = 0; /* microsecond resolution, realtime */
|
||||
#pragma D binding "1.13" SO_TS_BINTIME
|
||||
inline int SO_TS_BINTIME = 1; /* sub-nanosecond resolution, realtime */
|
||||
#pragma D binding "1.13" SO_TS_REALTIME
|
||||
inline int SO_TS_REALTIME = 2; /* nanosecond resolution, realtime */
|
||||
#pragma D binding "1.13" SO_TS_MONOTONIC
|
||||
inline int SO_TS_MONOTONIC = 3; /* nanosecond resolution, monotonic */
|
||||
#pragma D binding "1.13" SO_TS_DEFAULT
|
||||
inline int SO_TS_DEFAULT = SO_TS_REALTIME_MICRO;
|
||||
#pragma D binding "1.13" SO_TS_CLOCK_MAX
|
||||
inline int SO_TS_CLOCK_MAX = SO_TS_MONOTONIC;
|
||||
|
||||
#pragma D binding "1.13" AF_UNSPEC
|
||||
inline int AF_UNSPEC = 0; /* unspecified */
|
||||
#pragma D binding "1.13" AF_UNIX
|
||||
inline int AF_UNIX = 1; /* standardized name for AF_LOCAL */
|
||||
#pragma D binding "1.13" AF_LOCAL
|
||||
inline int AF_LOCAL = AF_UNIX; /* local to host (pipes, portals) */
|
||||
#pragma D binding "1.13" AF_INET
|
||||
inline int AF_INET = 2; /* internetwork: UDP, TCP, etc. */
|
||||
#pragma D binding "1.13" AF_IMPLINK
|
||||
inline int AF_IMPLINK = 3; /* arpanet imp addresses */
|
||||
#pragma D binding "1.13" AF_PUP
|
||||
inline int AF_PUP = 4; /* pup protocols: e.g. BSP */
|
||||
#pragma D binding "1.13" AF_CHAOS
|
||||
inline int AF_CHAOS = 5; /* mit CHAOS protocols */
|
||||
#pragma D binding "1.13" AF_NETBIOS
|
||||
inline int AF_NETBIOS = 6; /* SMB protocols */
|
||||
#pragma D binding "1.13" AF_ISO
|
||||
inline int AF_ISO = 7; /* ISO protocols */
|
||||
#pragma D binding "1.13" AF_OSI
|
||||
inline int AF_OSI = AF_ISO;
|
||||
#pragma D binding "1.13" AF_ECMA
|
||||
inline int AF_ECMA = 8; /* European computer manufacturers */
|
||||
#pragma D binding "1.13" AF_DATAKIT
|
||||
inline int AF_DATAKIT = 9; /* datakit protocols */
|
||||
#pragma D binding "1.13" AF_CCITT
|
||||
inline int AF_CCITT = 10; /* CCITT protocols, X.25 etc */
|
||||
#pragma D binding "1.13" AF_SNA
|
||||
inline int AF_SNA = 11; /* IBM SNA */
|
||||
#pragma D binding "1.13" AF_DECnet
|
||||
inline int AF_DECnet = 12; /* DECnet */
|
||||
#pragma D binding "1.13" AF_DLI
|
||||
inline int AF_DLI = 13; /* DEC Direct data link interface */
|
||||
#pragma D binding "1.13" AF_LAT
|
||||
inline int AF_LAT = 14; /* LAT */
|
||||
#pragma D binding "1.13" AF_HYLINK
|
||||
inline int AF_HYLINK = 15; /* NSC Hyperchannel */
|
||||
#pragma D binding "1.13" AF_APPLETALK
|
||||
inline int AF_APPLETALK = 16; /* Apple Talk */
|
||||
#pragma D binding "1.13" AF_ROUTE
|
||||
inline int AF_ROUTE = 17; /* Internal Routing Protocol */
|
||||
#pragma D binding "1.13" AF_LINK
|
||||
inline int AF_LINK = 18; /* Link layer interface */
|
||||
#pragma D binding "1.13" pseudo_AF_XTP
|
||||
inline int pseudo_AF_XTP = 19; /* eXpress Transfer Protocol (no AF) */
|
||||
#pragma D binding "1.13" AF_COIP
|
||||
inline int AF_COIP = 20; /* connection-oriented IP, aka ST II */
|
||||
#pragma D binding "1.13" AF_CNT
|
||||
inline int AF_CNT = 21; /* Computer Network Technology */
|
||||
#pragma D binding "1.13" pseudo_AF_RTIP
|
||||
inline int pseudo_AF_RTIP = 22; /* Help Identify RTIP packets */
|
||||
#pragma D binding "1.13" AF_IPX
|
||||
inline int AF_IPX = 23; /* Novell Internet Protocol */
|
||||
#pragma D binding "1.13" AF_SIP
|
||||
inline int AF_SIP = 24; /* Simple Internet Protocol */
|
||||
#pragma D binding "1.13" pseudo_AF_PIP
|
||||
inline int pseudo_AF_PIP = 25; /* Help Identify PIP packets */
|
||||
#pragma D binding "1.13" AF_ISDN
|
||||
inline int AF_ISDN = 26; /* Integrated Services Digital Network*/
|
||||
#pragma D binding "1.13" AF_E164
|
||||
inline int AF_E164 = AF_ISDN; /* CCITT E.164 recommendation */
|
||||
#pragma D binding "1.13" pseudo_AF_KEY
|
||||
inline int pseudo_AF_KEY = 27; /* Internal key-management function */
|
||||
#pragma D binding "1.13" AF_INET6
|
||||
inline int AF_INET6 = 28; /* IPv6 */
|
||||
#pragma D binding "1.13" AF_NATM
|
||||
inline int AF_NATM = 29; /* native ATM access */
|
||||
#pragma D binding "1.13" AF_ATM
|
||||
inline int AF_ATM = 30; /* ATM */
|
||||
#pragma D binding "1.13" pseudo_AF_HDRCMPLT
|
||||
inline int pseudo_AF_HDRCMPLT = 31; /* Used by BPF to not rewrite headers
|
||||
* in interface output routine
|
||||
*/
|
||||
#pragma D binding "1.13" AF_NETGRAPH
|
||||
inline int AF_NETGRAPH = 32; /* Netgraph sockets */
|
||||
#pragma D binding "1.13" AF_SLOW
|
||||
inline int AF_SLOW = 33; /* 802.3ad slow protocol */
|
||||
#pragma D binding "1.13" AF_SCLUSTER
|
||||
inline int AF_SCLUSTER = 34; /* Sitara cluster protocol */
|
||||
#pragma D binding "1.13" AF_ARP
|
||||
inline int AF_ARP = 35; /* Address Resolution Protocol */
|
||||
#pragma D binding "1.13" AF_BLUETOOTH
|
||||
inline int AF_BLUETOOTH = 36; /* Bluetooth sockets */
|
||||
#pragma D binding "1.13" AF_IEEE80211
|
||||
inline int AF_IEEE80211 = 37; /* IEEE 802.11 protocol */
|
||||
#pragma D binding "1.13" AF_INET_SDP
|
||||
inline int AF_INET_SDP = 40; /* OFED Socket Direct Protocol ipv4 */
|
||||
#pragma D binding "1.13" AF_INET6_SDP
|
||||
inline int AF_INET6_SDP = 42; /* OFED Socket Direct Protocol ipv6 */
|
||||
#pragma D binding "1.13" AF_MAX
|
||||
inline int AF_MAX = 42;
|
||||
|
||||
/*
|
||||
* Protocol families, same as address families for now.
|
||||
*/
|
||||
#pragma D binding "1.13" PF_UNSPEC
|
||||
inline int PF_UNSPEC = AF_UNSPEC;
|
||||
#pragma D binding "1.13" PF_LOCAL
|
||||
inline int PF_LOCAL = AF_LOCAL;
|
||||
#pragma D binding "1.13" PF_UNIX
|
||||
inline int PF_UNIX = PF_LOCAL; /* backward compatibility */
|
||||
#pragma D binding "1.13" PF_INET
|
||||
inline int PF_INET = AF_INET;
|
||||
#pragma D binding "1.13" PF_IMPLINK
|
||||
inline int PF_IMPLINK = AF_IMPLINK;
|
||||
#pragma D binding "1.13" PF_PUP
|
||||
inline int PF_PUP = AF_PUP;
|
||||
#pragma D binding "1.13" PF_CHAOS
|
||||
inline int PF_CHAOS = AF_CHAOS;
|
||||
#pragma D binding "1.13" PF_NETBIOS
|
||||
inline int PF_NETBIOS = AF_NETBIOS;
|
||||
#pragma D binding "1.13" PF_ISO
|
||||
inline int PF_ISO = AF_ISO;
|
||||
#pragma D binding "1.13" PF_OSI
|
||||
inline int PF_OSI = AF_ISO;
|
||||
#pragma D binding "1.13" PF_ECMA
|
||||
inline int PF_ECMA = AF_ECMA;
|
||||
#pragma D binding "1.13" PF_DATAKIT
|
||||
inline int PF_DATAKIT = AF_DATAKIT;
|
||||
#pragma D binding "1.13" PF_CCITT
|
||||
inline int PF_CCITT = AF_CCITT;
|
||||
#pragma D binding "1.13" PF_SNA
|
||||
inline int PF_SNA = AF_SNA;
|
||||
#pragma D binding "1.13" PF_DECnet
|
||||
inline int PF_DECnet = AF_DECnet;
|
||||
#pragma D binding "1.13" PF_DLI
|
||||
inline int PF_DLI = AF_DLI;
|
||||
#pragma D binding "1.13" PF_LAT
|
||||
inline int PF_LAT = AF_LAT;
|
||||
#pragma D binding "1.13" PF_HYLINK
|
||||
inline int PF_HYLINK = AF_HYLINK;
|
||||
#pragma D binding "1.13" PF_APPLETALK
|
||||
inline int PF_APPLETALK = AF_APPLETALK;
|
||||
#pragma D binding "1.13" PF_ROUTE
|
||||
inline int PF_ROUTE = AF_ROUTE;
|
||||
#pragma D binding "1.13" PF_LINK
|
||||
inline int PF_LINK = AF_LINK;
|
||||
#pragma D binding "1.13" PF_XTP
|
||||
inline int PF_XTP = pseudo_AF_XTP; /* really just proto family, no AF */
|
||||
#pragma D binding "1.13" PF_COIP
|
||||
inline int PF_COIP = AF_COIP;
|
||||
#pragma D binding "1.13" PF_CNT
|
||||
inline int PF_CNT = AF_CNT;
|
||||
#pragma D binding "1.13" PF_SIP
|
||||
inline int PF_SIP = AF_SIP;
|
||||
#pragma D binding "1.13" PF_IPX
|
||||
inline int PF_IPX = AF_IPX;
|
||||
#pragma D binding "1.13" PF_RTIP
|
||||
inline int PF_RTIP = pseudo_AF_RTIP; /* same format as AF_INET */
|
||||
#pragma D binding "1.13" PF_PIP
|
||||
inline int PF_PIP = pseudo_AF_PIP;
|
||||
#pragma D binding "1.13" PF_ISDN
|
||||
inline int PF_ISDN = AF_ISDN;
|
||||
#pragma D binding "1.13" PF_KEY
|
||||
inline int PF_KEY = pseudo_AF_KEY;
|
||||
#pragma D binding "1.13" PF_INET6
|
||||
inline int PF_INET6 = AF_INET6;
|
||||
#pragma D binding "1.13" PF_NATM
|
||||
inline int PF_NATM = AF_NATM;
|
||||
#pragma D binding "1.13" PF_ATM
|
||||
inline int PF_ATM = AF_ATM;
|
||||
#pragma D binding "1.13" PF_NETGRAPH
|
||||
inline int PF_NETGRAPH = AF_NETGRAPH;
|
||||
#pragma D binding "1.13" PF_SLOW
|
||||
inline int PF_SLOW = AF_SLOW;
|
||||
#pragma D binding "1.13" PF_SCLUSTER
|
||||
inline int PF_SCLUSTER = AF_SCLUSTER;
|
||||
#pragma D binding "1.13" PF_ARP
|
||||
inline int PF_ARP = AF_ARP;
|
||||
#pragma D binding "1.13" PF_BLUETOOTH
|
||||
inline int PF_BLUETOOTH = AF_BLUETOOTH;
|
||||
#pragma D binding "1.13" PF_IEEE80211
|
||||
inline int PF_IEEE80211 = AF_IEEE80211;
|
||||
#pragma D binding "1.13" PF_INET_SDP
|
||||
inline int PF_INET_SDP= AF_INET_SDP;
|
||||
#pragma D binding "1.13" PF_INET6_SDP
|
||||
inline int PF_INET6_SDP= AF_INET6_SDP;
|
||||
#pragma D binding "1.13" PF_MAX
|
||||
inline int PF_MAX = AF_MAX;
|
@ -1302,7 +1302,7 @@ static const unsigned char twobyte_uses_REPZ_prefix[256] = {
|
||||
/* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
|
||||
/* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
|
||||
/* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
|
||||
/* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
|
||||
/* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* af */
|
||||
/* b0 */ 0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, /* bf */
|
||||
/* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
|
||||
/* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
|
||||
@ -1793,10 +1793,10 @@ static const struct dis386 grps[][8] = {
|
||||
},
|
||||
/* GRP15 */
|
||||
{
|
||||
{ "fxsave", { Ev } },
|
||||
{ "fxrstor", { Ev } },
|
||||
{ "ldmxcsr", { Ev } },
|
||||
{ "stmxcsr", { Ev } },
|
||||
{ "fxsave", { { OP_0fae, v_mode } } },
|
||||
{ "fxrstor", { { OP_0fae, v_mode } } },
|
||||
{ "ldmxcsr", { { OP_0fae, v_mode } } },
|
||||
{ "stmxcsr", { { OP_0fae, v_mode } } },
|
||||
{ "xsave", { Ev } },
|
||||
{ "xrstor", { { OP_0fae, v_mode } } },
|
||||
{ "xsaveopt", { { OP_0fae, v_mode } } },
|
||||
@ -5996,6 +5996,8 @@ static void
|
||||
OP_0fae (int bytemode, int sizeflag)
|
||||
{
|
||||
if (modrm.mod == 3)
|
||||
{
|
||||
if (modrm.reg >= 5 && modrm.reg <= 7 && modrm.rm == 0)
|
||||
{
|
||||
if (modrm.reg == 7)
|
||||
strcpy (obuf + strlen (obuf) - sizeof ("clflush") + 1, "sfence");
|
||||
@ -6003,13 +6005,26 @@ OP_0fae (int bytemode, int sizeflag)
|
||||
strcpy (obuf + strlen (obuf) - sizeof ("xsaveopt") + 1, "mfence");
|
||||
else if (modrm.reg == 5)
|
||||
strcpy (obuf + strlen (obuf) - sizeof ("xrstor") + 1, "lfence");
|
||||
|
||||
if (modrm.reg < 5 || modrm.rm != 0)
|
||||
bytemode = 0;
|
||||
}
|
||||
else if (modrm.reg <= 3 && (prefixes & PREFIX_REPZ) != 0)
|
||||
{
|
||||
BadOp (); /* bad sfence, mfence, or lfence */
|
||||
if (modrm.reg == 0)
|
||||
strcpy (obuf + strlen (obuf) - sizeof ("fxsave") + 1, "rdfsbase");
|
||||
else if (modrm.reg == 1)
|
||||
strcpy (obuf + strlen (obuf) - sizeof ("fxrstor") + 1, "rdgsbase");
|
||||
else if (modrm.reg == 2)
|
||||
strcpy (obuf + strlen (obuf) - sizeof ("ldmxcsr") + 1, "wrfsbase");
|
||||
else if (modrm.reg == 3)
|
||||
strcpy (obuf + strlen (obuf) - sizeof ("stmxcsr") + 1, "wrgsbase");
|
||||
used_prefixes |= PREFIX_REPZ;
|
||||
bytemode = dq_mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
BadOp ();
|
||||
return;
|
||||
}
|
||||
bytemode = 0;
|
||||
}
|
||||
|
||||
OP_E (bytemode, sizeflag);
|
||||
|
@ -81,6 +81,7 @@ typedef struct template
|
||||
#define CpuPCLMUL 0x10000000 /* Carry-less Multiplication extensions */
|
||||
#define CpuRdRnd 0x20000000 /* Intel Random Number Generator extensions */
|
||||
#define CpuSMAP 0x40000000 /* Intel Supervisor Mode Access Prevention */
|
||||
#define CpuFSGSBase 0x80000000 /* Read/write fs/gs segment base registers */
|
||||
|
||||
/* SSE4.1/4.2 Instructions required */
|
||||
#define CpuSSE4 (CpuSSE4_1|CpuSSE4_2)
|
||||
@ -89,7 +90,8 @@ typedef struct template
|
||||
#define CpuUnknownFlags (Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686 \
|
||||
|CpuP4|CpuSledgehammer|CpuMMX|CpuMMX2|CpuSSE|CpuSSE2|CpuSSE3|CpuVMX \
|
||||
|Cpu3dnow|Cpu3dnowA|CpuK6|CpuPadLock|CpuSVME|CpuSSSE3|CpuSSE4_1 \
|
||||
|CpuSSE4_2|CpuABM|CpuSSE4a|CpuXSAVE|CpuAES|CpuPCLMUL|CpuRdRnd|CpuSMAP)
|
||||
|CpuSSE4_2|CpuABM|CpuSSE4a|CpuXSAVE|CpuAES|CpuPCLMUL|CpuRdRnd|CpuSMAP \
|
||||
|CpuFSGSBase)
|
||||
|
||||
/* the bits in opcode_modifier are used to generate the final opcode from
|
||||
the base_opcode. These bits also are used to detect alternate forms of
|
||||
|
@ -1525,3 +1525,13 @@ pclmulhqhqdq, 2, 0x660f3a44, 0x11, CpuPCLMUL, Modrm|IgnoreSize|No_bSuf|No_wSuf|N
|
||||
// Intel Random Number Generator extensions
|
||||
rdrand, 1, 0x0fc7, 0x6, CpuRdRnd, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf, { Reg16|Reg32|Reg64 }
|
||||
rdseed, 1, 0x0fc7, 0x7, CpuRdRnd, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf, { Reg16|Reg32|Reg64 }
|
||||
|
||||
// Intel Supervisor Mode Access Prevention extensions
|
||||
clac, 0, 0x0f01, 0xca, CpuSMAP, NoSuf|ImmExt, { 0 }
|
||||
stac, 0, 0x0f01, 0xcb, CpuSMAP, NoSuf|ImmExt, { 0 }
|
||||
|
||||
// Read/write fs/gs segment base registers
|
||||
rdfsbase, 1, 0xf30fae, 0x0, CpuFSGSBase|Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, { Reg32|Reg64 }
|
||||
rdgsbase, 1, 0xf30fae, 0x1, CpuFSGSBase|Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, { Reg32|Reg64 }
|
||||
wrfsbase, 1, 0xf30fae, 0x2, CpuFSGSBase|Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, { Reg32|Reg64 }
|
||||
wrgsbase, 1, 0xf30fae, 0x3, CpuFSGSBase|Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, { Reg32|Reg64 }
|
||||
|
@ -4401,6 +4401,20 @@ const template i386_optab[] =
|
||||
{"stac", 0, 0x0f01, 0xcb, CpuSMAP,
|
||||
NoSuf|ImmExt, { 0, 0, 0 } },
|
||||
|
||||
/* Read/write fs/gs segment base registers */
|
||||
{"rdfsbase", 1, 0xf30fae, 0x0, CpuFSGSBase|Cpu64,
|
||||
Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf,
|
||||
{ Reg32|Reg64 } },
|
||||
{"rdgsbase", 1, 0xf30fae, 0x1, CpuFSGSBase|Cpu64,
|
||||
Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf,
|
||||
{ Reg32|Reg64 } },
|
||||
{"wrfsbase", 1, 0xf30fae, 0x2, CpuFSGSBase|Cpu64,
|
||||
Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf,
|
||||
{ Reg32|Reg64 } },
|
||||
{"wrgsbase", 1, 0xf30fae, 0x3, CpuFSGSBase|Cpu64,
|
||||
Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf,
|
||||
{ Reg32|Reg64 } },
|
||||
|
||||
{ NULL, 0, 0, 0, 0, 0, { 0 } }
|
||||
};
|
||||
|
||||
|
@ -509,7 +509,7 @@ do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
|
||||
size_t noff, size_t doff, int *flags)
|
||||
{
|
||||
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
|
||||
type == NT_GNU_BUILD_ID && (descsz >= 4 || descsz <= 20)) {
|
||||
type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) {
|
||||
uint8_t desc[20];
|
||||
const char *btype;
|
||||
uint32_t i;
|
||||
|
@ -801,7 +801,8 @@ class SDNode : public FoldingSetNode, public ilist_node<SDNode> {
|
||||
/// if DAG changes.
|
||||
static bool hasPredecessorHelper(const SDNode *N,
|
||||
SmallPtrSetImpl<const SDNode *> &Visited,
|
||||
SmallVectorImpl<const SDNode *> &Worklist) {
|
||||
SmallVectorImpl<const SDNode *> &Worklist,
|
||||
unsigned int MaxSteps = 0) {
|
||||
if (Visited.count(N))
|
||||
return true;
|
||||
while (!Worklist.empty()) {
|
||||
@ -816,6 +817,8 @@ class SDNode : public FoldingSetNode, public ilist_node<SDNode> {
|
||||
}
|
||||
if (Found)
|
||||
return true;
|
||||
if (MaxSteps != 0 && Visited.size() >= MaxSteps)
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "postdomtree"
|
||||
|
||||
template class llvm::DominatorTreeBase<BasicBlock, true>; // PostDomTreeBase
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// PostDominatorTree Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -1118,22 +1118,30 @@ SDValue DAGCombiner::PromoteIntBinOp(SDValue Op) {
|
||||
SDValue RV =
|
||||
DAG.getNode(ISD::TRUNCATE, DL, VT, DAG.getNode(Opc, DL, PVT, NN0, NN1));
|
||||
|
||||
// New replace instances of N0 and N1
|
||||
if (Replace0 && N0 && N0.getOpcode() != ISD::DELETED_NODE && NN0 &&
|
||||
NN0.getOpcode() != ISD::DELETED_NODE) {
|
||||
// We are always replacing N0/N1's use in N and only need
|
||||
// additional replacements if there are additional uses.
|
||||
Replace0 &= !N0->hasOneUse();
|
||||
Replace1 &= (N0 != N1) && !N1->hasOneUse();
|
||||
|
||||
// Combine Op here so it is presreved past replacements.
|
||||
CombineTo(Op.getNode(), RV);
|
||||
|
||||
// If operands have a use ordering, make sur we deal with
|
||||
// predecessor first.
|
||||
if (Replace0 && Replace1 && N0.getNode()->isPredecessorOf(N1.getNode())) {
|
||||
std::swap(N0, N1);
|
||||
std::swap(NN0, NN1);
|
||||
}
|
||||
|
||||
if (Replace0) {
|
||||
AddToWorklist(NN0.getNode());
|
||||
ReplaceLoadWithPromotedLoad(N0.getNode(), NN0.getNode());
|
||||
}
|
||||
|
||||
if (Replace1 && N1 && N1.getOpcode() != ISD::DELETED_NODE && NN1 &&
|
||||
NN1.getOpcode() != ISD::DELETED_NODE) {
|
||||
if (Replace1) {
|
||||
AddToWorklist(NN1.getNode());
|
||||
ReplaceLoadWithPromotedLoad(N1.getNode(), NN1.getNode());
|
||||
}
|
||||
|
||||
// Deal with Op being deleted.
|
||||
if (Op && Op.getOpcode() != ISD::DELETED_NODE)
|
||||
return RV;
|
||||
return Op;
|
||||
}
|
||||
return SDValue();
|
||||
}
|
||||
@ -12599,25 +12607,37 @@ void DAGCombiner::getStoreMergeCandidates(
|
||||
}
|
||||
}
|
||||
|
||||
// We need to check that merging these stores does not cause a loop
|
||||
// in the DAG. Any store candidate may depend on another candidate
|
||||
// We need to check that merging these stores does not cause a loop in
|
||||
// the DAG. Any store candidate may depend on another candidate
|
||||
// indirectly through its operand (we already consider dependencies
|
||||
// through the chain). Check in parallel by searching up from
|
||||
// non-chain operands of candidates.
|
||||
|
||||
bool DAGCombiner::checkMergeStoreCandidatesForDependencies(
|
||||
SmallVectorImpl<MemOpLink> &StoreNodes, unsigned NumStores) {
|
||||
|
||||
// FIXME: We should be able to truncate a full search of
|
||||
// predecessors by doing a BFS and keeping tabs the originating
|
||||
// stores from which worklist nodes come from in a similar way to
|
||||
// TokenFactor simplfication.
|
||||
|
||||
SmallPtrSet<const SDNode *, 16> Visited;
|
||||
SmallVector<const SDNode *, 8> Worklist;
|
||||
// search ops of store candidates
|
||||
unsigned int Max = 8192;
|
||||
// Search Ops of store candidates.
|
||||
for (unsigned i = 0; i < NumStores; ++i) {
|
||||
SDNode *n = StoreNodes[i].MemNode;
|
||||
// Potential loops may happen only through non-chain operands
|
||||
for (unsigned j = 1; j < n->getNumOperands(); ++j)
|
||||
Worklist.push_back(n->getOperand(j).getNode());
|
||||
}
|
||||
// search through DAG. We can stop early if we find a storenode
|
||||
// Search through DAG. We can stop early if we find a store node.
|
||||
for (unsigned i = 0; i < NumStores; ++i) {
|
||||
if (SDNode::hasPredecessorHelper(StoreNodes[i].MemNode, Visited, Worklist))
|
||||
if (SDNode::hasPredecessorHelper(StoreNodes[i].MemNode, Visited, Worklist,
|
||||
Max))
|
||||
return false;
|
||||
// Check if we ended early, failing conservatively if so.
|
||||
if (Visited.size() >= Max)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -30942,11 +30942,40 @@ static bool checkBoolTestAndOrSetCCCombine(SDValue Cond, X86::CondCode &CC0,
|
||||
return true;
|
||||
}
|
||||
|
||||
// When legalizing carry, we create carries via add X, -1
|
||||
// If that comes from an actual carry, via setcc, we use the
|
||||
// carry directly.
|
||||
static SDValue combineCarryThroughADD(SDValue EFLAGS) {
|
||||
if (EFLAGS.getOpcode() == X86ISD::ADD) {
|
||||
if (isAllOnesConstant(EFLAGS.getOperand(1))) {
|
||||
SDValue Carry = EFLAGS.getOperand(0);
|
||||
while (Carry.getOpcode() == ISD::TRUNCATE ||
|
||||
Carry.getOpcode() == ISD::ZERO_EXTEND ||
|
||||
Carry.getOpcode() == ISD::SIGN_EXTEND ||
|
||||
Carry.getOpcode() == ISD::ANY_EXTEND ||
|
||||
(Carry.getOpcode() == ISD::AND &&
|
||||
isOneConstant(Carry.getOperand(1))))
|
||||
Carry = Carry.getOperand(0);
|
||||
if (Carry.getOpcode() == X86ISD::SETCC ||
|
||||
Carry.getOpcode() == X86ISD::SETCC_CARRY) {
|
||||
if (Carry.getConstantOperandVal(0) == X86::COND_B)
|
||||
return Carry.getOperand(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
/// Optimize an EFLAGS definition used according to the condition code \p CC
|
||||
/// into a simpler EFLAGS value, potentially returning a new \p CC and replacing
|
||||
/// uses of chain values.
|
||||
static SDValue combineSetCCEFLAGS(SDValue EFLAGS, X86::CondCode &CC,
|
||||
SelectionDAG &DAG) {
|
||||
if (CC == X86::COND_B)
|
||||
if (SDValue Flags = combineCarryThroughADD(EFLAGS))
|
||||
return Flags;
|
||||
|
||||
if (SDValue R = checkBoolTestSetCCCombine(EFLAGS, CC))
|
||||
return R;
|
||||
return combineSetCCAtomicArith(EFLAGS, CC, DAG);
|
||||
@ -34989,27 +35018,13 @@ static SDValue combineSIntToFP(SDNode *N, SelectionDAG &DAG,
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
// Optimize RES, EFLAGS = X86ISD::ADD LHS, RHS
|
||||
static SDValue combineX86ADD(SDNode *N, SelectionDAG &DAG,
|
||||
X86TargetLowering::DAGCombinerInfo &DCI) {
|
||||
// When legalizing carry, we create carries via add X, -1
|
||||
// If that comes from an actual carry, via setcc, we use the
|
||||
// carry directly.
|
||||
if (isAllOnesConstant(N->getOperand(1)) && N->hasAnyUseOfValue(1)) {
|
||||
SDValue Carry = N->getOperand(0);
|
||||
while (Carry.getOpcode() == ISD::TRUNCATE ||
|
||||
Carry.getOpcode() == ISD::ZERO_EXTEND ||
|
||||
Carry.getOpcode() == ISD::SIGN_EXTEND ||
|
||||
Carry.getOpcode() == ISD::ANY_EXTEND ||
|
||||
(Carry.getOpcode() == ISD::AND &&
|
||||
isOneConstant(Carry.getOperand(1))))
|
||||
Carry = Carry.getOperand(0);
|
||||
|
||||
if (Carry.getOpcode() == X86ISD::SETCC ||
|
||||
Carry.getOpcode() == X86ISD::SETCC_CARRY) {
|
||||
if (Carry.getConstantOperandVal(0) == X86::COND_B)
|
||||
return DCI.CombineTo(N, SDValue(N, 0), Carry.getOperand(1));
|
||||
}
|
||||
static SDValue combineSBB(SDNode *N, SelectionDAG &DAG) {
|
||||
if (SDValue Flags = combineCarryThroughADD(N->getOperand(2))) {
|
||||
MVT VT = N->getSimpleValueType(0);
|
||||
SDVTList VTs = DAG.getVTList(VT, MVT::i32);
|
||||
return DAG.getNode(X86ISD::SBB, SDLoc(N), VTs,
|
||||
N->getOperand(0), N->getOperand(1),
|
||||
Flags);
|
||||
}
|
||||
|
||||
return SDValue();
|
||||
@ -35038,6 +35053,14 @@ static SDValue combineADC(SDNode *N, SelectionDAG &DAG,
|
||||
return DCI.CombineTo(N, Res1, CarryOut);
|
||||
}
|
||||
|
||||
if (SDValue Flags = combineCarryThroughADD(N->getOperand(2))) {
|
||||
MVT VT = N->getSimpleValueType(0);
|
||||
SDVTList VTs = DAG.getVTList(VT, MVT::i32);
|
||||
return DAG.getNode(X86ISD::ADC, SDLoc(N), VTs,
|
||||
N->getOperand(0), N->getOperand(1),
|
||||
Flags);
|
||||
}
|
||||
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
@ -35677,7 +35700,7 @@ SDValue X86TargetLowering::PerformDAGCombine(SDNode *N,
|
||||
case X86ISD::CMOV: return combineCMov(N, DAG, DCI, Subtarget);
|
||||
case ISD::ADD: return combineAdd(N, DAG, Subtarget);
|
||||
case ISD::SUB: return combineSub(N, DAG, Subtarget);
|
||||
case X86ISD::ADD: return combineX86ADD(N, DAG, DCI);
|
||||
case X86ISD::SBB: return combineSBB(N, DAG);
|
||||
case X86ISD::ADC: return combineADC(N, DAG, DCI);
|
||||
case ISD::MUL: return combineMul(N, DAG, DCI, Subtarget);
|
||||
case ISD::SHL:
|
||||
|
@ -2028,7 +2028,10 @@ class CXXMethodDecl : public FunctionDecl {
|
||||
|
||||
/// \brief Returns the type of the \c this pointer.
|
||||
///
|
||||
/// Should only be called for instance (i.e., non-static) methods.
|
||||
/// Should only be called for instance (i.e., non-static) methods. Note
|
||||
/// that for the call operator of a lambda closure type, this returns the
|
||||
/// desugared 'this' type (a pointer to the closure type), not the captured
|
||||
/// 'this' type.
|
||||
QualType getThisType(ASTContext &C) const;
|
||||
|
||||
unsigned getTypeQualifiers() const {
|
||||
|
@ -694,6 +694,9 @@ def fbuiltin : Flag<["-"], "fbuiltin">, Group<f_Group>;
|
||||
def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group<f_Group>,
|
||||
Flags<[DriverOption]>, HelpText<"Load the clang builtins module map file.">;
|
||||
def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">, Group<f_Group>;
|
||||
def fclang_abi_compat_EQ : Joined<["-"], "fclang-abi-compat=">, Group<f_clang_Group>,
|
||||
Flags<[CC1Option]>, MetaVarName<"<version>">, Values<"<major>.<minor>,latest">,
|
||||
HelpText<"Attempt to match the ABI of Clang <version>">;
|
||||
def fclasspath_EQ : Joined<["-"], "fclasspath=">, Group<f_Group>;
|
||||
def fcolor_diagnostics : Flag<["-"], "fcolor-diagnostics">, Group<f_Group>,
|
||||
Flags<[CoreOption, CC1Option]>, HelpText<"Use colors in diagnostics">;
|
||||
|
@ -120,6 +120,10 @@ CODEGENOPT(NoZeroInitializedInBSS , 1, 0) ///< -fno-zero-initialized-in-bss.
|
||||
ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy)
|
||||
CODEGENOPT(OmitLeafFramePointer , 1, 0) ///< Set when -momit-leaf-frame-pointer is
|
||||
///< enabled.
|
||||
|
||||
/// A version of Clang that we should attempt to be ABI-compatible with.
|
||||
ENUM_CODEGENOPT(ClangABICompat, ClangABI, 4, ClangABI::Latest)
|
||||
|
||||
VALUE_CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option specified.
|
||||
VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified.
|
||||
|
||||
|
@ -69,6 +69,23 @@ class CodeGenOptions : public CodeGenOptionsBase {
|
||||
LocalExecTLSModel
|
||||
};
|
||||
|
||||
/// Clang versions with different platform ABI conformance.
|
||||
enum class ClangABI {
|
||||
/// Attempt to be ABI-compatible with code generated by Clang 3.8.x
|
||||
/// (SVN r257626). This causes <1 x long long> to be passed in an
|
||||
/// integer register instead of an SSE register on x64_64.
|
||||
Ver3_8,
|
||||
|
||||
/// Attempt to be ABI-compatible with code generated by Clang 4.0.x
|
||||
/// (SVN r291814). This causes move operations to be ignored when
|
||||
/// determining whether a class type can be passed or returned directly.
|
||||
Ver4,
|
||||
|
||||
/// Conform to the underlying platform's C and C++ ABIs as closely
|
||||
/// as we can.
|
||||
Latest
|
||||
};
|
||||
|
||||
enum StructReturnConventionKind {
|
||||
SRCK_Default, // No special option was passed.
|
||||
SRCK_OnStack, // Small structs on the stack (-fpcc-struct-return).
|
||||
|
@ -36,7 +36,7 @@ std::string getClangRepositoryPath() {
|
||||
|
||||
// If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us
|
||||
// pick up a tag in an SVN export, for example.
|
||||
StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_50/lib/Basic/Version.cpp $");
|
||||
StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_500/final/lib/Basic/Version.cpp $");
|
||||
if (URL.empty()) {
|
||||
URL = SVNRepository.slice(SVNRepository.find(':'),
|
||||
SVNRepository.find("/lib/Basic"));
|
||||
|
@ -24,6 +24,7 @@ namespace llvm {
|
||||
|
||||
namespace clang {
|
||||
class ASTContext;
|
||||
class CodeGenOptions;
|
||||
class TargetInfo;
|
||||
|
||||
namespace CodeGen {
|
||||
@ -68,6 +69,7 @@ namespace swiftcall {
|
||||
llvm::LLVMContext &getVMContext() const;
|
||||
const llvm::DataLayout &getDataLayout() const;
|
||||
const TargetInfo &getTarget() const;
|
||||
const CodeGenOptions &getCodeGenOpts() const;
|
||||
|
||||
/// Return the calling convention to use for system runtime
|
||||
/// functions.
|
||||
|
@ -3260,7 +3260,7 @@ void CGDebugInfo::EmitInlineFunctionStart(CGBuilderTy &Builder, GlobalDecl GD) {
|
||||
llvm::DISubprogram *SP = nullptr;
|
||||
if (FI != SPCache.end())
|
||||
SP = dyn_cast_or_null<llvm::DISubprogram>(FI->second);
|
||||
if (!SP)
|
||||
if (!SP || !SP->isDefinition())
|
||||
SP = getFunctionStub(GD);
|
||||
FnBeginRegionCount.push_back(LexicalBlockStack.size());
|
||||
LexicalBlockStack.emplace_back(SP);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "CodeGenPGO.h"
|
||||
#include "TargetInfo.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/ASTLambda.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclCXX.h"
|
||||
#include "clang/AST/StmtCXX.h"
|
||||
@ -983,11 +984,22 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
|
||||
}
|
||||
|
||||
// Check the 'this' pointer once per function, if it's available.
|
||||
if (CXXThisValue) {
|
||||
if (CXXABIThisValue) {
|
||||
SanitizerSet SkippedChecks;
|
||||
SkippedChecks.set(SanitizerKind::ObjectSize, true);
|
||||
QualType ThisTy = MD->getThisType(getContext());
|
||||
EmitTypeCheck(TCK_Load, Loc, CXXThisValue, ThisTy,
|
||||
|
||||
// If this is the call operator of a lambda with no capture-default, it
|
||||
// may have a static invoker function, which may call this operator with
|
||||
// a null 'this' pointer.
|
||||
if (isLambdaCallOperator(MD) &&
|
||||
cast<CXXRecordDecl>(MD->getParent())->getLambdaCaptureDefault() ==
|
||||
LCD_None)
|
||||
SkippedChecks.set(SanitizerKind::Null, true);
|
||||
|
||||
EmitTypeCheck(isa<CXXConstructorDecl>(MD) ? TCK_ConstructorCall
|
||||
: TCK_MemberCall,
|
||||
Loc, CXXABIThisValue, ThisTy,
|
||||
getContext().getTypeAlignInChars(ThisTy->getPointeeType()),
|
||||
SkippedChecks);
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ CodeGenTypes::~CodeGenTypes() {
|
||||
delete &*I++;
|
||||
}
|
||||
|
||||
const CodeGenOptions &CodeGenTypes::getCodeGenOpts() const {
|
||||
return CGM.getCodeGenOpts();
|
||||
}
|
||||
|
||||
void CodeGenTypes::addRecordTypeName(const RecordDecl *RD,
|
||||
llvm::StructType *Ty,
|
||||
StringRef suffix) {
|
||||
|
@ -178,6 +178,7 @@ class CodeGenTypes {
|
||||
const TargetInfo &getTarget() const { return Target; }
|
||||
CGCXXABI &getCXXABI() const { return TheCXXABI; }
|
||||
llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); }
|
||||
const CodeGenOptions &getCodeGenOpts() const;
|
||||
|
||||
/// ConvertType - Convert type T into a llvm::Type.
|
||||
llvm::Type *ConvertType(QualType T);
|
||||
|
@ -62,9 +62,20 @@ class ItaniumCXXABI : public CodeGen::CGCXXABI {
|
||||
|
||||
bool classifyReturnType(CGFunctionInfo &FI) const override;
|
||||
|
||||
bool passClassIndirect(const CXXRecordDecl *RD) const {
|
||||
// Clang <= 4 used the pre-C++11 rule, which ignores move operations.
|
||||
// The PS4 platform ABI follows the behavior of Clang 3.2.
|
||||
if (CGM.getCodeGenOpts().getClangABICompat() <=
|
||||
CodeGenOptions::ClangABI::Ver4 ||
|
||||
CGM.getTriple().getOS() == llvm::Triple::PS4)
|
||||
return RD->hasNonTrivialDestructor() ||
|
||||
RD->hasNonTrivialCopyConstructor();
|
||||
return !canCopyArgument(RD);
|
||||
}
|
||||
|
||||
RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const override {
|
||||
// If C++ prohibits us from making a copy, pass by address.
|
||||
if (!canCopyArgument(RD))
|
||||
if (passClassIndirect(RD))
|
||||
return RAA_Indirect;
|
||||
return RAA_Default;
|
||||
}
|
||||
@ -996,7 +1007,7 @@ bool ItaniumCXXABI::classifyReturnType(CGFunctionInfo &FI) const {
|
||||
return false;
|
||||
|
||||
// If C++ prohibits us from making a copy, return by address.
|
||||
if (!canCopyArgument(RD)) {
|
||||
if (passClassIndirect(RD)) {
|
||||
auto Align = CGM.getContext().getTypeAlignInChars(FI.getReturnType());
|
||||
FI.getReturnInfo() = ABIArgInfo::getIndirect(Align, /*ByVal=*/false);
|
||||
return true;
|
||||
|
@ -183,7 +183,11 @@ const TargetInfo &ABIInfo::getTarget() const {
|
||||
return CGT.getTarget();
|
||||
}
|
||||
|
||||
bool ABIInfo:: isAndroid() const { return getTarget().getTriple().isAndroid(); }
|
||||
const CodeGenOptions &ABIInfo::getCodeGenOpts() const {
|
||||
return CGT.getCodeGenOpts();
|
||||
}
|
||||
|
||||
bool ABIInfo::isAndroid() const { return getTarget().getTriple().isAndroid(); }
|
||||
|
||||
bool ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const {
|
||||
return false;
|
||||
@ -2095,9 +2099,14 @@ class X86_64ABIInfo : public SwiftABIInfo {
|
||||
return !getTarget().getTriple().isOSDarwin();
|
||||
}
|
||||
|
||||
/// GCC classifies <1 x long long> as SSE but compatibility with older clang
|
||||
// compilers require us to classify it as INTEGER.
|
||||
/// GCC classifies <1 x long long> as SSE but some platform ABIs choose to
|
||||
/// classify it as INTEGER (for compatibility with older clang compilers).
|
||||
bool classifyIntegerMMXAsSSE() const {
|
||||
// Clang <= 3.8 did not do this.
|
||||
if (getCodeGenOpts().getClangABICompat() <=
|
||||
CodeGenOptions::ClangABI::Ver3_8)
|
||||
return false;
|
||||
|
||||
const llvm::Triple &Triple = getTarget().getTriple();
|
||||
if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::PS4)
|
||||
return false;
|
||||
|
@ -2855,6 +2855,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
||||
addPGOAndCoverageFlags(C, D, Output, Args, CmdArgs);
|
||||
|
||||
if (auto *ABICompatArg = Args.getLastArg(options::OPT_fclang_abi_compat_EQ))
|
||||
ABICompatArg->render(Args, CmdArgs);
|
||||
|
||||
// Add runtime flag for PS4 when PGO or Coverage are enabled.
|
||||
if (getToolChain().getTriple().isPS4CPU())
|
||||
PS4cpu::addProfileRTArgs(getToolChain(), Args, CmdArgs);
|
||||
|
@ -246,12 +246,12 @@ AlignTokenSequence(unsigned Start, unsigned End, unsigned Column, F &&Matches,
|
||||
|
||||
for (unsigned i = Start; i != End; ++i) {
|
||||
if (ScopeStack.size() != 0 &&
|
||||
Changes[i].nestingAndIndentLevel() <
|
||||
Changes[ScopeStack.back()].nestingAndIndentLevel())
|
||||
Changes[i].indentAndNestingLevel() <
|
||||
Changes[ScopeStack.back()].indentAndNestingLevel())
|
||||
ScopeStack.pop_back();
|
||||
|
||||
if (i != Start && Changes[i].nestingAndIndentLevel() >
|
||||
Changes[i - 1].nestingAndIndentLevel())
|
||||
if (i != Start && Changes[i].indentAndNestingLevel() >
|
||||
Changes[i - 1].indentAndNestingLevel())
|
||||
ScopeStack.push_back(i);
|
||||
|
||||
bool InsideNestedScope = ScopeStack.size() != 0;
|
||||
@ -327,8 +327,8 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
|
||||
|
||||
// Measure the scope level (i.e. depth of (), [], {}) of the first token, and
|
||||
// abort when we hit any token in a higher scope than the starting one.
|
||||
auto NestingAndIndentLevel = StartAt < Changes.size()
|
||||
? Changes[StartAt].nestingAndIndentLevel()
|
||||
auto IndentAndNestingLevel = StartAt < Changes.size()
|
||||
? Changes[StartAt].indentAndNestingLevel()
|
||||
: std::pair<unsigned, unsigned>(0, 0);
|
||||
|
||||
// Keep track of the number of commas before the matching tokens, we will only
|
||||
@ -359,7 +359,7 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
|
||||
|
||||
unsigned i = StartAt;
|
||||
for (unsigned e = Changes.size(); i != e; ++i) {
|
||||
if (Changes[i].nestingAndIndentLevel() < NestingAndIndentLevel)
|
||||
if (Changes[i].indentAndNestingLevel() < IndentAndNestingLevel)
|
||||
break;
|
||||
|
||||
if (Changes[i].NewlinesBefore != 0) {
|
||||
@ -375,7 +375,7 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
|
||||
|
||||
if (Changes[i].Tok->is(tok::comma)) {
|
||||
++CommasBeforeMatch;
|
||||
} else if (Changes[i].nestingAndIndentLevel() > NestingAndIndentLevel) {
|
||||
} else if (Changes[i].indentAndNestingLevel() > IndentAndNestingLevel) {
|
||||
// Call AlignTokens recursively, skipping over this scope block.
|
||||
unsigned StoppedAt = AlignTokens(Style, Matches, Changes, i);
|
||||
i = StoppedAt - 1;
|
||||
|
@ -154,12 +154,11 @@ class WhitespaceManager {
|
||||
const Change *StartOfBlockComment;
|
||||
int IndentationOffset;
|
||||
|
||||
// A combination of nesting level and indent level, which are used in
|
||||
// A combination of indent level and nesting level, which are used in
|
||||
// tandem to compute lexical scope, for the purposes of deciding
|
||||
// when to stop consecutive alignment runs.
|
||||
std::pair<unsigned, unsigned>
|
||||
nestingAndIndentLevel() const {
|
||||
return std::make_pair(Tok->NestingLevel, Tok->IndentLevel);
|
||||
std::pair<unsigned, unsigned> indentAndNestingLevel() const {
|
||||
return std::make_pair(Tok->IndentLevel, Tok->NestingLevel);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -573,6 +573,33 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
|
||||
if (!Opts.ProfileInstrumentUsePath.empty())
|
||||
setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath);
|
||||
|
||||
if (Arg *A = Args.getLastArg(OPT_fclang_abi_compat_EQ)) {
|
||||
Opts.setClangABICompat(CodeGenOptions::ClangABI::Latest);
|
||||
|
||||
StringRef Ver = A->getValue();
|
||||
std::pair<StringRef, StringRef> VerParts = Ver.split('.');
|
||||
unsigned Major, Minor = 0;
|
||||
|
||||
// Check the version number is valid: either 3.x (0 <= x <= 9) or
|
||||
// y or y.0 (4 <= y <= current version).
|
||||
if (!VerParts.first.startswith("0") &&
|
||||
!VerParts.first.getAsInteger(10, Major) &&
|
||||
3 <= Major && Major <= CLANG_VERSION_MAJOR &&
|
||||
(Major == 3 ? VerParts.second.size() == 1 &&
|
||||
!VerParts.second.getAsInteger(10, Minor)
|
||||
: VerParts.first.size() == Ver.size() ||
|
||||
VerParts.second == "0")) {
|
||||
// Got a valid version number.
|
||||
if (Major == 3 && Minor <= 8)
|
||||
Opts.setClangABICompat(CodeGenOptions::ClangABI::Ver3_8);
|
||||
else if (Major <= 4)
|
||||
Opts.setClangABICompat(CodeGenOptions::ClangABI::Ver4);
|
||||
} else if (Ver != "latest") {
|
||||
Diags.Report(diag::err_drv_invalid_value)
|
||||
<< A->getAsString(Args) << A->getValue();
|
||||
}
|
||||
}
|
||||
|
||||
Opts.CoverageMapping =
|
||||
Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping, false);
|
||||
Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping);
|
||||
|
@ -198,9 +198,14 @@ Status TCPSocket::Listen(llvm::StringRef name, int backlog) {
|
||||
::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
|
||||
sizeof(option_value));
|
||||
|
||||
address.SetPort(port);
|
||||
SocketAddress listen_address = address;
|
||||
if(!listen_address.IsLocalhost())
|
||||
listen_address.SetToAnyAddress(address.GetFamily(), port);
|
||||
else
|
||||
listen_address.SetPort(port);
|
||||
|
||||
int err = ::bind(fd, &address.sockaddr(), address.GetLength());
|
||||
int err =
|
||||
::bind(fd, &listen_address.sockaddr(), listen_address.GetLength());
|
||||
if (-1 != err)
|
||||
err = ::listen(fd, backlog);
|
||||
|
||||
|
@ -1571,6 +1571,11 @@ key_matches_a_ds(struct module_env* env, struct val_env* ve,
|
||||
verbose(VERB_ALGO, "DS match attempt failed");
|
||||
continue;
|
||||
}
|
||||
/* match of hash is sufficient for bootstrap of trust point */
|
||||
(void)reason;
|
||||
(void)ve;
|
||||
return 1;
|
||||
/* no need to check RRSIG, DS hash already matched with source
|
||||
if(dnskey_verify_rrset(env, ve, dnskey_rrset,
|
||||
dnskey_rrset, key_idx, &reason) == sec_status_secure) {
|
||||
return 1;
|
||||
@ -1578,6 +1583,7 @@ key_matches_a_ds(struct module_env* env, struct val_env* ve,
|
||||
verbose(VERB_ALGO, "DS match failed because the key "
|
||||
"does not verify the keyset: %s", reason);
|
||||
}
|
||||
*/
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
bin
|
||||
cat
|
||||
..
|
||||
chflags
|
||||
..
|
||||
chmod
|
||||
..
|
||||
date
|
||||
@ -22,6 +24,8 @@
|
||||
..
|
||||
ls
|
||||
..
|
||||
mkdir
|
||||
..
|
||||
mv
|
||||
..
|
||||
pax
|
||||
@ -30,6 +34,10 @@
|
||||
..
|
||||
pwait
|
||||
..
|
||||
rcp
|
||||
..
|
||||
rmdir
|
||||
..
|
||||
sh
|
||||
builtins
|
||||
..
|
||||
|
@ -8,4 +8,4 @@
|
||||
|
||||
#define CLANG_VENDOR "FreeBSD "
|
||||
|
||||
#define SVN_REVISION "311606"
|
||||
#define SVN_REVISION "312559"
|
||||
|
@ -4,5 +4,5 @@
|
||||
#define LLD_VERSION_STRING "5.0.0"
|
||||
#define LLD_VERSION_MAJOR 5
|
||||
#define LLD_VERSION_MINOR 0
|
||||
#define LLD_REVISION_STRING "311606"
|
||||
#define LLD_REVISION_STRING "312559"
|
||||
#define LLD_REPOSITORY_STRING "FreeBSD"
|
||||
|
@ -1,2 +1,2 @@
|
||||
/* $FreeBSD$ */
|
||||
#define LLVM_REVISION "svn-r311606"
|
||||
#define LLVM_REVISION "svn-r312559"
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef __clang__
|
||||
.gnu_attribute 4, 0
|
||||
#endif
|
||||
.section .init,"ax",%progbits
|
||||
.align 4
|
||||
.globl _init
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef __clang__
|
||||
.gnu_attribute 4, 0
|
||||
#endif
|
||||
.section .init,"ax",%progbits
|
||||
.align 4
|
||||
.set noreorder
|
||||
|
@ -40,6 +40,14 @@
|
||||
#include <machine/atomic.h>
|
||||
#include "setlocale.h"
|
||||
|
||||
/**
|
||||
* The XLC_ values are indexes into the components array. They are defined in
|
||||
* the same order as the LC_ values in locale.h, but without the LC_ALL zero
|
||||
* value. Translating from LC_X to XLC_X is done by subtracting one.
|
||||
*
|
||||
* Any reordering of this enum should ensure that these invariants are not
|
||||
* violated.
|
||||
*/
|
||||
enum {
|
||||
XLC_COLLATE = 0,
|
||||
XLC_CTYPE,
|
||||
@ -50,6 +58,19 @@ enum {
|
||||
XLC_LAST
|
||||
};
|
||||
|
||||
_Static_assert(XLC_LAST - XLC_COLLATE == 6, "XLC values should be contiguous");
|
||||
_Static_assert(XLC_COLLATE == LC_COLLATE - 1,
|
||||
"XLC_COLLATE doesn't match the LC_COLLATE value.");
|
||||
_Static_assert(XLC_CTYPE == LC_CTYPE - 1,
|
||||
"XLC_CTYPE doesn't match the LC_CTYPE value.");
|
||||
_Static_assert(XLC_MONETARY == LC_MONETARY - 1,
|
||||
"XLC_MONETARY doesn't match the LC_MONETARY value.");
|
||||
_Static_assert(XLC_NUMERIC == LC_NUMERIC - 1,
|
||||
"XLC_NUMERIC doesn't match the LC_NUMERIC value.");
|
||||
_Static_assert(XLC_TIME == LC_TIME - 1,
|
||||
"XLC_TIME doesn't match the LC_TIME value.");
|
||||
_Static_assert(XLC_MESSAGES == LC_MESSAGES - 1,
|
||||
"XLC_MESSAGES doesn't match the LC_MESSAGES value.");
|
||||
|
||||
/**
|
||||
* Header used for objects that are reference counted. Objects may optionally
|
||||
|
@ -57,18 +57,12 @@ SRCF+= fixunsxfsi
|
||||
SRCF+= fixunsxfti
|
||||
SRCF+= fixxfdi
|
||||
SRCF+= fixxfti
|
||||
SRCF+= floatdidf
|
||||
SRCF+= floatdisf
|
||||
SRCF+= floatditf
|
||||
SRCF+= floatdixf
|
||||
SRCF+= floatsitf
|
||||
SRCF+= floattidf
|
||||
SRCF+= floattisf
|
||||
SRCF+= floattixf
|
||||
SRCF+= floatundidf
|
||||
SRCF+= floatundisf
|
||||
SRCF+= floatunditf
|
||||
SRCF+= floatundixf
|
||||
SRCF+= floatunsidf
|
||||
SRCF+= floatunsisf
|
||||
SRCF+= floatuntidf
|
||||
@ -128,6 +122,23 @@ SRCF+= umoddi3
|
||||
SRCF+= umodsi3
|
||||
SRCF+= umodti3
|
||||
|
||||
# Avoid using SSE2 instructions on i386, if unsupported.
|
||||
.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2)
|
||||
SRCS+= floatdidf.c
|
||||
SRCS+= floatdisf.c
|
||||
SRCS+= floatdixf.c
|
||||
SRCS+= floatundidf.c
|
||||
SRCS+= floatundisf.c
|
||||
SRCS+= floatundixf.c
|
||||
.else
|
||||
SRCF+= floatdidf
|
||||
SRCF+= floatdisf
|
||||
SRCF+= floatdixf
|
||||
SRCF+= floatundidf
|
||||
SRCF+= floatundisf
|
||||
SRCF+= floatundixf
|
||||
.endif
|
||||
|
||||
# __cpu_model support, only used on x86
|
||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
||||
SRCF+= cpu_model
|
||||
|
@ -64,4 +64,4 @@ WARNS?= 9
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
CFLAGS+= -Wno-cast-align -Wno-unused-parameter
|
||||
CFLAGS+= -fno-strict-aliasing -Wno-cast-align -Wno-unused-parameter
|
||||
|
@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "efichar.h"
|
||||
|
||||
#include "efi-osdep.h"
|
||||
#include "efivar-dp.h"
|
||||
|
||||
@ -1872,9 +1874,12 @@ DevPathToTextFilePath (
|
||||
)
|
||||
{
|
||||
FILEPATH_DEVICE_PATH *Fp;
|
||||
char *name = NULL;
|
||||
|
||||
Fp = DevPath;
|
||||
UefiDevicePathLibCatPrint (Str, "%s", Fp->PathName);
|
||||
ucs2_to_utf8(Fp->PathName, &name);
|
||||
UefiDevicePathLibCatPrint (Str, "File(%s)", name);
|
||||
free(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2425,3 +2430,9 @@ efidp_format_device_path(char *buf, size_t len, const_efidp dp, ssize_t max)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
size_t
|
||||
efidp_size(const_efidp dp)
|
||||
{
|
||||
return GetDevicePathSize(__DECONST(EFI_DEVICE_PATH_PROTOCOL *, dp));
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "efichar.h"
|
||||
|
||||
#include "efi-osdep.h"
|
||||
#include "efivar-dp.h"
|
||||
|
||||
@ -3031,21 +3033,15 @@ DevPathFromTextFilePath (
|
||||
|
||||
StrCpyS (File->PathName, StrLen (TextDeviceNode) + 1, TextDeviceNode);
|
||||
#else
|
||||
size_t len = (sizeof (FILEPATH_DEVICE_PATH) + StrLen (TextDeviceNode) * 2);
|
||||
efi_char * v;
|
||||
File = (FILEPATH_DEVICE_PATH *) CreateDeviceNode (
|
||||
MEDIA_DEVICE_PATH,
|
||||
MEDIA_FILEPATH_DP,
|
||||
(UINT16) (sizeof (FILEPATH_DEVICE_PATH) + StrLen (TextDeviceNode) + 1)
|
||||
(UINT16)len
|
||||
);
|
||||
|
||||
/*
|
||||
* Note: We'd have to change the Tianocore header files to fix this
|
||||
* to not need a cast. Instead we just cast it here. The Interface
|
||||
* to the user may have issues since this won't be a UCS-2
|
||||
* string. Also note that in the original code, a NUL wasn't
|
||||
* allocated for the end of the string, but we copy that below. This
|
||||
* has been corrected.
|
||||
*/
|
||||
StrCpyS ((char *)File->PathName, StrLen (TextDeviceNode) + 1, TextDeviceNode);
|
||||
v = File->PathName;
|
||||
utf8_to_ucs2(TextDeviceNode, &v, &len);
|
||||
#endif
|
||||
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *) File;
|
||||
@ -3560,6 +3556,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
|
||||
{"Media", DevPathFromTextMedia },
|
||||
{"Fv", DevPathFromTextFv },
|
||||
{"FvFile", DevPathFromTextFvFile },
|
||||
{"File", DevPathFromTextFilePath },
|
||||
{"Offset", DevPathFromTextRelativeOffsetRange },
|
||||
{"RamDisk", DevPathFromTextRamDisk },
|
||||
{"VirtualDisk", DevPathFromTextVirtualDisk },
|
||||
|
@ -62,4 +62,6 @@ ssize_t efidp_format_device_path(char *buf, size_t len, const_efidp dp,
|
||||
ssize_t max);
|
||||
ssize_t efidp_parse_device_path(char *path, efidp out, size_t max);
|
||||
|
||||
size_t efidp_size(const_efidp);
|
||||
|
||||
#endif /* _EFIVAR_DP_H_ */
|
||||
|
@ -56,8 +56,6 @@ g_open(const char *name, int dowrite)
|
||||
path = g_device_path_open(name, &fd, dowrite);
|
||||
if (path != NULL)
|
||||
free(path);
|
||||
if (fd == -1)
|
||||
return (-1);
|
||||
return (fd);
|
||||
}
|
||||
|
||||
@ -281,33 +279,21 @@ g_device_path_open(const char *devpath, int *fdp, int dowrite)
|
||||
/* Make sure that we can fail. */
|
||||
if (fdp != NULL)
|
||||
*fdp = -1;
|
||||
|
||||
/* Use the device node if we're able to open it. */
|
||||
do {
|
||||
fd = open(devpath, dowrite ? O_RDWR : O_RDONLY);
|
||||
if (fd == -1)
|
||||
break;
|
||||
/*
|
||||
* Let try to get sectorsize, which will prove it is a GEOM
|
||||
* provider.
|
||||
*/
|
||||
if (g_sectorsize(fd) == -1) {
|
||||
close(fd);
|
||||
errno = EFTYPE;
|
||||
return (NULL);
|
||||
}
|
||||
if (fd != -1) {
|
||||
if ((path = strdup(devpath)) == NULL) {
|
||||
close(fd);
|
||||
return (NULL);
|
||||
}
|
||||
if (fdp != NULL)
|
||||
*fdp = fd;
|
||||
else
|
||||
close(fd);
|
||||
return (path);
|
||||
} while (0);
|
||||
goto fd_ok;
|
||||
}
|
||||
|
||||
/* If we're not given an absolute path, assume /dev/ prefix. */
|
||||
if (*devpath != '/') {
|
||||
if (*devpath == '/')
|
||||
return (NULL);
|
||||
|
||||
asprintf(&path, "%s%s", _PATH_DEV, devpath);
|
||||
if (path == NULL)
|
||||
return (NULL);
|
||||
@ -316,9 +302,10 @@ g_device_path_open(const char *devpath, int *fdp, int dowrite)
|
||||
free(path);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
fd_ok:
|
||||
/*
|
||||
* Let try to get sectorsize, which will prove it is a GEOM
|
||||
* provider.
|
||||
* Let try to get sectorsize, which will prove it is a GEOM provider.
|
||||
*/
|
||||
if (g_sectorsize(fd) == -1) {
|
||||
free(path);
|
||||
@ -331,8 +318,6 @@ g_device_path_open(const char *devpath, int *fdp, int dowrite)
|
||||
else
|
||||
close(fd);
|
||||
return (path);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
char *
|
||||
|
@ -232,6 +232,11 @@ static const struct pmc_event_descr skylake_event_table[] =
|
||||
__PMC_EV_ALIAS_SKYLAKE()
|
||||
};
|
||||
|
||||
static const struct pmc_event_descr skylake_xeon_event_table[] =
|
||||
{
|
||||
__PMC_EV_ALIAS_SKYLAKE_XEON()
|
||||
};
|
||||
|
||||
static const struct pmc_event_descr ivybridge_event_table[] =
|
||||
{
|
||||
__PMC_EV_ALIAS_IVYBRIDGE()
|
||||
@ -328,6 +333,7 @@ PMC_MDEP_TABLE(haswell_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC,
|
||||
PMC_MDEP_TABLE(broadwell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
|
||||
PMC_MDEP_TABLE(broadwell_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
|
||||
PMC_MDEP_TABLE(skylake, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
|
||||
PMC_MDEP_TABLE(skylake_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
|
||||
PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
|
||||
PMC_MDEP_TABLE(ivybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
|
||||
PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
|
||||
@ -383,6 +389,7 @@ PMC_CLASS_TABLE_DESC(haswell_xeon, IAP, haswell_xeon, iap);
|
||||
PMC_CLASS_TABLE_DESC(broadwell, IAP, broadwell, iap);
|
||||
PMC_CLASS_TABLE_DESC(broadwell_xeon, IAP, broadwell_xeon, iap);
|
||||
PMC_CLASS_TABLE_DESC(skylake, IAP, skylake, iap);
|
||||
PMC_CLASS_TABLE_DESC(skylake_xeon, IAP, skylake_xeon, iap);
|
||||
PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap);
|
||||
PMC_CLASS_TABLE_DESC(ivybridge_xeon, IAP, ivybridge_xeon, iap);
|
||||
PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap);
|
||||
@ -721,6 +728,8 @@ static struct pmc_event_alias core2_aliases_without_iaf[] = {
|
||||
#define broadwell_xeon_aliases_without_iaf core2_aliases_without_iaf
|
||||
#define skylake_aliases core2_aliases
|
||||
#define skylake_aliases_without_iaf core2_aliases_without_iaf
|
||||
#define skylake_xeon_aliases core2_aliases
|
||||
#define skylake_xeon_aliases_without_iaf core2_aliases_without_iaf
|
||||
#define ivybridge_aliases core2_aliases
|
||||
#define ivybridge_aliases_without_iaf core2_aliases_without_iaf
|
||||
#define ivybridge_xeon_aliases core2_aliases
|
||||
@ -1037,7 +1046,8 @@ iap_allocate_pmc(enum pmc_event pe, char *ctrspec,
|
||||
} else
|
||||
return (-1);
|
||||
|
||||
} else if (cpu_info.pm_cputype == PMC_CPU_INTEL_SKYLAKE) {
|
||||
} else if (cpu_info.pm_cputype == PMC_CPU_INTEL_SKYLAKE ||
|
||||
cpu_info.pm_cputype == PMC_CPU_INTEL_SKYLAKE_XEON) {
|
||||
if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) {
|
||||
n = pmc_parse_mask(iap_rsp_mask_skylake, p, &rsp);
|
||||
} else
|
||||
@ -3007,6 +3017,10 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames,
|
||||
ev = skylake_event_table;
|
||||
count = PMC_EVENT_TABLE_SIZE(skylake);
|
||||
break;
|
||||
case PMC_CPU_INTEL_SKYLAKE_XEON:
|
||||
ev = skylake_xeon_event_table;
|
||||
count = PMC_EVENT_TABLE_SIZE(skylake_xeon);
|
||||
break;
|
||||
case PMC_CPU_INTEL_IVYBRIDGE:
|
||||
ev = ivybridge_event_table;
|
||||
count = PMC_EVENT_TABLE_SIZE(ivybridge);
|
||||
@ -3386,6 +3400,9 @@ pmc_init(void)
|
||||
case PMC_CPU_INTEL_SKYLAKE:
|
||||
PMC_MDEP_INIT_INTEL_V2(skylake);
|
||||
break;
|
||||
case PMC_CPU_INTEL_SKYLAKE_XEON:
|
||||
PMC_MDEP_INIT_INTEL_V2(skylake_xeon);
|
||||
break;
|
||||
case PMC_CPU_INTEL_IVYBRIDGE:
|
||||
PMC_MDEP_INIT_INTEL_V2(ivybridge);
|
||||
break;
|
||||
@ -3595,7 +3612,13 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype cpu)
|
||||
break;
|
||||
case PMC_CPU_INTEL_SKYLAKE:
|
||||
ev = skylake_event_table;
|
||||
evfence = skylake_event_table + PMC_EVENT_TABLE_SIZE(skylake);
|
||||
evfence = skylake_event_table +
|
||||
PMC_EVENT_TABLE_SIZE(skylake);
|
||||
break;
|
||||
case PMC_CPU_INTEL_SKYLAKE_XEON:
|
||||
ev = skylake_xeon_event_table;
|
||||
evfence = skylake_xeon_event_table +
|
||||
PMC_EVENT_TABLE_SIZE(skylake_xeon);
|
||||
break;
|
||||
case PMC_CPU_INTEL_IVYBRIDGE:
|
||||
ev = ivybridge_event_table;
|
||||
|
@ -72,7 +72,7 @@ struct proc_handle {
|
||||
struct map_info *mappings; /* File mappings for proc. */
|
||||
size_t maparrsz; /* Map array size. */
|
||||
size_t nmappings; /* Number of mappings. */
|
||||
prmap_t *exec_map; /* Executable text mapping. */
|
||||
size_t exec_map; /* Executable text mapping index. */
|
||||
lwpstatus_t lwps; /* Process status. */
|
||||
struct procstat *procstat; /* libprocstat handle. */
|
||||
char execpath[PATH_MAX]; /* Path to program executable. */
|
||||
|
@ -62,7 +62,7 @@ map_iter(const rd_loadobj_t *lop, void *arg)
|
||||
rdl2prmap(lop, &mapping->map);
|
||||
if (strcmp(lop->rdl_path, phdl->execpath) == 0 &&
|
||||
(lop->rdl_prot & RD_RDL_X) != 0)
|
||||
phdl->exec_map = &mapping->map;
|
||||
phdl->exec_map = phdl->nmappings;
|
||||
|
||||
file = NULL;
|
||||
if (lop->rdl_path[0] != '\0') {
|
||||
|
@ -511,7 +511,8 @@ _proc_name2map(struct proc_handle *p, const char *name)
|
||||
return (&p->mappings[i]);
|
||||
}
|
||||
if (strcmp(name, "a.out") == 0)
|
||||
return (_proc_addr2map(p, p->exec_map->pr_vaddr));
|
||||
return (_proc_addr2map(p,
|
||||
p->mappings[p->exec_map].map.pr_vaddr));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,7 @@ nfs_readlink(struct nfs_iodesc *d, char *buf)
|
||||
buf[repl->len] = 0;
|
||||
done:
|
||||
free(pkt);
|
||||
return (0);
|
||||
return (rc);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -42,6 +42,7 @@ MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \
|
||||
sysdecode_enum.3 sysdecode_minherit_flags.3 \
|
||||
sysdecode_enum.3 sysdecode_msgctl_cmd.3 \
|
||||
sysdecode_enum.3 sysdecode_nfssvc_flags.3 \
|
||||
sysdecode_enum.3 sysdecode_pathconf_name.3 \
|
||||
sysdecode_enum.3 sysdecode_prio_which.3 \
|
||||
sysdecode_enum.3 sysdecode_procctl_cmd.3 \
|
||||
sysdecode_enum.3 sysdecode_ptrace_request.3 \
|
||||
@ -63,11 +64,13 @@ MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \
|
||||
sysdecode_enum.3 sysdecode_socketdomain.3 \
|
||||
sysdecode_enum.3 sysdecode_sockettype.3 \
|
||||
sysdecode_enum.3 sysdecode_sockopt_level.3 \
|
||||
sysdecode_enum.3 sysdecode_sysarch_number.3 \
|
||||
sysdecode_enum.3 sysdecode_umtx_op.3 \
|
||||
sysdecode_enum.3 sysdecode_vmresult.3 \
|
||||
sysdecode_enum.3 sysdecode_whence.3
|
||||
MLINKS+=sysdecode_fcntl_arg.3 sysdecode_fcntl_arg_p.3
|
||||
MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \
|
||||
sysdecode_mask.3 sysdecode_atflags.3 \
|
||||
sysdecode_mask.3 sysdecode_capfcntlrights.3 \
|
||||
sysdecode_mask.3 sysdecode_fcntl_fileflags.3 \
|
||||
sysdecode_mask.3 sysdecode_fileflags.3 \
|
||||
|
@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/stat.h>
|
||||
#include <sys/thr.h>
|
||||
#include <sys/umtx.h>
|
||||
#include <machine/sysarch.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/sctp.h>
|
||||
#include <netinet/tcp.h>
|
||||
@ -250,6 +251,13 @@ sysdecode_atfd(int fd)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
bool
|
||||
sysdecode_atflags(FILE *fp, int flag, int *rem)
|
||||
{
|
||||
|
||||
return (print_mask_int(fp, atflags, flag, rem));
|
||||
}
|
||||
|
||||
static struct name_table semctlops[] = {
|
||||
X(GETNCNT) X(GETPID) X(GETVAL) X(GETALL) X(GETZCNT) X(SETVAL) X(SETALL)
|
||||
X(IPC_RMID) X(IPC_SET) X(IPC_STAT) XEND
|
||||
@ -947,6 +955,13 @@ sysdecode_mmap_flags(FILE *fp, int flags, int *rem)
|
||||
return (printed);
|
||||
}
|
||||
|
||||
const char *
|
||||
sysdecode_pathconf_name(int name)
|
||||
{
|
||||
|
||||
return (lookup_value(pathconfname, name));
|
||||
}
|
||||
|
||||
const char *
|
||||
sysdecode_rtprio_function(int function)
|
||||
{
|
||||
@ -988,6 +1003,13 @@ sysdecode_sigcode(int sig, int si_code)
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
sysdecode_sysarch_number(int number)
|
||||
{
|
||||
|
||||
return (lookup_value(sysarchnum, number));
|
||||
}
|
||||
|
||||
bool
|
||||
sysdecode_umtx_cvwait_flags(FILE *fp, u_long flags, u_long *rem)
|
||||
{
|
||||
|
@ -91,6 +91,7 @@ _EOF_
|
||||
|
||||
gen_table "accessmode" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "sys/unistd.h"
|
||||
gen_table "acltype" "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+" "sys/acl.h"
|
||||
gen_table "atflags" "AT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/fcntl.h"
|
||||
gen_table "capfcntl" "CAP_FCNTL_[A-Z]+[[:space:]]+\(1" "sys/capsicum.h"
|
||||
gen_table "extattrns" "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h"
|
||||
gen_table "fadvisebehav" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h"
|
||||
@ -109,6 +110,7 @@ gen_table "filemode" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/
|
||||
gen_table "mountflags" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mount.h"
|
||||
gen_table "msyncflags" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
|
||||
gen_table "nfssvcflags" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h"
|
||||
gen_table "pathconfname" "_PC_[A-Z4_]+[[:space:]]+[0-9]+" "sys/unistd.h"
|
||||
gen_table "prio" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h"
|
||||
gen_table "procctlcmd" "PROC_[A-Z_]+[[:space:]]+[0-9]" "sys/procctl.h" "PROC_TRACE_CTL_"
|
||||
gen_table "ptraceop" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h"
|
||||
@ -153,6 +155,11 @@ gen_table "sigcode" "SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?" "sys/
|
||||
gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/umtx.h"
|
||||
gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h"
|
||||
gen_table "caprights" "CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)" "sys/capsicum.h"
|
||||
if [ -e "${include_dir}/x86/sysarch.h" ]; then
|
||||
gen_table "sysarchnum" "(AMD64|I386)_[A-Z86_]+[[:space:]]+[0-9]+" "x86/sysarch.h"
|
||||
else
|
||||
gen_table "sysarchnum" "[A-Z_]+[[:space:]]+[0-9]+" "machine/sysarch.h"
|
||||
fi
|
||||
|
||||
# Generate a .depend file for our output file
|
||||
if [ -n "$output_file" ]; then
|
||||
|
@ -42,6 +42,7 @@ int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi _abi, int _error);
|
||||
bool sysdecode_access_mode(FILE *_fp, int _mode, int *_rem);
|
||||
const char *sysdecode_acltype(int _type);
|
||||
const char *sysdecode_atfd(int _fd);
|
||||
bool sysdecode_atflags(FILE *_fp, int _flags, int *_rem);
|
||||
bool sysdecode_cap_fcntlrights(FILE *_fp, uint32_t _rights, uint32_t *_rem);
|
||||
void sysdecode_cap_rights(FILE *_fp, cap_rights_t *_rightsp);
|
||||
const char *sysdecode_extattrnamespace(int _namespace);
|
||||
@ -73,6 +74,7 @@ bool sysdecode_msg_flags(FILE *_fp, int _flags, int *_rem);
|
||||
bool sysdecode_msync_flags(FILE *_fp, int _flags, int *_rem);
|
||||
const char *sysdecode_nfssvc_flags(int _flags);
|
||||
bool sysdecode_open_flags(FILE *_fp, int _flags, int *_rem);
|
||||
const char *sysdecode_pathconf_name(int _name);
|
||||
bool sysdecode_pipe2_flags(FILE *_fp, int _flags, int *_rem);
|
||||
const char *sysdecode_prio_which(int _which);
|
||||
const char *sysdecode_procctl_cmd(int _cmd);
|
||||
@ -105,6 +107,7 @@ bool sysdecode_socket_type(FILE *_fp, int _type, int *_rem);
|
||||
const char *sysdecode_sockopt_level(int _level);
|
||||
const char *sysdecode_sockopt_name(int _level, int _optname);
|
||||
const char *sysdecode_syscallname(enum sysdecode_abi _abi, unsigned int _code);
|
||||
const char *sysdecode_sysarch_number(int _number);
|
||||
bool sysdecode_thr_create_flags(FILE *_fp, int _flags, int *_rem);
|
||||
bool sysdecode_umtx_cvwait_flags(FILE *_fp, u_long _flags, u_long *_rem);
|
||||
const char *sysdecode_umtx_op(int _op);
|
||||
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd June 3, 2017
|
||||
.Dd September 3, 2017
|
||||
.Dt sysdecode_enum 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -46,6 +46,7 @@
|
||||
.Nm sysdecode_minherit_flags ,
|
||||
.Nm sysdecode_msgctl_cmd ,
|
||||
.Nm sysdecode_nfssvc_flags ,
|
||||
.Nm sysdecode_pathconf_name ,
|
||||
.Nm sysdecode_prio_which ,
|
||||
.Nm sysdecode_procctl_cmd ,
|
||||
.Nm sysdecode_ptrace_request ,
|
||||
@ -67,6 +68,7 @@
|
||||
.Nm sysdecode_socketdomain ,
|
||||
.Nm sysdecode_sockettype ,
|
||||
.Nm sysdecode_sockopt_level ,
|
||||
.Nm sysdecode_sysarch_number ,
|
||||
.Nm sysdecode_umtx_op ,
|
||||
.Nm sysdecode_vmresult ,
|
||||
.Nm sysdecode_whence
|
||||
@ -110,6 +112,8 @@
|
||||
.Ft const char *
|
||||
.Fn sysdecode_nfssvc_flags "int flags"
|
||||
.Ft const char *
|
||||
.Fn sysdecode_pathconf_name "int name"
|
||||
.Ft const char *
|
||||
.Fn sysdecode_prio_which "int which"
|
||||
.Ft const char *
|
||||
.Fn sysdecode_procctl_cmd "int cmd"
|
||||
@ -152,6 +156,8 @@
|
||||
.Ft const char *
|
||||
.Fn sysdecode_sockopt_level "int level"
|
||||
.Ft const char *
|
||||
.Fn sysdecode_sysarch_number "int number"
|
||||
.Ft const char *
|
||||
.Fn sysdecode_umtx_op "int op"
|
||||
.Ft const char *
|
||||
.Fn sysdecode_vmresult "int result"
|
||||
@ -186,6 +192,7 @@ Most of these functions decode an argument passed to a system call:
|
||||
.It Fn sysdecode_minherit_inherit Ta Xr minherit 2 Ta Fa inherit
|
||||
.It Fn sysdecode_msgctl_cmd Ta Xr msgctl 2 Ta Fa cmd
|
||||
.It Fn sysdecode_nfssvc_flags Ta Xr nfssvc 2 Ta Fa flags
|
||||
.It Fn sysdecode_pathconf_name Ta Xr pathconf 2 Ta Fa name
|
||||
.It Fn sysdecode_prio_which Ta Xr getpriority 2 Ta Fa which
|
||||
.It Fn sysdecode_procctl_cmd Ta Xr procctl 2 Ta Fa cmd
|
||||
.It Fn sysdecode_ptrace_request Ta Xr ptrace 2 Ta Fa request
|
||||
@ -198,6 +205,7 @@ Most of these functions decode an argument passed to a system call:
|
||||
.It Fn sysdecode_shutdown_how Ta Xr shutdown 2 Ta Fa how
|
||||
.It Fn sysdecode_sigprocmask_how Ta Xr sigprocmask 2 Ta Fa how
|
||||
.It Fn sysdecode_sockopt_level Ta Xr getsockopt 2 Ta Fa level
|
||||
.It Fn sysdecode_sysarch_number Ta Xr sysarch 2 Ta Fa number
|
||||
.It Fn sysdecode_umtx_op Ta Xr _umtx_op 2 Ta Fa op
|
||||
.It Fn sysdecode_whence Ta Xr lseek 2 Ta Fa whence
|
||||
.El
|
||||
|
@ -25,12 +25,13 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 2, 2017
|
||||
.Dd September 3, 2017
|
||||
.Dt sysdecode_mask 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm sysdecode_mask ,
|
||||
.Nm sysdecode_accessmode ,
|
||||
.Nm sysdecode_atflags ,
|
||||
.Nm sysdecode_capfcntlrights ,
|
||||
.Nm sysdecode_fcntl_fileflags ,
|
||||
.Nm sysdecode_fileflags ,
|
||||
@ -66,6 +67,8 @@
|
||||
.Ft bool
|
||||
.Fn sysdecode_access_mode "FILE *fp" "int mode" "int *rem"
|
||||
.Ft bool
|
||||
.Fn sysdecode_atflags "FILE *fp" "int flags" "int *rem"
|
||||
.Ft bool
|
||||
.Fn sysdecode_cap_fcntlrights "FILE *fp" "uint32_t rights" "uint32_t *rem"
|
||||
.Ft bool
|
||||
.Fn sysdecode_fcntl_fileflags "FILE *fp" "int flags" "int *rem"
|
||||
@ -148,6 +151,7 @@ Most of these functions decode an argument passed to a system call:
|
||||
.Bl -column "Fn sysdecode_flock_operation" "Xr cap_fcntls_limit 2"
|
||||
.It Sy Function Ta Sy System Call Ta Sy Argument
|
||||
.It Fn sysdecode_access_mode Ta Xr access 2 Ta Fa mode
|
||||
.It Fn sysdecode_atflags Ta Xr chflagsat 2 , Xr fstatat 2 Ta Fa atflag , Fa flag
|
||||
.It Fn sysdecode_cap_fcntlrights Ta Xr cap_fcntls_limit 2 Ta Fa fcntlrights
|
||||
.It Fn sysdecode_fileflags Ta Xr chflags 2 Ta Fa flags
|
||||
.It Fn sysdecode_filemode Ta Xr chmod 2 , Xr open 2 Ta mode
|
||||
|
@ -469,8 +469,13 @@ clog_for_large_values(double complex z)
|
||||
|
||||
/*
|
||||
* Avoid overflow in hypot() when x and y are both very large.
|
||||
* Divide x and y by E, and then add 1 to the logarithm. This depends
|
||||
* on E being larger than sqrt(2).
|
||||
* Divide x and y by E, and then add 1 to the logarithm. This
|
||||
* depends on E being larger than sqrt(2), since the return value of
|
||||
* hypot cannot overflow if neither argument is greater in magnitude
|
||||
* than 1/sqrt(2) of the maximum value of the return type. Likewise
|
||||
* this determines the necessary threshold for using this method
|
||||
* (however, actually use 1/2 instead as it is simpler).
|
||||
*
|
||||
* Dividing by E causes an insignificant loss of accuracy; however
|
||||
* this method is still poor since it is uneccessarily slow.
|
||||
*/
|
||||
|
@ -57,10 +57,15 @@ __FBSDID("$FreeBSD$");
|
||||
#undef signbit
|
||||
#define signbit(x) (__builtin_signbitl(x))
|
||||
|
||||
#if LDBL_MAX_EXP != 0x4000
|
||||
#error "Unsupported long double format"
|
||||
#endif
|
||||
|
||||
static const long double
|
||||
A_crossover = 10,
|
||||
B_crossover = 0.6417,
|
||||
FOUR_SQRT_MIN = 0x1p-8189L,
|
||||
HALF_MAX = 0x1p16383L,
|
||||
QUARTER_SQRT_MAX = 0x1p8189L,
|
||||
RECIP_EPSILON = 1 / LDBL_EPSILON,
|
||||
SQRT_MIN = 0x1p-8191L;
|
||||
@ -307,7 +312,7 @@ clog_for_large_values(long double complex z)
|
||||
ay = t;
|
||||
}
|
||||
|
||||
if (ax > LDBL_MAX / 2)
|
||||
if (ax > HALF_MAX)
|
||||
return (CMPLXL(logl(hypotl(x / m_e, y / m_e)) + 1,
|
||||
atan2l(y, x)));
|
||||
|
||||
|
@ -42,8 +42,16 @@ __FBSDID("$FreeBSD$");
|
||||
*/
|
||||
#pragma STDC CX_LIMITED_RANGE ON
|
||||
|
||||
/* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */
|
||||
#define THRESH (LDBL_MAX / 2.414213562373095048801688724209698L)
|
||||
/*
|
||||
* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)).
|
||||
* Rather than determining the fully precise value at which we might
|
||||
* overflow, just use a threshold of approximately LDBL_MAX / 4.
|
||||
*/
|
||||
#if LDBL_MAX_EXP != 0x4000
|
||||
#error "Unsupported long double format"
|
||||
#else
|
||||
#define THRESH 0x1p16382L
|
||||
#endif
|
||||
|
||||
long double complex
|
||||
csqrtl(long double complex z)
|
||||
|
@ -214,28 +214,94 @@ test_nans(void)
|
||||
|
||||
/*
|
||||
* Test whether csqrt(a + bi) works for inputs that are large enough to
|
||||
* cause overflow in hypot(a, b) + a. In this case we are using
|
||||
* csqrt(115 + 252*I) == 14 + 9*I
|
||||
* scaled up to near MAX_EXP.
|
||||
* cause overflow in hypot(a, b) + a. Each of the tests is scaled up to
|
||||
* near MAX_EXP.
|
||||
*/
|
||||
static void
|
||||
test_overflow(int maxexp)
|
||||
{
|
||||
long double a, b;
|
||||
long double complex result;
|
||||
int exp, i;
|
||||
|
||||
a = ldexpl(115 * 0x1p-8, maxexp);
|
||||
b = ldexpl(252 * 0x1p-8, maxexp);
|
||||
assert(maxexp > 0 && maxexp % 2 == 0);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
exp = maxexp - 2 * i;
|
||||
|
||||
/* csqrt(115 + 252*I) == 14 + 9*I */
|
||||
a = ldexpl(115 * 0x1p-8, exp);
|
||||
b = ldexpl(252 * 0x1p-8, exp);
|
||||
result = t_csqrt(CMPLXL(a, b));
|
||||
assert(creall(result) == ldexpl(14 * 0x1p-4, maxexp / 2));
|
||||
assert(cimagl(result) == ldexpl(9 * 0x1p-4, maxexp / 2));
|
||||
assert(creall(result) == ldexpl(14 * 0x1p-4, exp / 2));
|
||||
assert(cimagl(result) == ldexpl(9 * 0x1p-4, exp / 2));
|
||||
|
||||
/* csqrt(-11 + 60*I) = 5 + 6*I */
|
||||
a = ldexpl(-11 * 0x1p-6, exp);
|
||||
b = ldexpl(60 * 0x1p-6, exp);
|
||||
result = t_csqrt(CMPLXL(a, b));
|
||||
assert(creall(result) == ldexpl(5 * 0x1p-3, exp / 2));
|
||||
assert(cimagl(result) == ldexpl(6 * 0x1p-3, exp / 2));
|
||||
|
||||
/* csqrt(225 + 0*I) == 15 + 0*I */
|
||||
a = ldexpl(225 * 0x1p-8, exp);
|
||||
b = 0;
|
||||
result = t_csqrt(CMPLXL(a, b));
|
||||
assert(creall(result) == ldexpl(15 * 0x1p-4, exp / 2));
|
||||
assert(cimagl(result) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Test that precision is maintained for some large squares. Set all or
|
||||
* some bits in the lower mantdig/2 bits, square the number, and try to
|
||||
* recover the sqrt. Note:
|
||||
* (x + xI)**2 = 2xxI
|
||||
*/
|
||||
static void
|
||||
test_precision(int maxexp, int mantdig)
|
||||
{
|
||||
long double b, x;
|
||||
long double complex result;
|
||||
uint64_t mantbits, sq_mantbits;
|
||||
int exp, i;
|
||||
|
||||
assert(maxexp > 0 && maxexp % 2 == 0);
|
||||
assert(mantdig <= 64);
|
||||
mantdig = rounddown(mantdig, 2);
|
||||
|
||||
for (exp = 0; exp <= maxexp; exp += 2) {
|
||||
mantbits = ((uint64_t)1 << (mantdig / 2 )) - 1;
|
||||
for (i = 0;
|
||||
i < 100 && mantbits > ((uint64_t)1 << (mantdig / 2 - 1));
|
||||
i++, mantbits--) {
|
||||
sq_mantbits = mantbits * mantbits;
|
||||
/*
|
||||
* sq_mantibts is a mantdig-bit number. Divide by
|
||||
* 2**mantdig to normalize it to [0.5, 1), where,
|
||||
* note, the binary power will be -1. Raise it by
|
||||
* 2**exp for the test. exp is even. Lower it by
|
||||
* one to reach a final binary power which is also
|
||||
* even. The result should be exactly
|
||||
* representable, given that mantdig is less than or
|
||||
* equal to the available precision.
|
||||
*/
|
||||
b = ldexpl((long double)sq_mantbits,
|
||||
exp - 1 - mantdig);
|
||||
x = ldexpl(mantbits, (exp - 2 - mantdig) / 2);
|
||||
assert(b == x * x * 2);
|
||||
result = t_csqrt(CMPLXL(0, b));
|
||||
assert(creall(result) == x);
|
||||
assert(cimagl(result) == x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
||||
printf("1..15\n");
|
||||
printf("1..18\n");
|
||||
|
||||
/* Test csqrt() */
|
||||
t_csqrt = _csqrt;
|
||||
@ -255,41 +321,56 @@ main(void)
|
||||
test_overflow(DBL_MAX_EXP);
|
||||
printf("ok 5 - csqrt\n");
|
||||
|
||||
test_precision(DBL_MAX_EXP, DBL_MANT_DIG);
|
||||
printf("ok 6 - csqrt\n");
|
||||
|
||||
/* Now test csqrtf() */
|
||||
t_csqrt = _csqrtf;
|
||||
|
||||
test_finite();
|
||||
printf("ok 6 - csqrt\n");
|
||||
|
||||
test_zeros();
|
||||
printf("ok 7 - csqrt\n");
|
||||
|
||||
test_infinities();
|
||||
test_zeros();
|
||||
printf("ok 8 - csqrt\n");
|
||||
|
||||
test_nans();
|
||||
test_infinities();
|
||||
printf("ok 9 - csqrt\n");
|
||||
|
||||
test_overflow(FLT_MAX_EXP);
|
||||
test_nans();
|
||||
printf("ok 10 - csqrt\n");
|
||||
|
||||
test_overflow(FLT_MAX_EXP);
|
||||
printf("ok 11 - csqrt\n");
|
||||
|
||||
test_precision(FLT_MAX_EXP, FLT_MANT_DIG);
|
||||
printf("ok 12 - csqrt\n");
|
||||
|
||||
/* Now test csqrtl() */
|
||||
t_csqrt = csqrtl;
|
||||
|
||||
test_finite();
|
||||
printf("ok 11 - csqrt\n");
|
||||
|
||||
test_zeros();
|
||||
printf("ok 12 - csqrt\n");
|
||||
|
||||
test_infinities();
|
||||
printf("ok 13 - csqrt\n");
|
||||
|
||||
test_nans();
|
||||
test_zeros();
|
||||
printf("ok 14 - csqrt\n");
|
||||
|
||||
test_overflow(LDBL_MAX_EXP);
|
||||
test_infinities();
|
||||
printf("ok 15 - csqrt\n");
|
||||
|
||||
test_nans();
|
||||
printf("ok 16 - csqrt\n");
|
||||
|
||||
test_overflow(LDBL_MAX_EXP);
|
||||
printf("ok 17 - csqrt\n");
|
||||
|
||||
test_precision(LDBL_MAX_EXP,
|
||||
#ifndef __i386__
|
||||
LDBL_MANT_DIG
|
||||
#else
|
||||
DBL_MANT_DIG
|
||||
#endif
|
||||
);
|
||||
printf("ok 18 - csqrt\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" from: @(#)gettytab.5 8.4 (Berkeley) 4/19/94
|
||||
.\" $FreeBSD$
|
||||
.\" "
|
||||
.Dd February 2, 2017
|
||||
.Dd August 23, 2017
|
||||
.Dt GETTYTAB 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -130,6 +130,8 @@ hangup line on last close
|
||||
.It "ig bool false ignore garbage characters in login name"
|
||||
.It "im str" Ta Dv NULL
|
||||
.Ta No "initial (banner) message"
|
||||
.It "iM str" Ta Dv NULL
|
||||
.Ta No "execute named file to generate initial (banner) message"
|
||||
.It "in str" Ta So Li ^C
|
||||
.Sc Ta No "interrupt character"
|
||||
.It "is num unused input speed"
|
||||
@ -146,7 +148,7 @@ hangup line on last close
|
||||
.It "mb bool false do flow control based on carrier"
|
||||
.It "nc bool false terminal does not supply carrier (set clocal)"
|
||||
.It "nl bool false terminal has (or might have) a newline character"
|
||||
.It "np bool false terminal uses no parity (i.e. 8-bit characters)"
|
||||
.It "np bool false terminal uses no parity (i.e., 8-bit characters)"
|
||||
.It "nx str default next table (for auto speed selection)"
|
||||
.It "o0 num unused tty output flags to write messages"
|
||||
.It "o1 num unused tty output flags to read login name"
|
||||
|
@ -88,6 +88,7 @@ struct gettyflags {
|
||||
#define AC gettystrs[28].value
|
||||
#define AL gettystrs[29].value
|
||||
#define DF gettystrs[30].value
|
||||
#define IMP gettystrs[31].value
|
||||
|
||||
/*
|
||||
* Numeric definitions.
|
||||
|
@ -82,6 +82,7 @@ struct gettystrs gettystrs[] = {
|
||||
{ "ac" }, /* modem answer-chat */
|
||||
{ "al" }, /* user to auto-login */
|
||||
{ "df", datefmt}, /* format for strftime() */
|
||||
{ "iM" }, /* initial message program */
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
@ -324,6 +324,8 @@ main(int argc, char *argv[])
|
||||
}
|
||||
first_time = 0;
|
||||
|
||||
if (IMP && *IMP && !(PL && PP))
|
||||
system(IMP);
|
||||
if (IM && *IM && !(PL && PP))
|
||||
putf(IM);
|
||||
if (setjmp(timeout)) {
|
||||
|
@ -48,6 +48,9 @@ CFLAGS+= -DPIC $(DEBUG)
|
||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
||||
CFLAGS+= -fvisibility=hidden
|
||||
.endif
|
||||
.if ${MACHINE_CPUARCH} == "mips"
|
||||
CFLAGS.reloc.c+=-fno-jump-tables
|
||||
.endif
|
||||
LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs
|
||||
LIBADD= c_pic
|
||||
.if ${MK_TOOLCHAIN} == "no"
|
||||
|
@ -351,7 +351,7 @@ execution environments.
|
||||
The verification only uses Unix
|
||||
.Dv DACs ,
|
||||
ignores
|
||||
.Dv ACLs
|
||||
.Dv ACLs ,
|
||||
and is naturally prone to race conditions.
|
||||
Environments which rely on such restrictions are weak
|
||||
and breakable on their own.
|
||||
|
@ -571,7 +571,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
close(fd);
|
||||
if (obj_main == NULL)
|
||||
rtld_die();
|
||||
max_stack_flags = obj->stack_flags;
|
||||
max_stack_flags = obj_main->stack_flags;
|
||||
} else { /* Main program already loaded. */
|
||||
dbg("processing main program's program header");
|
||||
assert(aux_info[AT_PHDR] != NULL);
|
||||
|
@ -10,6 +10,8 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
export PATH
|
||||
|
||||
@ -31,10 +33,6 @@ fi
|
||||
echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab
|
||||
echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local
|
||||
makefs -B little -o label=FreeBSD_Install ${2}.part ${1}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "makefs failed"
|
||||
exit 1
|
||||
fi
|
||||
rm ${1}/etc/fstab
|
||||
rm ${1}/etc/rc.conf.local
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# extra-bits-dir, if provided, contains additional files to be merged
|
||||
# into base-bits-dir as part of making the image.
|
||||
|
||||
if [ "x$1" = "x-b" ]; then
|
||||
if [ "$1" = "-b" ]; then
|
||||
# This is highly x86-centric and will be used directly below.
|
||||
bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot"
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
export PATH
|
||||
|
||||
@ -31,10 +33,6 @@ fi
|
||||
echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab
|
||||
echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local
|
||||
makefs -B little -o label=FreeBSD_Install ${2}.part ${1}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "makefs failed"
|
||||
exit 1
|
||||
fi
|
||||
rm ${1}/etc/fstab
|
||||
rm ${1}/etc/rc.conf.local
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# extra-bits-dir, if provided, contains additional files to be merged
|
||||
# into base-bits-dir as part of making the image.
|
||||
|
||||
if [ "x$1" = "x-b" ]; then
|
||||
if [ "$1" = "-b" ]; then
|
||||
# This is highly x86-centric and will be used directly below.
|
||||
bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot"
|
||||
shift
|
||||
|
@ -10,6 +10,8 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
export PATH
|
||||
|
||||
@ -36,10 +38,6 @@ echo '/dev/da0s3 / ufs ro,noatime 1 1' > ${1}/etc/fstab
|
||||
echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local
|
||||
rm -f ${tempfile}
|
||||
makefs -B big ${tempfile} ${1}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "makefs failed"
|
||||
exit 1
|
||||
fi
|
||||
rm ${1}/etc/fstab
|
||||
rm ${1}/etc/rc.conf.local
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
# extra-bits-dir, if provided, contains additional files to be merged
|
||||
# into base-bits-dir as part of making the image.
|
||||
|
||||
if [ "x$1" = "x-b" ]; then
|
||||
if [ "$1" = "-b" ]; then
|
||||
# Apple boot code
|
||||
uudecode -o /tmp/hfs-boot-block.bz2 "`dirname "$0"`/hfs-boot.bz2.uu"
|
||||
bzip2 -d /tmp/hfs-boot-block.bz2
|
||||
|
@ -40,7 +40,7 @@ echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab"
|
||||
makefs -t cd9660 -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME.tmp" "$@"
|
||||
rm -f "$BASEBITSDIR/etc/fstab"
|
||||
|
||||
if [ "x$BOPT" != "x-b" ]; then
|
||||
if [ "$BOPT" != "-b" ]; then
|
||||
mv "$NAME.tmp" "$NAME"
|
||||
exit 0
|
||||
fi
|
||||
|
@ -11,12 +11,12 @@ export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs du
|
||||
# Set to a list of third-party software to enable in rc.conf(5).
|
||||
export VM_RC_LIST="ec2_configinit ec2_fetchkey ec2_ephemeralswap ec2_loghostkey firstboot_freebsd_update firstboot_pkgs"
|
||||
|
||||
# Build with a 2 GB UFS partition; the growfs rc.d script will expand
|
||||
# Build with a 3 GB UFS partition; the growfs rc.d script will expand
|
||||
# the partition to fill the root disk after the EC2 instance is launched.
|
||||
# Note that if this is set to <N>G, we will end up with an <N+1> GB disk
|
||||
# image since VMSIZE is the size of the UFS partition, not the disk which
|
||||
# it resides within.
|
||||
export VMSIZE=2048M
|
||||
export VMSIZE=3072M
|
||||
|
||||
# No swap space; the ec2_ephemeralswap rc.d script will allocate swap
|
||||
# space on EC2 ephemeral disks. (If they exist -- the T2 low-cost instances
|
||||
|
@ -36,6 +36,7 @@ static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/stat.h>
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
@ -465,7 +466,9 @@ sblock_init(void)
|
||||
static int
|
||||
calcsb(char *dev, int devfd, struct fs *fs)
|
||||
{
|
||||
struct fsrecovery fsr;
|
||||
struct fsrecovery *fsr;
|
||||
char *fsrbuf;
|
||||
u_int secsize;
|
||||
|
||||
/*
|
||||
* We need fragments-per-group and the partition-size.
|
||||
@ -475,32 +478,62 @@ calcsb(char *dev, int devfd, struct fs *fs)
|
||||
* overwritten by a boot block, we fail. But usually they are
|
||||
* there and we can use them.
|
||||
*/
|
||||
if (blread(devfd, (char *)&fsr,
|
||||
(SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) ||
|
||||
fsr.fsr_magic != FS_UFS2_MAGIC)
|
||||
if (ioctl(devfd, DIOCGSECTORSIZE, &secsize) == -1)
|
||||
return (0);
|
||||
fsrbuf = Malloc(secsize);
|
||||
if (fsrbuf == NULL)
|
||||
errx(EEXIT, "calcsb: cannot allocate recovery buffer");
|
||||
if (blread(devfd, fsrbuf,
|
||||
(SBLOCK_UFS2 - secsize) / dev_bsize, secsize) != 0)
|
||||
return (0);
|
||||
fsr = (struct fsrecovery *)&fsrbuf[secsize - sizeof *fsr];
|
||||
if (fsr->fsr_magic != FS_UFS2_MAGIC)
|
||||
return (0);
|
||||
memset(fs, 0, sizeof(struct fs));
|
||||
fs->fs_fpg = fsr.fsr_fpg;
|
||||
fs->fs_fsbtodb = fsr.fsr_fsbtodb;
|
||||
fs->fs_sblkno = fsr.fsr_sblkno;
|
||||
fs->fs_magic = fsr.fsr_magic;
|
||||
fs->fs_ncg = fsr.fsr_ncg;
|
||||
fs->fs_fpg = fsr->fsr_fpg;
|
||||
fs->fs_fsbtodb = fsr->fsr_fsbtodb;
|
||||
fs->fs_sblkno = fsr->fsr_sblkno;
|
||||
fs->fs_magic = fsr->fsr_magic;
|
||||
fs->fs_ncg = fsr->fsr_ncg;
|
||||
free(fsrbuf);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if recovery information exists.
|
||||
* Return 1 if it exists or cannot be created.
|
||||
* Return 0 if it does not exist and can be created.
|
||||
*/
|
||||
static int
|
||||
chkrecovery(int devfd)
|
||||
{
|
||||
struct fsrecovery fsr;
|
||||
struct fsrecovery *fsr;
|
||||
char *fsrbuf;
|
||||
u_int secsize;
|
||||
|
||||
if (blread(devfd, (char *)&fsr,
|
||||
(SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) ||
|
||||
fsr.fsr_magic != FS_UFS2_MAGIC)
|
||||
return (0);
|
||||
/*
|
||||
* Could not determine if backup material exists, so do not
|
||||
* offer to create it.
|
||||
*/
|
||||
if (ioctl(devfd, DIOCGSECTORSIZE, &secsize) == -1 ||
|
||||
(fsrbuf = Malloc(secsize)) == NULL ||
|
||||
blread(devfd, fsrbuf, (SBLOCK_UFS2 - secsize) / dev_bsize,
|
||||
secsize) != 0)
|
||||
return (1);
|
||||
/*
|
||||
* Recovery material has already been created, so do not
|
||||
* need to create it again.
|
||||
*/
|
||||
fsr = (struct fsrecovery *)&fsrbuf[secsize - sizeof *fsr];
|
||||
if (fsr->fsr_magic == FS_UFS2_MAGIC) {
|
||||
free(fsrbuf);
|
||||
return (1);
|
||||
}
|
||||
/*
|
||||
* Recovery material has not been created and can be if desired.
|
||||
*/
|
||||
free(fsrbuf);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -511,17 +544,24 @@ chkrecovery(int devfd)
|
||||
static void
|
||||
saverecovery(int readfd, int writefd)
|
||||
{
|
||||
struct fsrecovery fsr;
|
||||
struct fsrecovery *fsr;
|
||||
char *fsrbuf;
|
||||
u_int secsize;
|
||||
|
||||
if (sblock.fs_magic != FS_UFS2_MAGIC ||
|
||||
blread(readfd, (char *)&fsr,
|
||||
(SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)))
|
||||
ioctl(readfd, DIOCGSECTORSIZE, &secsize) == -1 ||
|
||||
(fsrbuf = Malloc(secsize)) == NULL ||
|
||||
blread(readfd, fsrbuf, (SBLOCK_UFS2 - secsize) / dev_bsize,
|
||||
secsize) != 0) {
|
||||
printf("RECOVERY DATA COULD NOT BE CREATED\n");
|
||||
return;
|
||||
fsr.fsr_magic = sblock.fs_magic;
|
||||
fsr.fsr_fpg = sblock.fs_fpg;
|
||||
fsr.fsr_fsbtodb = sblock.fs_fsbtodb;
|
||||
fsr.fsr_sblkno = sblock.fs_sblkno;
|
||||
fsr.fsr_ncg = sblock.fs_ncg;
|
||||
blwrite(writefd, (char *)&fsr, (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize,
|
||||
sizeof(fsr));
|
||||
}
|
||||
fsr = (struct fsrecovery *)&fsrbuf[secsize - sizeof *fsr];
|
||||
fsr->fsr_magic = sblock.fs_magic;
|
||||
fsr->fsr_fpg = sblock.fs_fpg;
|
||||
fsr->fsr_fsbtodb = sblock.fs_fsbtodb;
|
||||
fsr->fsr_sblkno = sblock.fs_sblkno;
|
||||
fsr->fsr_ncg = sblock.fs_ncg;
|
||||
blwrite(writefd, fsrbuf, (SBLOCK_UFS2 - secsize) / secsize, secsize);
|
||||
free(fsrbuf);
|
||||
}
|
||||
|
@ -140,61 +140,6 @@ virstor_main(struct gctl_req *req, unsigned flags)
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
pathgen(const char *name, char *path, size_t size)
|
||||
{
|
||||
|
||||
if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) != 0)
|
||||
snprintf(path, size, "%s%s", _PATH_DEV, name);
|
||||
else
|
||||
strlcpy(path, name, size);
|
||||
}
|
||||
|
||||
static int
|
||||
my_g_metadata_store(const char *name, u_char *md, size_t size)
|
||||
{
|
||||
char path[MAXPATHLEN];
|
||||
unsigned sectorsize;
|
||||
off_t mediasize;
|
||||
u_char *sector;
|
||||
int error, fd;
|
||||
|
||||
pathgen(name, path, sizeof(path));
|
||||
sector = NULL;
|
||||
error = 0;
|
||||
|
||||
fd = open(path, O_RDWR);
|
||||
if (fd == -1)
|
||||
return (errno);
|
||||
mediasize = g_get_mediasize(name);
|
||||
if (mediasize == 0) {
|
||||
error = errno;
|
||||
goto out;
|
||||
}
|
||||
sectorsize = g_get_sectorsize(name);
|
||||
if (sectorsize == 0) {
|
||||
error = errno;
|
||||
goto out;
|
||||
}
|
||||
assert(sectorsize >= size);
|
||||
sector = malloc(sectorsize);
|
||||
if (sector == NULL) {
|
||||
error = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
bcopy(md, sector, size);
|
||||
if (pwrite(fd, sector, sectorsize, mediasize - sectorsize) !=
|
||||
(ssize_t)sectorsize) {
|
||||
error = errno;
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
if (sector != NULL)
|
||||
free(sector);
|
||||
close(fd);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Labels a new geom Meaning: parses and checks the parameters, calculates &
|
||||
* writes metadata to the relevant providers so when the next round of
|
||||
@ -464,7 +409,7 @@ virstor_label(struct gctl_req *req)
|
||||
err(1, "Cannot allocate sector of %zu bytes", ssize);
|
||||
bzero(sect, ssize);
|
||||
virstor_metadata_encode(&md, sect);
|
||||
error = my_g_metadata_store(name, sect, ssize);
|
||||
error = g_metadata_store(name, sect, ssize);
|
||||
free(sect);
|
||||
if (error != 0) {
|
||||
if (verbose)
|
||||
|
@ -302,6 +302,7 @@ g_metadata_store(const char *name, const unsigned char *md, size_t size)
|
||||
goto out;
|
||||
}
|
||||
bcopy(md, sector, size);
|
||||
bzero(sector + size, sectorsize - size);
|
||||
if (pwrite(fd, sector, sectorsize, mediasize - sectorsize) !=
|
||||
sectorsize) {
|
||||
error = errno;
|
||||
|
@ -37,7 +37,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 10, 2015
|
||||
.Dd August 28, 2017
|
||||
.Dt MDCONFIG 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -55,6 +55,7 @@
|
||||
.Op Fl u Ar unit
|
||||
.Op Fl x Ar sectors/track
|
||||
.Op Fl y Ar heads/cylinder
|
||||
.Op Fl L Ar label
|
||||
.Nm
|
||||
.Fl d
|
||||
.Fl u Ar unit
|
||||
@ -189,6 +190,12 @@ and
|
||||
options can be used to specify a synthetic geometry.
|
||||
This is useful for constructing bootable images for later download to
|
||||
other devices.
|
||||
.It Fl L Ar label
|
||||
Associate a label (arbitrary string) with the new memory disk.
|
||||
The label can then be inspected with
|
||||
.Bd -literal -offset indent
|
||||
.Nm Fl l v
|
||||
.Ed
|
||||
.It Fl o Oo Cm no Oc Ns Ar option
|
||||
Set or reset options.
|
||||
.Bl -tag -width indent
|
||||
|
@ -79,7 +79,7 @@ usage(void)
|
||||
|
||||
fprintf(stderr,
|
||||
"usage: mdconfig -a -t type [-n] [-o [no]option] ... [-f file]\n"
|
||||
" [-s size] [-S sectorsize] [-u unit]\n"
|
||||
" [-s size] [-S sectorsize] [-u unit] [-L label]\n"
|
||||
" [-x sectors/track] [-y heads/cylinder]\n"
|
||||
" mdconfig -d -u unit [-o [no]force]\n"
|
||||
" mdconfig -r -u unit -s size [-o [no]force]\n"
|
||||
@ -102,15 +102,17 @@ main(int argc, char **argv)
|
||||
|
||||
bzero(&mdio, sizeof(mdio));
|
||||
mdio.md_file = malloc(PATH_MAX);
|
||||
if (mdio.md_file == NULL)
|
||||
mdio.md_label = malloc(PATH_MAX);
|
||||
if (mdio.md_file == NULL || mdio.md_label == NULL)
|
||||
err(1, "could not allocate memory");
|
||||
vflag = 0;
|
||||
bzero(mdio.md_file, PATH_MAX);
|
||||
bzero(mdio.md_label, PATH_MAX);
|
||||
|
||||
if (argc == 1)
|
||||
usage();
|
||||
|
||||
while ((ch = getopt(argc, argv, "ab:df:lno:rs:S:t:u:vx:y:")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "ab:df:lno:rs:S:t:u:vx:y:L:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
if (action != UNSET && action != ATTACH)
|
||||
@ -243,6 +245,9 @@ main(int argc, char **argv)
|
||||
case 'y':
|
||||
mdio.md_fwheads = strtoul(optarg, &p, 0);
|
||||
break;
|
||||
case 'L':
|
||||
strlcpy(mdio.md_label, optarg, PATH_MAX);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
@ -422,7 +427,8 @@ md_list(const char *units, int opt, const char *fflag)
|
||||
struct gclass *gcl;
|
||||
void *sq;
|
||||
int retcode, ffound, ufound;
|
||||
char *type, *file, *length;
|
||||
char *length;
|
||||
const char *type, *file, *label;
|
||||
|
||||
type = file = length = NULL;
|
||||
|
||||
@ -477,10 +483,14 @@ md_list(const char *units, int opt, const char *fflag)
|
||||
printf("\t%s\t", type);
|
||||
if (length != NULL)
|
||||
md_prthumanval(length);
|
||||
if (file != NULL) {
|
||||
if (file == NULL)
|
||||
file = "-";
|
||||
printf("\t%s", file);
|
||||
file = NULL;
|
||||
}
|
||||
label = geom_config_get(gc, "label");
|
||||
if (label == NULL)
|
||||
label = "";
|
||||
printf("\t%s", label);
|
||||
}
|
||||
opt |= OPT_DONE;
|
||||
if ((opt & OPT_LIST) && !(opt & OPT_VERBOSE))
|
||||
|
@ -121,7 +121,8 @@ mkfs(struct partition *pp, char *fsys)
|
||||
ino_t maxinum;
|
||||
int minfragsperinode; /* minimum ratio of frags to inodes */
|
||||
char tmpbuf[100]; /* XXX this will break in about 2,500 years */
|
||||
struct fsrecovery fsr;
|
||||
struct fsrecovery *fsr;
|
||||
char *fsrbuf;
|
||||
union {
|
||||
struct fs fdummy;
|
||||
char cdummy[SBLOCKSIZE];
|
||||
@ -442,6 +443,8 @@ mkfs(struct partition *pp, char *fsys)
|
||||
sblock.fs_sbsize = fragroundup(&sblock, sizeof(struct fs));
|
||||
if (sblock.fs_sbsize > SBLOCKSIZE)
|
||||
sblock.fs_sbsize = SBLOCKSIZE;
|
||||
if (sblock.fs_sbsize < realsectorsize)
|
||||
sblock.fs_sbsize = realsectorsize;
|
||||
sblock.fs_minfree = minfree;
|
||||
if (metaspace > 0 && metaspace < sblock.fs_fpg / 2)
|
||||
sblock.fs_metaspace = blknum(&sblock, metaspace);
|
||||
@ -514,7 +517,7 @@ mkfs(struct partition *pp, char *fsys)
|
||||
/*
|
||||
* Wipe out old UFS1 superblock(s) if necessary.
|
||||
*/
|
||||
if (!Nflag && Oflag != 1) {
|
||||
if (!Nflag && Oflag != 1 && realsectorsize <= SBLOCK_UFS1) {
|
||||
i = bread(&disk, part_ofs + SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE);
|
||||
if (i == -1)
|
||||
err(1, "can't read old UFS1 superblock: %s", disk.d_error);
|
||||
@ -623,18 +626,20 @@ mkfs(struct partition *pp, char *fsys)
|
||||
* The recovery information only works for UFS2 filesystems.
|
||||
*/
|
||||
if (sblock.fs_magic == FS_UFS2_MAGIC) {
|
||||
i = bread(&disk,
|
||||
part_ofs + (SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize,
|
||||
(char *)&fsr, sizeof(fsr));
|
||||
if (i == -1)
|
||||
if ((fsrbuf = malloc(realsectorsize)) == NULL || bread(&disk,
|
||||
part_ofs + (SBLOCK_UFS2 - realsectorsize) / disk.d_bsize,
|
||||
fsrbuf, realsectorsize) == -1)
|
||||
err(1, "can't read recovery area: %s", disk.d_error);
|
||||
fsr.fsr_magic = sblock.fs_magic;
|
||||
fsr.fsr_fpg = sblock.fs_fpg;
|
||||
fsr.fsr_fsbtodb = sblock.fs_fsbtodb;
|
||||
fsr.fsr_sblkno = sblock.fs_sblkno;
|
||||
fsr.fsr_ncg = sblock.fs_ncg;
|
||||
wtfs((SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize, sizeof(fsr),
|
||||
(char *)&fsr);
|
||||
fsr =
|
||||
(struct fsrecovery *)&fsrbuf[realsectorsize - sizeof *fsr];
|
||||
fsr->fsr_magic = sblock.fs_magic;
|
||||
fsr->fsr_fpg = sblock.fs_fpg;
|
||||
fsr->fsr_fsbtodb = sblock.fs_fsbtodb;
|
||||
fsr->fsr_sblkno = sblock.fs_sblkno;
|
||||
fsr->fsr_ncg = sblock.fs_ncg;
|
||||
wtfs((SBLOCK_UFS2 - realsectorsize) / disk.d_bsize,
|
||||
realsectorsize, fsrbuf);
|
||||
free(fsrbuf);
|
||||
}
|
||||
/*
|
||||
* Update information about this partition in pack
|
||||
|
@ -66,8 +66,9 @@ print_controller(struct nvme_controller_data *cdata)
|
||||
printf("Unlimited\n");
|
||||
else
|
||||
printf("%d\n", PAGE_SIZE * (1 << cdata->mdts));
|
||||
|
||||
printf("Controller ID: 0x%02x\n", cdata->ctrlr_id);
|
||||
printf("\n");
|
||||
|
||||
printf("Admin Command Set Attributes\n");
|
||||
printf("============================\n");
|
||||
printf("Security Send/Receive: %s\n",
|
||||
|
@ -46,6 +46,7 @@ MAN= aac.4 \
|
||||
amdpm.4 \
|
||||
${_amdsbwd.4} \
|
||||
${_amdsmb.4} \
|
||||
${_amdsmn.4} \
|
||||
${_amdtemp.4} \
|
||||
${_bxe.4} \
|
||||
amr.4 \
|
||||
@ -373,7 +374,9 @@ MAN= aac.4 \
|
||||
ng_vlan.4 \
|
||||
nmdm.4 \
|
||||
nsp.4 \
|
||||
${_ntb_hw.4} \
|
||||
${_ntb.4} \
|
||||
${_ntb_hw_intel.4} \
|
||||
${_ntb_hw_plx.4} \
|
||||
${_ntb_transport.4} \
|
||||
${_if_ntb.4} \
|
||||
null.4 \
|
||||
@ -686,7 +689,6 @@ MLINKS+=netintro.4 net.4 \
|
||||
netintro.4 networking.4
|
||||
MLINKS+=${_nfe.4} ${_if_nfe.4}
|
||||
MLINKS+=nge.4 if_nge.4
|
||||
MLINKS+=${_ntb_hw.4} ${_ntb.4}
|
||||
MLINKS+=${_nxge.4} ${_if_nxge.4}
|
||||
MLINKS+=ow.4 onewire.4
|
||||
MLINKS+=pccbb.4 cbb.4
|
||||
@ -768,6 +770,7 @@ _attimer.4= attimer.4
|
||||
_aibs.4= aibs.4
|
||||
_amdsbwd.4= amdsbwd.4
|
||||
_amdsmb.4= amdsmb.4
|
||||
_amdsmn.4= amdsmn.4
|
||||
_amdtemp.4= amdtemp.4
|
||||
_asmc.4= asmc.4
|
||||
_bxe.4= bxe.4
|
||||
@ -834,7 +837,8 @@ _xnb.4= xnb.4
|
||||
_if_ntb.4= if_ntb.4
|
||||
_ioat.4= ioat.4
|
||||
_ntb.4= ntb.4
|
||||
_ntb_hw.4= ntb_hw.4
|
||||
_ntb_hw_intel.4= ntb_hw_intel.4
|
||||
_ntb_hw_plx.4= ntb_hw_plx.4
|
||||
_ntb_transport.4=ntb_transport.4
|
||||
_qlxge.4= qlxge.4
|
||||
_qlxgb.4= qlxgb.4
|
||||
|
64
share/man/man4/amdsmn.4
Normal file
64
share/man/man4/amdsmn.4
Normal file
@ -0,0 +1,64 @@
|
||||
.\"-
|
||||
.\" Copyright (c) 2017 Conrad Meyer <cem@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 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 September 5, 2017
|
||||
.Dt AMDSMN 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm amdsmn
|
||||
.Nd device driver for
|
||||
.Tn AMD
|
||||
processor System Management Network
|
||||
.Sh SYNOPSIS
|
||||
To compile this driver into the kernel, place the following line in your
|
||||
kernel configuration file:
|
||||
.Bd -ragged -offset indent
|
||||
.Cd "device amdsmn"
|
||||
.Ed
|
||||
.Pp
|
||||
Alternatively, to load the driver as a module at boot time, place the
|
||||
following line in
|
||||
.Xr loader.conf 5 :
|
||||
.Bd -literal -offset indent
|
||||
amdsmn_load="YES"
|
||||
.Ed
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for resources on the System Management Network bus
|
||||
in
|
||||
.Tn AMD
|
||||
Family 17h processors.
|
||||
.Sh SEE ALSO
|
||||
.Xr loader 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
driver first appeared in
|
||||
.Fx 12.0 .
|
||||
.Sh AUTHORS
|
||||
.An Conrad Meyer Aq Mt cem@FreeBSD.org
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 27, 2015
|
||||
.Dd September 5, 2017
|
||||
.Dt AMDTEMP 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -53,7 +53,7 @@ The
|
||||
driver provides support for the on-die digital thermal sensor present
|
||||
in
|
||||
.Tn AMD
|
||||
Family 0Fh, 10h, 11h, 12h, 14h, 15h, and 16h processors.
|
||||
Family 0Fh, 10h, 11h, 12h, 14h, 15h, 16h, and 17h processors.
|
||||
.Pp
|
||||
For Family 0Fh processors, the
|
||||
.Nm
|
||||
@ -64,8 +64,8 @@ The driver also creates
|
||||
in the corresponding CPU device's sysctl tree, displaying the maximum
|
||||
temperature of the two sensors located in each CPU core.
|
||||
.Pp
|
||||
For Family 10h, 11h, 12h, 14h, 15h, and 16h processors, the driver reports each
|
||||
package's temperature through a sysctl node, named
|
||||
For Family 10h, 11h, 12h, 14h, 15h, 16h, and 17h processors, the driver reports
|
||||
each package's temperature through a sysctl node, named
|
||||
.Va dev.amdtemp.%d.core0.sensor0 .
|
||||
The driver also creates
|
||||
.Va dev.cpu.%d.temperature
|
||||
@ -107,5 +107,5 @@ specified maximum case temperature and maximum thermal power dissipation
|
||||
according to
|
||||
.Rs
|
||||
.%T BIOS and Kernel Developer's Guide (BKDG) for AMD Processors
|
||||
.%U http://developer.amd.com/documentation/guides/Pages/default.aspx
|
||||
.%U http://developer.amd.com/resources/developer-guides-manuals/
|
||||
.Re
|
||||
|
@ -66,7 +66,7 @@ VM, and sends the result back to Hyper-V host.
|
||||
.Pp
|
||||
Generally,
|
||||
.Xr hv_vss_daemon 8
|
||||
takes the responsiblity to freeze/thaw UFS file system,
|
||||
takes the responsibility to freeze/thaw UFS file system,
|
||||
and it is automatically launched after system boots. When Hyper-V host wants to
|
||||
take a snapshot of the
|
||||
.Fx
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user