MFhead @ r305170

This commit is contained in:
Enji Cooper 2016-09-01 02:57:15 +00:00
commit f8fd1a95d9
172 changed files with 3603 additions and 1414 deletions

View File

@ -109,7 +109,8 @@
# Note: we use this awkward construct to be compatible with FreeBSD's # Note: we use this awkward construct to be compatible with FreeBSD's
# old make used in 10.0 and 9.2 and earlier. # old make used in 10.0 and 9.2 and earlier.
.if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && !make(showconfig) .if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && \
!make(showconfig) && !make(print-dir)
# targets/Makefile plays the role of top-level # targets/Makefile plays the role of top-level
.include "targets/Makefile" .include "targets/Makefile"
.else .else
@ -132,7 +133,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
xdev-links native-xtools stageworld stagekernel stage-packages \ xdev-links native-xtools stageworld stagekernel stage-packages \
create-world-packages create-kernel-packages create-packages \ create-world-packages create-kernel-packages create-packages \
packages installconfig real-packages sign-packages package-pkg \ packages installconfig real-packages sign-packages package-pkg \
test-system-compiler print-dir test-system-compiler
# XXX: r156740: This can't work since bsd.subdir.mk is not included ever. # XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
# It will only work for SUBDIR_TARGETS in make.conf. # It will only work for SUBDIR_TARGETS in make.conf.
@ -257,6 +258,10 @@ _TARGET_ARCH= ${XDEV_ARCH}
_TARGET?= ${MACHINE} _TARGET?= ${MACHINE}
_TARGET_ARCH?= ${MACHINE_ARCH} _TARGET_ARCH?= ${MACHINE_ARCH}
.if make(print-dir)
.SILENT:
.endif
# #
# Make sure we have an up-to-date make(1). Only world and buildworld # Make sure we have an up-to-date make(1). Only world and buildworld
# should do this as those are the initial targets used for upgrades. # should do this as those are the initial targets used for upgrades.

View File

@ -166,6 +166,9 @@ main(int argc, char *argv[])
hflag = 0; hflag = 0;
break; break;
case 'l': case 'l':
/* Ignore duplicate -l */
if (lflag)
break;
if (vfslist != NULL) if (vfslist != NULL)
xo_errx(1, "-l and -t are mutually exclusive."); xo_errx(1, "-l and -t are mutually exclusive.");
vfslist = makevfslist(makenetvfslist()); vfslist = makevfslist(makenetvfslist());

View File

@ -644,11 +644,8 @@ ctf_type_compat(ctf_file_t *lfp, ctf_id_t ltype,
} }
} }
/* static int
* Return the type and offset for a given member of a STRUCT or UNION. _ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name, ulong_t off,
*/
int
ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
ctf_membinfo_t *mip) ctf_membinfo_t *mip)
{ {
ctf_file_t *ofp = fp; ctf_file_t *ofp = fp;
@ -673,9 +670,13 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
((uintptr_t)tp + increment); ((uintptr_t)tp + increment);
for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) { for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) {
if (mp->ctm_name == 0 &&
_ctf_member_info(fp, mp->ctm_type, name,
mp->ctm_offset + off, mip) == 0)
return (0);
if (strcmp(ctf_strptr(fp, mp->ctm_name), name) == 0) { if (strcmp(ctf_strptr(fp, mp->ctm_name), name) == 0) {
mip->ctm_type = mp->ctm_type; mip->ctm_type = mp->ctm_type;
mip->ctm_offset = mp->ctm_offset; mip->ctm_offset = mp->ctm_offset + off;
return (0); return (0);
} }
} }
@ -684,9 +685,14 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
((uintptr_t)tp + increment); ((uintptr_t)tp + increment);
for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) { for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) {
if (lmp->ctlm_name == 0 &&
_ctf_member_info(fp, lmp->ctlm_name, name,
(ulong_t)CTF_LMEM_OFFSET(lmp) + off, mip) == 0)
return (0);
if (strcmp(ctf_strptr(fp, lmp->ctlm_name), name) == 0) { if (strcmp(ctf_strptr(fp, lmp->ctlm_name), name) == 0) {
mip->ctm_type = lmp->ctlm_type; mip->ctm_type = lmp->ctlm_type;
mip->ctm_offset = (ulong_t)CTF_LMEM_OFFSET(lmp); mip->ctm_offset =
(ulong_t)CTF_LMEM_OFFSET(lmp) + off;
return (0); return (0);
} }
} }
@ -695,6 +701,17 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
return (ctf_set_errno(ofp, ECTF_NOMEMBNAM)); return (ctf_set_errno(ofp, ECTF_NOMEMBNAM));
} }
/*
* Return the type and offset for a given member of a STRUCT or UNION.
*/
int
ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
ctf_membinfo_t *mip)
{
return (_ctf_member_info(fp, type, name, 0, mip));
}
/* /*
* Return the array type, index, and size information for the specified ARRAY. * Return the array type, index, and size information for the specified ARRAY.
*/ */

View File

@ -13,7 +13,9 @@ DIRDEPS = \
lib/libcompiler_rt \ lib/libcompiler_rt \
lib/libcxxrt \ lib/libcxxrt \
lib/libelf \ lib/libelf \
lib/libkvm \
lib/libproc \ lib/libproc \
lib/libprocstat \
lib/librtld_db \ lib/librtld_db \
lib/libthr \ lib/libthr \
lib/libutil \ lib/libutil \

View File

@ -13,7 +13,9 @@ DIRDEPS = \
lib/libcompiler_rt \ lib/libcompiler_rt \
lib/libcxxrt \ lib/libcxxrt \
lib/libelf \ lib/libelf \
lib/libkvm \
lib/libproc \ lib/libproc \
lib/libprocstat \
lib/librt \ lib/librt \
lib/librtld_db \ lib/librtld_db \
lib/libthr \ lib/libthr \

View File

@ -13,7 +13,9 @@ DIRDEPS = \
lib/libcompiler_rt \ lib/libcompiler_rt \
lib/libcxxrt \ lib/libcxxrt \
lib/libelf \ lib/libelf \
lib/libkvm \
lib/libproc \ lib/libproc \
lib/libprocstat \
lib/librtld_db \ lib/librtld_db \
lib/libthr \ lib/libthr \
lib/libutil \ lib/libutil \

View File

@ -0,0 +1,35 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs \
cddl/lib/libzfs_core \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libc++ \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libdevdctl \
lib/libexpat \
lib/libgeom \
lib/libmd \
lib/libsbuf \
lib/libthr \
lib/libutil \
lib/libz \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: elfdefinitions.h 3455 2016-05-09 13:47:29Z emaste $ * $Id: elfdefinitions.h 3485 2016-08-18 13:38:52Z emaste $
*/ */
/* /*
@ -2091,7 +2091,10 @@ _ELF_DEFINE_RELOC(R_RISCV_GNU_VTINHERIT, 41) \
_ELF_DEFINE_RELOC(R_RISCV_GNU_VTENTRY, 42) \ _ELF_DEFINE_RELOC(R_RISCV_GNU_VTENTRY, 42) \
_ELF_DEFINE_RELOC(R_RISCV_ALIGN, 43) \ _ELF_DEFINE_RELOC(R_RISCV_ALIGN, 43) \
_ELF_DEFINE_RELOC(R_RISCV_RVC_BRANCH, 44) \ _ELF_DEFINE_RELOC(R_RISCV_RVC_BRANCH, 44) \
_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45) _ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45) \
_ELF_DEFINE_RELOC(R_RISCV_RVC_LUI, 46) \
_ELF_DEFINE_RELOC(R_RISCV_GPREL_I, 47) \
_ELF_DEFINE_RELOC(R_RISCV_GPREL_S, 48)
#define _ELF_DEFINE_SPARC_RELOCATIONS() \ #define _ELF_DEFINE_SPARC_RELOCATIONS() \
_ELF_DEFINE_RELOC(R_SPARC_NONE, 0) \ _ELF_DEFINE_RELOC(R_SPARC_NONE, 0) \

View File

@ -38,7 +38,7 @@
#include "elfcopy.h" #include "elfcopy.h"
ELFTC_VCSID("$Id: archive.c 3287 2015-12-31 16:58:48Z emaste $"); ELFTC_VCSID("$Id: archive.c 3490 2016-08-31 00:12:22Z emaste $");
#define _ARMAG_LEN 8 /* length of ar magic string */ #define _ARMAG_LEN 8 /* length of ar magic string */
#define _ARHDR_LEN 60 /* length of ar header */ #define _ARHDR_LEN 60 /* length of ar header */
@ -440,6 +440,7 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
struct archive *a; struct archive *a;
struct archive_entry *entry; struct archive_entry *entry;
struct ar_obj *obj; struct ar_obj *obj;
time_t timestamp;
int nr; int nr;
if ((a = archive_write_new()) == NULL) if ((a = archive_write_new()) == NULL)
@ -450,7 +451,9 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
/* Write the archive symbol table, even if it's empty. */ /* Write the archive symbol table, even if it's empty. */
entry = archive_entry_new(); entry = archive_entry_new();
archive_entry_copy_pathname(entry, "/"); archive_entry_copy_pathname(entry, "/");
archive_entry_set_mtime(entry, time(NULL), 0); if (elftc_timestamp(&timestamp) != 0)
err(EXIT_FAILURE, "elftc_timestamp");
archive_entry_set_mtime(entry, timestamp, 0);
archive_entry_set_size(entry, (ecp->s_cnt + 1) * sizeof(uint32_t) + archive_entry_set_size(entry, (ecp->s_cnt + 1) * sizeof(uint32_t) +
ecp->s_sn_sz); ecp->s_sn_sz);
AC(archive_write_header(a, entry)); AC(archive_write_header(a, entry));

View File

@ -36,7 +36,7 @@
#include "elfcopy.h" #include "elfcopy.h"
ELFTC_VCSID("$Id: ascii.c 3446 2016-05-03 01:31:17Z emaste $"); ELFTC_VCSID("$Id: ascii.c 3487 2016-08-24 18:12:08Z emaste $");
static void append_data(struct section *s, const void *buf, size_t sz); static void append_data(struct section *s, const void *buf, size_t sz);
static char hex_digit(uint8_t n); static char hex_digit(uint8_t n);
@ -251,7 +251,7 @@ create_elf_from_srec(struct elfcopy *ecp, int ifd)
sec_index = 1; sec_index = 1;
sec_addr = entry = 0; sec_addr = entry = 0;
while (fgets(line, _LINE_BUFSZ, ifp) != NULL) { while (fgets(line, _LINE_BUFSZ, ifp) != NULL) {
sz = 0; /* Silence GCC 5.3 uninitialized variable warning */ sz = 0;
if (line[0] == '\r' || line[0] == '\n') if (line[0] == '\r' || line[0] == '\n')
continue; continue;
if (line[0] == '$' && line[1] == '$') { if (line[0] == '$' && line[1] == '$') {

View File

@ -34,7 +34,7 @@
#include "elfcopy.h" #include "elfcopy.h"
ELFTC_VCSID("$Id: pe.c 3477 2016-05-25 20:00:42Z kaiwang27 $"); ELFTC_VCSID("$Id: pe.c 3490 2016-08-31 00:12:22Z emaste $");
/* Convert ELF object to Portable Executable (PE). */ /* Convert ELF object to Portable Executable (PE). */
void void
@ -54,6 +54,7 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
PE_Buffer *pb; PE_Buffer *pb;
const char *name; const char *name;
size_t indx; size_t indx;
time_t timestamp;
int elferr; int elferr;
if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64) if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64)
@ -89,7 +90,9 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
pch.ch_machine = IMAGE_FILE_MACHINE_UNKNOWN; pch.ch_machine = IMAGE_FILE_MACHINE_UNKNOWN;
break; break;
} }
pch.ch_timestamp = (uint32_t) time(NULL); if (elftc_timestamp(&timestamp) != 0)
err(EXIT_FAILURE, "elftc_timestamp");
pch.ch_timestamp = (uint32_t) timestamp;
if (pe_update_coff_header(pe, &pch) < 0) if (pe_update_coff_header(pe, &pch) < 0)
err(EXIT_FAILURE, "pe_update_coff_header() failed"); err(EXIT_FAILURE, "pe_update_coff_header() failed");

View File

@ -50,7 +50,7 @@
#include "_elftc.h" #include "_elftc.h"
ELFTC_VCSID("$Id: elfdump.c 3474 2016-05-17 20:44:53Z emaste $"); ELFTC_VCSID("$Id: elfdump.c 3482 2016-08-02 18:47:00Z emaste $");
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
#include "native-elf-format.h" #include "native-elf-format.h"
@ -332,6 +332,8 @@ static const char *ei_abis[256] = {
"ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64", "ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64",
"ELFOSABI_MODESTO", "ELFOSABI_OPENBSD", "ELFOSABI_MODESTO", "ELFOSABI_OPENBSD",
[17] = "ELFOSABI_CLOUDABI", [17] = "ELFOSABI_CLOUDABI",
[64] = "ELFOSABI_ARM_AEABI",
[97] = "ELFOSABI_ARM",
[255] = "ELFOSABI_STANDALONE" [255] = "ELFOSABI_STANDALONE"
}; };

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of .\" out of the use of this software, even if advised of the possibility of
.\" such damage. .\" such damage.
.\" .\"
.\" $Id: elf_flagdata.3 2884 2013-01-11 02:03:46Z jkoshy $ .\" $Id: elf_flagdata.3 3479 2016-06-25 20:44:33Z jkoshy $
.\" .\"
.Dd December 3, 2011 .Dd December 3, 2011
.Os .Os
@ -208,16 +208,13 @@ was called without a program header being allocated.
.Xr elf 3 , .Xr elf 3 ,
.Xr elf32_newehdr 3 , .Xr elf32_newehdr 3 ,
.Xr elf32_newphdr 3 , .Xr elf32_newphdr 3 ,
.Xr elf32_newshdr 3 ,
.Xr elf64_newehdr 3 , .Xr elf64_newehdr 3 ,
.Xr elf64_newphdr 3 , .Xr elf64_newphdr 3 ,
.Xr elf64_newshdr 3 ,
.Xr elf_newdata 3 , .Xr elf_newdata 3 ,
.Xr elf_update 3 , .Xr elf_update 3 ,
.Xr gelf 3 , .Xr gelf 3 ,
.Xr gelf_newehdr 3 , .Xr gelf_newehdr 3 ,
.Xr gelf_newphdr 3 , .Xr gelf_newphdr 3 ,
.Xr gelf_newshdr 3 ,
.Xr gelf_update_dyn 3 , .Xr gelf_update_dyn 3 ,
.Xr gelf_update_move 3 , .Xr gelf_update_move 3 ,
.Xr gelf_update_rel 3 , .Xr gelf_update_rel 3 ,

View File

@ -1,4 +1,4 @@
# $Id: Makefile 3418 2016-02-19 20:04:42Z emaste $ # $Id: Makefile 3489 2016-08-31 00:12:15Z emaste $
TOP= ${.CURDIR}/.. TOP= ${.CURDIR}/..
@ -10,6 +10,7 @@ SRCS= elftc_bfdtarget.c \
elftc_reloc_type_str.c \ elftc_reloc_type_str.c \
elftc_set_timestamps.c \ elftc_set_timestamps.c \
elftc_string_table.c \ elftc_string_table.c \
elftc_timestamp.c \
elftc_version.c \ elftc_version.c \
libelftc_bfdtarget.c \ libelftc_bfdtarget.c \
libelftc_dem_arm.c \ libelftc_dem_arm.c \

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of .\" out of the use of this software, even if advised of the possibility of
.\" such damage. .\" such damage.
.\" .\"
.\" $Id: elftc_bfd_find_target.3 3348 2016-01-18 14:18:50Z emaste $ .\" $Id: elftc_bfd_find_target.3 3488 2016-08-24 18:15:57Z emaste $
.\" .\"
.Dd November 30, 2011 .Dd November 30, 2011
.Os .Os

View File

@ -545,6 +545,9 @@ elftc_reloc_type_str(unsigned int mach, unsigned int type)
case 43: return "R_RISCV_ALIGN"; case 43: return "R_RISCV_ALIGN";
case 44: return "R_RISCV_RVC_BRANCH"; case 44: return "R_RISCV_RVC_BRANCH";
case 45: return "R_RISCV_RVC_JUMP"; case 45: return "R_RISCV_RVC_JUMP";
case 46: return "R_RISCV_RVC_LUI";
case 47: return "R_RISCV_GPREL_I";
case 48: return "R_RISCV_GPREL_S";
} }
break; break;
case EM_SPARC: case EM_SPARC:

View File

@ -0,0 +1,79 @@
.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved.
.\"
.\" This documentation was written by Ed Maste under sponsorship of
.\" the FreeBSD Foundation.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" This software is provided by the author and contributors ``as is'' and
.\" any express or implied warranties, including, but not limited to, the
.\" implied warranties of merchantability and fitness for a particular purpose
.\" are disclaimed. In no event shall the author or contributors be liable
.\" for any direct, indirect, incidental, special, exemplary, or consequential
.\" damages (including, but not limited to, procurement of substitute goods
.\" or services; loss of use, data, or profits; or business interruption)
.\" however caused and on any theory of liability, whether in contract, strict
.\" liability, or tort (including negligence or otherwise) arising in any way
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id$
.\"
.Dd August 24, 2016
.Os
.Dt ELFTC_TIMESTAMP 3
.Sh NAME
.Nm elftc_timestamp
.Nd return the current or environment-provided timestamp
.Sh LIBRARY
.Lb libelftc
.Sh SYNOPSIS
.In libelftc.h
.Ft int
.Fo elftc_timestamp
.Fa "time_t *timestamp"
.Fc
.Sh DESCRIPTION
The
.Fn elftc_timestamp
function returns a timestamp supplied by the
.Ev SOURCE_DATE_EPOCH
environment variable, or the current time provided by
.Xr time 3
if the environment variable is not set.
.Pp
The
.Ar timestamp
argument specifies a pointer to the location where the timestamp will be
stored.
.Sh RETURN VALUE
Function
.Fn elftc_timestamp
returns 0 on success, and -1 in the event of an error.
.Sh ERRORS
The
.Fn elftc_timestamp
function may fail with the following errors:
.Bl -tag -width ".Bq Er ERANGE"
.It Bq Er EINVAL
.Ev SOURCE_DATE_EPOCH
contains invalid characters.
.It Bq Er ERANGE
.Ev SOURCE_DATE_EPOCH
specifies a negative value or a value that cannot be stored in a
time_t.
.El
The
.Fn elftc_timestamp
function may also fail for any of the reasons described in
.Xr strtoll 3 .
.Sh SEE ALSO
.Xr strtoll 3 ,
.Xr time 3

View File

@ -0,0 +1,55 @@
/*-
* Copyright (c) 2016 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by Ed Maste under sponsorship
* of the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#include <libelftc.h>
int
elftc_timestamp(time_t *timestamp)
{
long long source_date_epoch;
char *env, *eptr;
if ((env = getenv("SOURCE_DATE_EPOCH")) != NULL) {
errno = 0;
source_date_epoch = strtoll(env, &eptr, 10);
if (*eptr != '\0')
errno = EINVAL;
if (source_date_epoch < 0)
errno = ERANGE;
if (errno != 0)
return (-1);
*timestamp = source_date_epoch;
return (0);
}
*timestamp = time(NULL);
return (0);
}

View File

@ -24,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $ * $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $
* $Id: libelftc.h 3418 2016-02-19 20:04:42Z emaste $ * $Id: libelftc.h 3489 2016-08-31 00:12:15Z emaste $
*/ */
#ifndef _LIBELFTC_H_ #ifndef _LIBELFTC_H_
@ -91,6 +91,7 @@ int elftc_string_table_remove(Elftc_String_Table *_table,
const char *_string); const char *_string);
const char *elftc_string_table_to_string(Elftc_String_Table *_table, const char *elftc_string_table_to_string(Elftc_String_Table *_table,
size_t offset); size_t offset);
int elftc_timestamp(time_t *_timestamp);
const char *elftc_version(void); const char *elftc_version(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -30,7 +30,7 @@
#include "_libelftc.h" #include "_libelftc.h"
ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3309 2016-01-10 09:10:51Z kaiwang27 $"); ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3488 2016-08-24 18:15:57Z emaste $");
struct _Elftc_Bfd_Target _libelftc_targets[] = { struct _Elftc_Bfd_Target _libelftc_targets[] = {

View File

@ -36,7 +36,7 @@
#include "_libelftc.h" #include "_libelftc.h"
ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3447 2016-05-03 13:32:23Z emaste $"); ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3480 2016-07-24 23:38:41Z emaste $");
/** /**
* @file cpp_demangle.c * @file cpp_demangle.c

View File

@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.\" $Id: readelf.1 3219 2015-05-24 23:42:34Z kaiwang27 $ .\" $Id: readelf.1 3486 2016-08-22 14:10:05Z emaste $
.\" .\"
.Dd September 13, 2012 .Dd September 13, 2012
.Os .Os
@ -43,12 +43,12 @@
.Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section .Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section
.Op Fl r | Fl -relocs .Op Fl r | Fl -relocs
.Op Fl t | Fl -section-details .Op Fl t | Fl -section-details
.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
.Op Fl v | Fl -version .Op Fl v | Fl -version
.Oo .Oo
.Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc | .Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc |
.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ... .Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
.Oc .Oc
.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
.Op Fl A | Fl -arch-specific .Op Fl A | Fl -arch-specific
.Op Fl D | Fl -use-dynamic .Op Fl D | Fl -use-dynamic
.Op Fl H | Fl -help .Op Fl H | Fl -help

View File

@ -47,7 +47,7 @@
#include "_elftc.h" #include "_elftc.h"
ELFTC_VCSID("$Id: readelf.c 3469 2016-05-15 23:16:09Z emaste $"); ELFTC_VCSID("$Id: readelf.c 3484 2016-08-03 13:36:49Z emaste $");
/* Backwards compatability for older FreeBSD releases. */ /* Backwards compatability for older FreeBSD releases. */
#ifndef STB_GNU_UNIQUE #ifndef STB_GNU_UNIQUE
@ -440,6 +440,7 @@ elf_osabi(unsigned int abi)
case ELFOSABI_OPENVMS: return "OpenVMS"; case ELFOSABI_OPENVMS: return "OpenVMS";
case ELFOSABI_NSK: return "NSK"; case ELFOSABI_NSK: return "NSK";
case ELFOSABI_CLOUDABI: return "CloudABI"; case ELFOSABI_CLOUDABI: return "CloudABI";
case ELFOSABI_ARM_AEABI: return "ARM EABI";
case ELFOSABI_ARM: return "ARM"; case ELFOSABI_ARM: return "ARM";
case ELFOSABI_STANDALONE: return "StandAlone"; case ELFOSABI_STANDALONE: return "StandAlone";
default: default:
@ -2787,6 +2788,8 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
const char *symname; const char *symname;
uint64_t symval; uint64_t symval;
int i, len; int i, len;
uint32_t type;
uint8_t type2, type3;
if (s->link >= re->shnum) if (s->link >= re->shnum)
return; return;
@ -2796,8 +2799,8 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
elftc_reloc_type_str(re->ehdr.e_machine, \ elftc_reloc_type_str(re->ehdr.e_machine, \
ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname
#define REL_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \ #define REL_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
elftc_reloc_type_str(re->ehdr.e_machine, \ elftc_reloc_type_str(re->ehdr.e_machine, type), \
ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname (uintmax_t)symval, symname
printf("\nRelocation section (%s):\n", s->name); printf("\nRelocation section (%s):\n", s->name);
if (re->ec == ELFCLASS32) if (re->ec == ELFCLASS32)
@ -2823,12 +2826,37 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
ELF64_R_TYPE(r.r_info)); ELF64_R_TYPE(r.r_info));
printf("%8.8jx %8.8jx %-19.19s %8.8jx %s\n", REL_CT32); printf("%8.8jx %8.8jx %-19.19s %8.8jx %s\n", REL_CT32);
} else { } else {
type = ELF64_R_TYPE(r.r_info);
if (re->ehdr.e_machine == EM_MIPS) {
type2 = (type >> 8) & 0xFF;
type3 = (type >> 16) & 0xFF;
type = type & 0xFF;
} else {
type2 = type3 = 0;
}
if (re->options & RE_WW) if (re->options & RE_WW)
printf("%16.16jx %16.16jx %-24.24s" printf("%16.16jx %16.16jx %-24.24s"
" %16.16jx %s\n", REL_CT64); " %16.16jx %s\n", REL_CT64);
else else
printf("%12.12jx %12.12jx %-19.19s" printf("%12.12jx %12.12jx %-19.19s"
" %16.16jx %s\n", REL_CT64); " %16.16jx %s\n", REL_CT64);
if (re->ehdr.e_machine == EM_MIPS) {
if (re->options & RE_WW) {
printf("%32s: %s\n", "Type2",
elftc_reloc_type_str(EM_MIPS,
type2));
printf("%32s: %s\n", "Type3",
elftc_reloc_type_str(EM_MIPS,
type3));
} else {
printf("%24s: %s\n", "Type2",
elftc_reloc_type_str(EM_MIPS,
type2));
printf("%24s: %s\n", "Type3",
elftc_reloc_type_str(EM_MIPS,
type3));
}
}
} }
} }
@ -2843,6 +2871,8 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
const char *symname; const char *symname;
uint64_t symval; uint64_t symval;
int i, len; int i, len;
uint32_t type;
uint8_t type2, type3;
if (s->link >= re->shnum) if (s->link >= re->shnum)
return; return;
@ -2853,8 +2883,8 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
elftc_reloc_type_str(re->ehdr.e_machine, \ elftc_reloc_type_str(re->ehdr.e_machine, \
ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname
#define RELA_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \ #define RELA_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
elftc_reloc_type_str(re->ehdr.e_machine, \ elftc_reloc_type_str(re->ehdr.e_machine, type), \
ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname (uintmax_t)symval, symname
printf("\nRelocation section with addend (%s):\n", s->name); printf("\nRelocation section with addend (%s):\n", s->name);
if (re->ec == ELFCLASS32) if (re->ec == ELFCLASS32)
@ -2881,6 +2911,14 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
printf("%8.8jx %8.8jx %-19.19s %8.8jx %s", RELA_CT32); printf("%8.8jx %8.8jx %-19.19s %8.8jx %s", RELA_CT32);
printf(" + %x\n", (uint32_t) r.r_addend); printf(" + %x\n", (uint32_t) r.r_addend);
} else { } else {
type = ELF64_R_TYPE(r.r_info);
if (re->ehdr.e_machine == EM_MIPS) {
type2 = (type >> 8) & 0xFF;
type3 = (type >> 16) & 0xFF;
type = type & 0xFF;
} else {
type2 = type3 = 0;
}
if (re->options & RE_WW) if (re->options & RE_WW)
printf("%16.16jx %16.16jx %-24.24s" printf("%16.16jx %16.16jx %-24.24s"
" %16.16jx %s", RELA_CT64); " %16.16jx %s", RELA_CT64);
@ -2888,6 +2926,23 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
printf("%12.12jx %12.12jx %-19.19s" printf("%12.12jx %12.12jx %-19.19s"
" %16.16jx %s", RELA_CT64); " %16.16jx %s", RELA_CT64);
printf(" + %jx\n", (uintmax_t) r.r_addend); printf(" + %jx\n", (uintmax_t) r.r_addend);
if (re->ehdr.e_machine == EM_MIPS) {
if (re->options & RE_WW) {
printf("%32s: %s\n", "Type2",
elftc_reloc_type_str(EM_MIPS,
type2));
printf("%32s: %s\n", "Type3",
elftc_reloc_type_str(EM_MIPS,
type3));
} else {
printf("%24s: %s\n", "Type2",
elftc_reloc_type_str(EM_MIPS,
type2));
printf("%24s: %s\n", "Type3",
elftc_reloc_type_str(EM_MIPS,
type3));
}
}
} }
} }

View File

@ -0,0 +1,134 @@
/*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* In addition to the permissions in the GNU General Public License, the
* Free Software Foundation gives you unlimited permission to link the
* compiled version of this file with other programs, and to distribute
* those programs without any restriction coming from the use of this
* file. (The General Public License restrictions do apply in other
* respects; for example, they cover modification of the file, and
* distribution when not linked into another program.)
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* As a special exception, if you link this library with files
* compiled with GCC to produce an executable, this does not cause
* the resulting executable to be covered by the GNU General Public License.
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*/
/* %ecx */
#define bit_SSE3 (1 << 0)
#define bit_SSSE3 (1 << 9)
#define bit_CMPXCHG16B (1 << 13)
#define bit_SSE4_1 (1 << 19)
#define bit_SSE4_2 (1 << 20)
#define bit_POPCNT (1 << 23)
/* %edx */
#define bit_CMPXCHG8B (1 << 8)
#define bit_CMOV (1 << 15)
#define bit_MMX (1 << 23)
#define bit_FXSAVE (1 << 24)
#define bit_SSE (1 << 25)
#define bit_SSE2 (1 << 26)
/* Extended Features */
/* %ecx */
#define bit_LAHF_LM (1 << 0)
#define bit_SSE4a (1 << 6)
#define bit_SSE5 (1 << 11)
/* %edx */
#define bit_LM (1 << 29)
#define bit_3DNOWP (1 << 30)
#define bit_3DNOW (1 << 31)
#if defined(__i386__) && defined(__PIC__)
/* %ebx may be the PIC register. */
#define __cpuid(level, a, b, c, d) \
__asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
"cpuid\n\t" \
"xchg{l}\t{%%}ebx, %1\n\t" \
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
: "0" (level))
#else
#define __cpuid(level, a, b, c, d) \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
: "0" (level))
#endif
/* Return highest supported input value for cpuid instruction. ext can
be either 0x0 or 0x8000000 to return highest supported value for
basic or extended cpuid information. Function returns 0 if cpuid
is not supported or whatever cpuid returns in eax register. If sig
pointer is non-null, then first four bytes of the signature
(as found in ebx register) are returned in location pointed by sig. */
static __inline unsigned int
__get_cpuid_max (unsigned int __ext, unsigned int *__sig)
{
unsigned int __eax, __ebx, __ecx, __edx;
#ifndef __x86_64__
/* See if we can use cpuid. On AMD64 we always can. */
__asm__ ("pushf{l|d}\n\t"
"pushf{l|d}\n\t"
"pop{l}\t%0\n\t"
"mov{l}\t{%0, %1|%1, %0}\n\t"
"xor{l}\t{%2, %0|%0, %2}\n\t"
"push{l}\t%0\n\t"
"popf{l|d}\n\t"
"pushf{l|d}\n\t"
"pop{l}\t%0\n\t"
"popf{l|d}\n\t"
: "=&r" (__eax), "=&r" (__ebx)
: "i" (0x00200000));
if (!((__eax ^ __ebx) & 0x00200000))
return 0;
#endif
/* Host supports cpuid. Return highest supported cpuid input value. */
__cpuid (__ext, __eax, __ebx, __ecx, __edx);
if (__sig)
*__sig = __ebx;
return __eax;
}
/* Return cpuid data for requested cpuid level, as found in returned
eax, ebx, ecx and edx registers. The function checks if cpuid is
supported and returns 1 for valid cpuid information or 0 for
unsupported cpuid level. All pointers are required to be non-null. */
static __inline int
__get_cpuid (unsigned int __level,
unsigned int *__eax, unsigned int *__ebx,
unsigned int *__ecx, unsigned int *__edx)
{
unsigned int __ext = __level & 0x80000000;
if (__get_cpuid_max (__ext, 0) < __level)
return 0;
__cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
return 1;
}

View File

@ -1912,6 +1912,13 @@ underscores.
@table @code @table @code
@item __COUNTER__
This macro expands to sequential integral values starting from 0. In
conjuction with the @code{##} operator, this provides a convenient means to
generate unique identifiers. Care must be taken to ensure that
@code{__COUNTER__} is not expanded prior to inclusion of precompiled headers
which use it. Otherwise, the precompiled headers will not be used.
@item __GNUC__ @item __GNUC__
@itemx __GNUC_MINOR__ @itemx __GNUC_MINOR__
@itemx __GNUC_PATCHLEVEL__ @itemx __GNUC_PATCHLEVEL__

View File

@ -12,6 +12,17 @@
PR preprocessor/14331 PR preprocessor/14331
* lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF. * lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF.
2007-05-24 Ollie Wild <aaw@google.com> (r125041)
* macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER.
* pch.c (cpp_write_pch_deps): Save __COUNTER__ state.
(cpp_write_pch_state): Save __COUNTER__ state.
(cpp_valid_state): Check valid __COUNTER__ state.
(cpp_read_state): Read new __COUNTER__ state.
* include/cpplib.h (enum builtin_type): Add BT_COUNTER enumerator.
* init.c (builtin_array): Add __COUNTER__/BT_COUNTER.
* internal.h (struct cpp_reader): Add counter member.
2007-05-21 Ian Lance Taylor <iant@google.com> (r124929) 2007-05-21 Ian Lance Taylor <iant@google.com> (r124929)
* internal.h (struct cpp_reader): Add new fields: * internal.h (struct cpp_reader): Add new fields:

View File

@ -458,7 +458,8 @@ struct cpp_reader
of precompiled headers. */ of precompiled headers. */
struct cpp_savedstate *savedstate; struct cpp_savedstate *savedstate;
unsigned int nextcounter; /* Next value of __COUNTER__ macro. */
unsigned int counter;
}; };
/* Character classes. Based on the more primitive macros in safe-ctype.h. /* Character classes. Based on the more primitive macros in safe-ctype.h.

View File

@ -268,7 +268,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
if (CPP_OPTION (pfile, directives_only) && pfile->state.in_directive) if (CPP_OPTION (pfile, directives_only) && pfile->state.in_directive)
cpp_error (pfile, CPP_DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"__COUNTER__ expanded inside directive with -fdirectives-only"); "__COUNTER__ expanded inside directive with -fdirectives-only");
number = pfile->nextcounter++; number = pfile->counter++;
break; break;
} }

View File

@ -337,6 +337,14 @@ cpp_write_pch_deps (cpp_reader *r, FILE *f)
/* Free the saved state. */ /* Free the saved state. */
free (ss); free (ss);
r->savedstate = NULL; r->savedstate = NULL;
/* Save the next value of __COUNTER__. */
if (fwrite (&r->counter, sizeof (r->counter), 1, f) != 1)
{
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
return -1;
}
return 0; return 0;
} }
@ -361,6 +369,15 @@ cpp_write_pch_state (cpp_reader *r, FILE *f)
return -1; return -1;
} }
/* Save the next __COUNTER__ value. When we include a precompiled header,
we need to start at the offset we would have if the header had been
included normally. */
if (fwrite (&r->counter, sizeof (r->counter), 1, f) != 1)
{
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
return -1;
}
return 0; return 0;
} }
@ -423,6 +440,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
struct ht_node_list nl = { 0, 0, 0 }; struct ht_node_list nl = { 0, 0, 0 };
unsigned char *first, *last; unsigned char *first, *last;
unsigned int i; unsigned int i;
unsigned int counter;
/* Read in the list of identifiers that must be defined /* Read in the list of identifiers that must be defined
Check that they are defined in the same way. */ Check that they are defined in the same way. */
@ -524,7 +542,23 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
} }
free(nl.defs); free(nl.defs);
nl.defs = NULL;
free (undeftab); free (undeftab);
undeftab = NULL;
/* Read in the next value of __COUNTER__.
Check that (a) __COUNTER__ was not used in the pch or (b) __COUNTER__
has not been used in this translation unit. */
if (read (fd, &counter, sizeof (counter)) != sizeof (counter))
goto error;
if (counter && r->counter)
{
if (CPP_OPTION (r, warn_invalid_pch))
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `__COUNTER__' is invalid",
name);
goto fail;
}
/* We win! */ /* We win! */
return 0; return 0;
@ -631,6 +665,7 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
{ {
size_t i; size_t i;
struct lexer_state old_state; struct lexer_state old_state;
unsigned int counter;
/* Restore spec_nodes, which will be full of references to the old /* Restore spec_nodes, which will be full of references to the old
hashtable entries and so will now be invalid. */ hashtable entries and so will now be invalid. */
@ -690,6 +725,12 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
if (! _cpp_read_file_entries (r, f)) if (! _cpp_read_file_entries (r, f))
goto error; goto error;
if (fread (&counter, sizeof (counter), 1, f) != 1)
goto error;
if (!r->counter)
r->counter = counter;
return 0; return 0;
error: error:

View File

@ -164,7 +164,7 @@ genkeys(char *public, char *secret)
MINT *pk = mp_itom(0); MINT *pk = mp_itom(0);
MINT *sk = mp_itom(0); MINT *sk = mp_itom(0);
MINT *tmp; MINT *tmp;
MINT *base = mp_itom(BASE); MINT *base = mp_itom((short)BASE);
MINT *root = mp_itom(PROOT); MINT *root = mp_itom(PROOT);
MINT *modulus = mp_xtom(HEXMODULUS); MINT *modulus = mp_xtom(HEXMODULUS);
short r; short r;

View File

@ -112,7 +112,7 @@ static int send_tncmd(void (*)(int, int), const char *, char *);
static int setmod(int); static int setmod(int);
static int clearmode(int); static int clearmode(int);
static int modehelp(void); static int modehelp(void);
static int sourceroute(struct addrinfo *, char *, char **, int *, int *, int *); static int sourceroute(struct addrinfo *, char *, unsigned char **, int *, int *, int *);
typedef struct { typedef struct {
const char *name; /* command name */ const char *name; /* command name */
@ -2171,7 +2171,7 @@ switch_af(struct addrinfo **aip)
int int
tn(int argc, char *argv[]) tn(int argc, char *argv[])
{ {
char *srp = 0; unsigned char *srp = 0;
int proto, opt; int proto, opt;
int srlen; int srlen;
int srcroute = 0, result; int srcroute = 0, result;
@ -2844,10 +2844,10 @@ cmdrc(char *m1, char *m2)
* setsockopt, as socket protocol family. * setsockopt, as socket protocol family.
*/ */
static int static int
sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, int *optp) sourceroute(struct addrinfo *ai, char *arg, unsigned char **cpp, int *lenp, int *protop, int *optp)
{ {
static char buf[1024 + ALIGNBYTES]; /*XXX*/ static char buf[1024 + ALIGNBYTES]; /*XXX*/
char *cp, *cp2, *lsrp, *ep; unsigned char *cp, *cp2, *lsrp, *ep;
struct sockaddr_in *_sin; struct sockaddr_in *_sin;
#ifdef INET6 #ifdef INET6
struct sockaddr_in6 *sin6; struct sockaddr_in6 *sin6;

View File

@ -2050,7 +2050,7 @@ abort_squared(int dummy)
void void
abort_remote(FILE *din) abort_remote(FILE *din)
{ {
char buf[BUFSIZ]; unsigned char buf[BUFSIZ];
int nfnd; int nfnd;
if (cout == NULL) { if (cout == NULL) {

View File

@ -98,6 +98,7 @@
#include "ssh-gss.h" #include "ssh-gss.h"
#endif #endif
#include "monitor_wrap.h" #include "monitor_wrap.h"
#include "blacklist_client.h"
extern ServerOptions options; extern ServerOptions options;
extern Buffer loginmsg; extern Buffer loginmsg;
@ -794,6 +795,7 @@ sshpam_query(void *ctx, char **name, char **info,
free(msg); free(msg);
return (0); return (0);
} }
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
error("PAM: %s for %s%.100s from %.100s", msg, error("PAM: %s for %s%.100s from %.100s", msg,
sshpam_authctxt->valid ? "" : "illegal user ", sshpam_authctxt->valid ? "" : "illegal user ",
sshpam_authctxt->user, sshpam_authctxt->user,

View File

@ -75,6 +75,7 @@ __RCSID("$FreeBSD$");
#include "authfile.h" #include "authfile.h"
#include "ssherr.h" #include "ssherr.h"
#include "compat.h" #include "compat.h"
#include "blacklist_client.h"
/* import */ /* import */
extern ServerOptions options; extern ServerOptions options;
@ -292,8 +293,11 @@ auth_log(Authctxt *authctxt, int authenticated, int partial,
authmsg = "Postponed"; authmsg = "Postponed";
else if (partial) else if (partial)
authmsg = "Partial"; authmsg = "Partial";
else else {
authmsg = authenticated ? "Accepted" : "Failed"; authmsg = authenticated ? "Accepted" : "Failed";
BLACKLIST_NOTIFY(authenticated ?
BLACKLIST_AUTH_OK : BLACKLIST_AUTH_FAIL);
}
authlog("%s %s%s%s for %s%.100s from %.200s port %d %s%s%s", authlog("%s %s%s%s for %s%.100s from %.200s port %d %s%s%s",
authmsg, authmsg,
@ -640,6 +644,7 @@ getpwnamallow(const char *user)
} }
#endif #endif
if (pw == NULL) { if (pw == NULL) {
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
logit("Invalid user %.100s from %.100s", logit("Invalid user %.100s from %.100s",
user, get_remote_ipaddr()); user, get_remote_ipaddr());
#ifdef CUSTOM_FAILED_LOGIN #ifdef CUSTOM_FAILED_LOGIN

View File

@ -43,6 +43,7 @@
#endif #endif
#include "monitor_wrap.h" #include "monitor_wrap.h"
#include "buffer.h" #include "buffer.h"
#include "blacklist_client.h"
/* import */ /* import */
extern ServerOptions options; extern ServerOptions options;
@ -337,6 +338,7 @@ do_authloop(Authctxt *authctxt)
char *msg; char *msg;
size_t len; size_t len;
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
error("Access denied for user %s by PAM account " error("Access denied for user %s by PAM account "
"configuration", authctxt->user); "configuration", authctxt->user);
len = buffer_len(&loginmsg); len = buffer_len(&loginmsg);
@ -404,6 +406,7 @@ do_authentication(Authctxt *authctxt)
else { else {
debug("do_authentication: invalid user %s", user); debug("do_authentication: invalid user %s", user);
authctxt->pw = fakepw(); authctxt->pw = fakepw();
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
} }
/* Configuration may have changed as a result of Match */ /* Configuration may have changed as a result of Match */

View File

@ -52,6 +52,7 @@ __RCSID("$FreeBSD$");
#include "pathnames.h" #include "pathnames.h"
#include "buffer.h" #include "buffer.h"
#include "canohost.h" #include "canohost.h"
#include "blacklist_client.h"
#ifdef GSSAPI #ifdef GSSAPI
#include "ssh-gss.h" #include "ssh-gss.h"
@ -248,6 +249,7 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
} else { } else {
logit("input_userauth_request: invalid user %s", user); logit("input_userauth_request: invalid user %s", user);
authctxt->pw = fakepw(); authctxt->pw = fakepw();
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
#ifdef SSH_AUDIT_EVENTS #ifdef SSH_AUDIT_EVENTS
PRIVSEP(audit_event(SSH_INVALID_USER)); PRIVSEP(audit_event(SSH_INVALID_USER));
#endif #endif

View File

@ -0,0 +1,97 @@
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
* Copyright (c) 2016 The FreeBSD Foundation, Inc.
* All rights reserved.
*
* Portions of this software were developed by Kurt Lidl
* under sponsorship from the FreeBSD Foundation.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
#include <ctype.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <unistd.h>
#include "ssh.h"
#include "packet.h"
#include "log.h"
#include "misc.h"
#include "servconf.h"
#include "blacklist_client.h"
#include <blacklist.h>
static struct blacklist *blstate = NULL;
/* import */
extern ServerOptions options;
/* internal definition from bl.h */
struct blacklist *bl_create(bool, char *, void (*)(int, const char *, va_list));
/* impedence match vsyslog() to sshd's internal logging levels */
void
im_log(int priority, const char *message, va_list args)
{
LogLevel imlevel;
switch (priority) {
case LOG_ERR:
imlevel = SYSLOG_LEVEL_ERROR;
break;
case LOG_DEBUG:
imlevel = SYSLOG_LEVEL_DEBUG1;
break;
case LOG_INFO:
imlevel = SYSLOG_LEVEL_INFO;
break;
default:
imlevel = SYSLOG_LEVEL_DEBUG2;
}
do_log(imlevel, message, args);
}
void
blacklist_init(void)
{
if (options.use_blacklist)
blstate = bl_create(false, NULL, im_log);
}
void
blacklist_notify(int action)
{
if (blstate != NULL && packet_connection_is_on_socket())
(void)blacklist_r(blstate, action,
packet_get_connection_in(), "ssh");
}

View File

@ -0,0 +1,57 @@
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
* Copyright (c) 2016 The FreeBSD Foundation, Inc.
* All rights reserved.
*
* Portions of this software were developed by Kurt Lidl
* under sponsorship from the FreeBSD Foundation.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#ifndef BLACKLIST_CLIENT_H
#define BLACKLIST_CLIENT_H
enum {
BLACKLIST_AUTH_OK = 0,
BLACKLIST_AUTH_FAIL
};
#ifdef USE_BLACKLIST
void blacklist_init(void);
void blacklist_notify(int);
#define BLACKLIST_INIT() blacklist_init()
#define BLACKLIST_NOTIFY(x) blacklist_notify(x)
#else
#define BLACKLIST_INIT()
#define BLACKLIST_NOTIFY(x)
#endif
#endif /* BLACKLIST_CLIENT_H */

View File

@ -86,6 +86,7 @@ __RCSID("$FreeBSD$");
#include "packet.h" #include "packet.h"
#include "ssherr.h" #include "ssherr.h"
#include "sshbuf.h" #include "sshbuf.h"
#include "blacklist_client.h"
#ifdef PACKET_DEBUG #ifdef PACKET_DEBUG
#define DBG(x) x #define DBG(x) x
@ -2071,6 +2072,7 @@ sshpkt_fatal(struct ssh *ssh, const char *tag, int r)
case SSH_ERR_NO_KEX_ALG_MATCH: case SSH_ERR_NO_KEX_ALG_MATCH:
case SSH_ERR_NO_HOSTKEY_ALG_MATCH: case SSH_ERR_NO_HOSTKEY_ALG_MATCH:
if (ssh && ssh->kex && ssh->kex->failed_choice) { if (ssh && ssh->kex && ssh->kex->failed_choice) {
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
fatal("Unable to negotiate with %.200s port %d: %s. " fatal("Unable to negotiate with %.200s port %d: %s. "
"Their offer: %s", ssh_remote_ipaddr(ssh), "Their offer: %s", ssh_remote_ipaddr(ssh),
ssh_remote_port(ssh), ssh_err(r), ssh_remote_port(ssh), ssh_err(r),

View File

@ -172,6 +172,7 @@ initialize_server_options(ServerOptions *options)
options->ip_qos_bulk = -1; options->ip_qos_bulk = -1;
options->version_addendum = NULL; options->version_addendum = NULL;
options->fingerprint_hash = -1; options->fingerprint_hash = -1;
options->use_blacklist = -1;
} }
/* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */ /* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */
@ -360,6 +361,8 @@ fill_default_server_options(ServerOptions *options)
options->fwd_opts.streamlocal_bind_unlink = 0; options->fwd_opts.streamlocal_bind_unlink = 0;
if (options->fingerprint_hash == -1) if (options->fingerprint_hash == -1)
options->fingerprint_hash = SSH_FP_HASH_DEFAULT; options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
if (options->use_blacklist == -1)
options->use_blacklist = 0;
assemble_algorithms(options); assemble_algorithms(options);
@ -437,6 +440,7 @@ typedef enum {
sAuthenticationMethods, sHostKeyAgent, sPermitUserRC, sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
sStreamLocalBindMask, sStreamLocalBindUnlink, sStreamLocalBindMask, sStreamLocalBindUnlink,
sAllowStreamLocalForwarding, sFingerprintHash, sAllowStreamLocalForwarding, sFingerprintHash,
sUseBlacklist,
sDeprecated, sUnsupported sDeprecated, sUnsupported
} ServerOpCodes; } ServerOpCodes;
@ -579,6 +583,7 @@ static struct {
{ "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL }, { "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL },
{ "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL }, { "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL },
{ "fingerprinthash", sFingerprintHash, SSHCFG_GLOBAL }, { "fingerprinthash", sFingerprintHash, SSHCFG_GLOBAL },
{ "useblacklist", sUseBlacklist, SSHCFG_GLOBAL },
{ "noneenabled", sUnsupported, SSHCFG_ALL }, { "noneenabled", sUnsupported, SSHCFG_ALL },
{ "hpndisabled", sDeprecated, SSHCFG_ALL }, { "hpndisabled", sDeprecated, SSHCFG_ALL },
{ "hpnbuffersize", sDeprecated, SSHCFG_ALL }, { "hpnbuffersize", sDeprecated, SSHCFG_ALL },
@ -1861,6 +1866,10 @@ process_server_config_line(ServerOptions *options, char *line,
options->fingerprint_hash = value; options->fingerprint_hash = value;
break; break;
case sUseBlacklist:
intptr = &options->use_blacklist;
goto parse_flag;
case sDeprecated: case sDeprecated:
logit("%s line %d: Deprecated option %s", logit("%s line %d: Deprecated option %s",
filename, linenum, arg); filename, linenum, arg);
@ -2304,6 +2313,7 @@ dump_config(ServerOptions *o)
dump_cfg_fmtint(sAllowStreamLocalForwarding, o->allow_streamlocal_forwarding); dump_cfg_fmtint(sAllowStreamLocalForwarding, o->allow_streamlocal_forwarding);
dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep); dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
dump_cfg_fmtint(sFingerprintHash, o->fingerprint_hash); dump_cfg_fmtint(sFingerprintHash, o->fingerprint_hash);
dump_cfg_fmtint(sUseBlacklist, o->use_blacklist);
/* string arguments */ /* string arguments */
dump_cfg_string(sPidFile, o->pid_file); dump_cfg_string(sPidFile, o->pid_file);

View File

@ -195,6 +195,7 @@ typedef struct {
char *auth_methods[MAX_AUTH_METHODS]; char *auth_methods[MAX_AUTH_METHODS];
int fingerprint_hash; int fingerprint_hash;
int use_blacklist;
} ServerOptions; } ServerOptions;
/* Information about the incoming connection as used by Match */ /* Information about the incoming connection as used by Match */

View File

@ -135,6 +135,7 @@ __RCSID("$FreeBSD$");
#include "ssh-sandbox.h" #include "ssh-sandbox.h"
#include "version.h" #include "version.h"
#include "ssherr.h" #include "ssherr.h"
#include "blacklist_client.h"
#ifdef LIBWRAP #ifdef LIBWRAP
#include <tcpd.h> #include <tcpd.h>
@ -388,6 +389,8 @@ grace_alarm_handler(int sig)
kill(0, SIGTERM); kill(0, SIGTERM);
} }
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
/* Log error and exit. */ /* Log error and exit. */
sigdie("Timeout before authentication for %s", get_remote_ipaddr()); sigdie("Timeout before authentication for %s", get_remote_ipaddr());
} }
@ -2251,6 +2254,8 @@ main(int ac, char **av)
buffer_init(&loginmsg); buffer_init(&loginmsg);
auth_debug_reset(); auth_debug_reset();
BLACKLIST_INIT();
if (use_privsep) { if (use_privsep) {
if (privsep_preauth(authctxt) == 1) if (privsep_preauth(authctxt) == 1)
goto authenticated; goto authenticated;

View File

@ -120,6 +120,7 @@
#MaxStartups 10:30:100 #MaxStartups 10:30:100
#PermitTunnel no #PermitTunnel no
#ChrootDirectory none #ChrootDirectory none
#UseBlacklist no
#VersionAddendum FreeBSD-20160310 #VersionAddendum FreeBSD-20160310
# no default banner path # no default banner path

View File

@ -1537,6 +1537,15 @@ for authentication using
.Cm TrustedUserCAKeys . .Cm TrustedUserCAKeys .
For more details on certificates, see the CERTIFICATES section in For more details on certificates, see the CERTIFICATES section in
.Xr ssh-keygen 1 . .Xr ssh-keygen 1 .
.It Cm UseBlacklist
Specifies whether
.Xr sshd 8
attempts to send authentication success and failure messages
to the
.Xr blacklistd 8
daemon.
The default is
.Dq no .
.It Cm UseDNS .It Cm UseDNS
Specifies whether Specifies whether
.Xr sshd 8 .Xr sshd 8

View File

@ -95,6 +95,10 @@ CXXFLAGS+= -std=c++11
.endif .endif
CXXFLAGS+= -fno-rtti CXXFLAGS+= -fno-rtti
STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC
.if ${MK_DIRDEPS_BUILD} == "yes"
# Avoid dependency on lib/libc++
CFLAGS+= -I${SRCTOP}/contrib/libc++/include
.endif
.else # MK_LLVM_LIBUNWIND .else # MK_LLVM_LIBUNWIND

View File

@ -28,6 +28,18 @@
.include <src.opts.mk> .include <src.opts.mk>
.include <bsd.init.mk> .include <bsd.init.mk>
# Store the toolchain executable in ATF_BUILD_{CC,CPP,CXX} to ensure other
# values -- like -target, -B ..., etc -- don't get leaked into the tests.
#
# Be sure to omit ${CCACHE_BIN} (if specified) from the variable as it gets
# automatically appended to the variables in bsd.compiler.mk when
# ${MK_CCACHE_BUILD} != no.
ATF_BUILD_CC:= ${CC:N${CCACHE_BIN}:[1]}
ATF_BUILD_CPP:= ${CPP:N${CCACHE_BIN}:[1]}
ATF_BUILD_CXX:= ${CXX:N${CCACHE_BIN}:[1]}
# Only capture defines, includes, linker flags, optimization levels, warnings
# and preprocessor flags when building ATF_BUILD_{C,CPP,CXX}FLAGS.
ATF_BUILD_CFLAGS:= ${CFLAGS:M-[DILOWf]*} ATF_BUILD_CFLAGS:= ${CFLAGS:M-[DILOWf]*}
ATF_BUILD_CPPFLAGS:= ${CPPFLAGS:M-[DILOWf]*} ATF_BUILD_CPPFLAGS:= ${CPPFLAGS:M-[DILOWf]*}
ATF_BUILD_CXXFLAGS:= ${CXXFLAGS:M-[DILOWf]*} ATF_BUILD_CXXFLAGS:= ${CXXFLAGS:M-[DILOWf]*}
@ -41,11 +53,11 @@ ATF= ${SRCTOP}/contrib/atf
.PATH: ${ATF}/atf-c .PATH: ${ATF}/atf-c
.PATH: ${ATF}/atf-c/detail .PATH: ${ATF}/atf-c/detail
CFLAGS+= -DATF_BUILD_CC='"${CC}"' CFLAGS+= -DATF_BUILD_CC='"${ATF_BUILD_CC}"'
CFLAGS+= -DATF_BUILD_CFLAGS='"${ATF_BUILD_CFLAGS}"' CFLAGS+= -DATF_BUILD_CFLAGS='"${ATF_BUILD_CFLAGS}"'
CFLAGS+= -DATF_BUILD_CPP='"${CPP}"' CFLAGS+= -DATF_BUILD_CPP='"${ATF_BUILD_CPP}"'
CFLAGS+= -DATF_BUILD_CPPFLAGS='"${ATF_BUILD_CPPFLAGS}"' CFLAGS+= -DATF_BUILD_CPPFLAGS='"${ATF_BUILD_CPPFLAGS}"'
CFLAGS+= -DATF_BUILD_CXX='"${CXX}"' CFLAGS+= -DATF_BUILD_CXX='"${ATF_BUILD_CXX}"'
CFLAGS+= -DATF_BUILD_CXXFLAGS='"${ATF_BUILD_CXXFLAGS}"' CFLAGS+= -DATF_BUILD_CXXFLAGS='"${ATF_BUILD_CXXFLAGS}"'
CFLAGS+= -I${ATF} CFLAGS+= -I${ATF}
CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}

View File

@ -6,6 +6,7 @@ DIRDEPS = \
include/xlocale \ include/xlocale \
lib/libc++ \ lib/libc++ \
lib/msun \ lib/msun \
usr.bin/clang/clang-tblgen.host \
.include <dirdeps.mk> .include <dirdeps.mk>

View File

@ -6,6 +6,7 @@ DIRDEPS = \
include/xlocale \ include/xlocale \
lib/libc++ \ lib/libc++ \
lib/msun \ lib/msun \
usr.bin/clang/clang-tblgen.host \
.include <dirdeps.mk> .include <dirdeps.mk>

View File

@ -28,7 +28,7 @@
.\" @(#)directory.3 8.1 (Berkeley) 6/4/93 .\" @(#)directory.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd February 19, 2016 .Dd August 31, 2016
.Dt DIRECTORY 3 .Dt DIRECTORY 3
.Os .Os
.Sh NAME .Sh NAME
@ -68,6 +68,15 @@
.Ft int .Ft int
.Fn dirfd "DIR *dirp" .Fn dirfd "DIR *dirp"
.Sh DESCRIPTION .Sh DESCRIPTION
.Bf -symbolic
The
.Fn readdir_r
interface is deprecated
because it cannot be used correctly unless
.Brq Va NAME_MAX
is a fixed value.
.Ef
.Pp
The The
.Fn opendir .Fn opendir
function function
@ -122,7 +131,13 @@ The
.Fn readdir .Fn readdir
function function
returns a pointer to the next directory entry. returns a pointer to the next directory entry.
It returns The directory entry remains valid until the next call to
.Fn readdir
or
.Fn closedir
on the same
.Em directory stream .
The function returns
.Dv NULL .Dv NULL
upon reaching the end of the directory or on error. upon reaching the end of the directory or on error.
In the event of an error, In the event of an error,
@ -139,6 +154,13 @@ provides the same functionality as
but the caller must provide a directory but the caller must provide a directory
.Fa entry .Fa entry
buffer to store the results in. buffer to store the results in.
The buffer must be large enough for a
.Vt struct dirent
with a
.Va d_name
array with
.Brq Va NAME_MAX
+ 1 elements.
If the read succeeds, If the read succeeds,
.Fa result .Fa result
is pointed at the is pointed at the

View File

@ -28,7 +28,7 @@
.\" @(#)kvm_getvfsbyname.3 8.3 (Berkeley) 5/4/95 .\" @(#)kvm_getvfsbyname.3 8.3 (Berkeley) 5/4/95
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd April 5, 2007 .Dd August 30, 2016
.Dt GETVFSBYNAME 3 .Dt GETVFSBYNAME 3
.Os .Os
.Sh NAME .Sh NAME
@ -97,11 +97,6 @@ sysctl is set to
.Sh ERRORS .Sh ERRORS
The following errors may be reported: The following errors may be reported:
.Bl -tag -width Er .Bl -tag -width Er
.It Bq Er EFAULT
The
.Fa vfc
argument
points to an invalid address.
.It Bq Er ENOENT .It Bq Er ENOENT
The The
.Fa name .Fa name

View File

@ -949,7 +949,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
while (s < lim) while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) { if ((r = (*d++ ^ *s++)) != 0) {
while (r < addrlen * 8) { while ((r & 0x80) == 0) {
match++; match++;
r <<= 1; r <<= 1;
} }

View File

@ -185,6 +185,7 @@ struct hp_order {
#define aio_sa aio_un.aiou_sa #define aio_sa aio_un.aiou_sa
int aio_matchlen; int aio_matchlen;
char *aio_h_addr; char *aio_h_addr;
int aio_initial_sequence;
}; };
static struct hostent *_hpcopy(struct hostent *, int *); static struct hostent *_hpcopy(struct hostent *, int *);
@ -711,6 +712,7 @@ _hpreorder(struct hostent *hp)
aio[i].aio_dstscope = gai_addr2scopetype(sa); aio[i].aio_dstscope = gai_addr2scopetype(sa);
aio[i].aio_dstpolicy = match_addrselectpolicy(sa, &policyhead); aio[i].aio_dstpolicy = match_addrselectpolicy(sa, &policyhead);
set_source(&aio[i], &policyhead); set_source(&aio[i], &policyhead);
aio[i].aio_initial_sequence = i;
} }
/* perform sorting. */ /* perform sorting. */
@ -928,7 +930,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
while (s < lim) while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) { if ((r = (*d++ ^ *s++)) != 0) {
while (r < addrlen * 8) { while ((r & 0x80) == 0) {
match++; match++;
r <<= 1; r <<= 1;
} }
@ -1045,6 +1047,23 @@ comp_dst(const void *arg1, const void *arg2)
} }
/* Rule 10: Otherwise, leave the order unchanged. */ /* Rule 10: Otherwise, leave the order unchanged. */
/*
* Note that qsort is unstable; so, we can't return zero and
* expect the order to be unchanged.
* That also means we can't depend on the current position of
* dst2 being after dst1. We must enforce the initial order
* with an explicit compare on the original position.
* The qsort specification requires that "When the same objects
* (consisting of width bytes, irrespective of their current
* positions in the array) are passed more than once to the
* comparison function, the results shall be consistent with one
* another."
* In other words, If A < B, then we must also return B > A.
*/
if (dst2->aio_initial_sequence < dst1->aio_initial_sequence)
return(1);
return(-1); return(-1);
} }

View File

@ -11,9 +11,10 @@ DIRDEPS = \
lib/atf/libatf-c++ \ lib/atf/libatf-c++ \
lib/libc \ lib/libc \
lib/libc++ \ lib/libc++ \
lib/libthr \
lib/libcompiler_rt \ lib/libcompiler_rt \
lib/libcxxrt \
lib/libnetbsd \ lib/libnetbsd \
lib/libthr \
lib/libutil \ lib/libutil \
lib/msun \ lib/msun \

View File

@ -16,6 +16,7 @@ SRCS= elftc_bfdtarget.c \
elftc_reloc_type_str.c \ elftc_reloc_type_str.c \
elftc_set_timestamps.c \ elftc_set_timestamps.c \
elftc_string_table.c \ elftc_string_table.c \
elftc_timestamp.c \
elftc_version.c \ elftc_version.c \
libelftc_bfdtarget.c \ libelftc_bfdtarget.c \
libelftc_dem_arm.c \ libelftc_dem_arm.c \

View File

@ -6,5 +6,5 @@
const char * const char *
elftc_version(void) elftc_version(void)
{ {
return "elftoolchain r3477M"; return "elftoolchain r3490M";
} }

View File

@ -12,6 +12,7 @@ DIRDEPS = \
lib/libcompiler_rt \ lib/libcompiler_rt \
lib/libcxxrt \ lib/libcxxrt \
lib/libelf \ lib/libelf \
lib/libprocstat \
lib/librtld_db \ lib/librtld_db \
lib/libutil \ lib/libutil \

View File

@ -13,7 +13,9 @@ DIRDEPS = \
lib/libcompiler_rt \ lib/libcompiler_rt \
lib/libcxxrt \ lib/libcxxrt \
lib/libelf \ lib/libelf \
lib/libkvm \
lib/libproc \ lib/libproc \
lib/libprocstat \
lib/librtld_db \ lib/librtld_db \
lib/libutil \ lib/libutil \
lib/libz \ lib/libz \

View File

@ -10,6 +10,7 @@ DIRDEPS = \
lib/libc \ lib/libc \
lib/libcompiler_rt \ lib/libcompiler_rt \
lib/libelf \ lib/libelf \
lib/libprocstat \
lib/libutil \ lib/libutil \

View File

@ -411,6 +411,10 @@ vend_rfc1048(cp, len)
bcopy(cp, &dhcp_serverip.s_addr, bcopy(cp, &dhcp_serverip.s_addr,
sizeof(dhcp_serverip.s_addr)); sizeof(dhcp_serverip.s_addr));
} }
if (tag == TAG_TFTP_SERVER) {
bcopy(cp, &tftpip.s_addr,
sizeof(tftpip.s_addr));
}
#endif #endif
cp += size; cp += size;
} }

View File

@ -106,6 +106,7 @@ struct bootp {
#define TAG_T2 ((unsigned char) 59) #define TAG_T2 ((unsigned char) 59)
#define TAG_CLASSID ((unsigned char) 60) #define TAG_CLASSID ((unsigned char) 60)
#define TAG_CLIENTID ((unsigned char) 61) #define TAG_CLIENTID ((unsigned char) 61)
#define TAG_TFTP_SERVER ((unsigned char) 150)
#endif #endif
#define TAG_END ((unsigned char) 255) #define TAG_END ((unsigned char) 255)

View File

@ -25,12 +25,14 @@ char hostname[FNAME_SIZE]; /* our hostname */
int hostnamelen; int hostnamelen;
char domainname[FNAME_SIZE]; /* our DNS domain */ char domainname[FNAME_SIZE]; /* our DNS domain */
int domainnamelen; int domainnamelen;
int netproto = NET_NONE; /* Network prototol */
char ifname[IFNAME_SIZE]; /* name of interface (e.g. "le0") */ char ifname[IFNAME_SIZE]; /* name of interface (e.g. "le0") */
struct in_addr myip; /* my ip address */ struct in_addr myip; /* my ip address */
struct in_addr nameip; /* DNS server ip address */ struct in_addr nameip; /* DNS server ip address */
struct in_addr rootip; /* root ip address */ struct in_addr rootip; /* root ip address */
struct in_addr swapip; /* swap ip address */ struct in_addr swapip; /* swap ip address */
struct in_addr gateip; /* gateway ip address */ struct in_addr gateip; /* gateway ip address */
struct in_addr tftpip; /* TFTP ip address */
n_long netmask = 0xffffff00; /* subnet or net mask */ n_long netmask = 0xffffff00; /* subnet or net mask */
u_int intf_mtu; /* interface mtu from bootp/dhcp */ u_int intf_mtu; /* interface mtu from bootp/dhcp */
int errno; /* our old friend */ int errno; /* our old friend */

View File

@ -36,6 +36,8 @@
* $FreeBSD$ * $FreeBSD$
*/ */
#ifndef _STAND_NET_H
#define _STAND_NET_H
#ifndef _KERNEL /* XXX - see <netinet/in.h> */ #ifndef _KERNEL /* XXX - see <netinet/in.h> */
#undef __IPADDR #undef __IPADDR
#define __IPADDR(x) htonl((u_int32_t)(x)) #define __IPADDR(x) htonl((u_int32_t)(x))
@ -45,6 +47,12 @@
#define BA { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } #define BA { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
enum net_proto {
NET_NONE,
NET_NFS,
NET_TFTP
};
/* Returns true if n_long's on the same net */ /* Returns true if n_long's on the same net */
#define SAMENET(a1, a2, m) ((a1.s_addr & m) == (a2.s_addr & m)) #define SAMENET(a1, a2, m) ((a1.s_addr & m) == (a2.s_addr & m))
@ -74,6 +82,7 @@ extern char hostname[FNAME_SIZE];
extern int hostnamelen; extern int hostnamelen;
extern char domainname[FNAME_SIZE]; extern char domainname[FNAME_SIZE];
extern int domainnamelen; extern int domainnamelen;
extern int netproto;
extern char ifname[IFNAME_SIZE]; extern char ifname[IFNAME_SIZE];
/* All of these are in network order. */ /* All of these are in network order. */
@ -82,6 +91,7 @@ extern struct in_addr rootip;
extern struct in_addr swapip; extern struct in_addr swapip;
extern struct in_addr gateip; extern struct in_addr gateip;
extern struct in_addr nameip; extern struct in_addr nameip;
extern struct in_addr tftpip;
extern n_long netmask; extern n_long netmask;
extern u_int intf_mtu; extern u_int intf_mtu;
@ -120,3 +130,4 @@ n_long inet_addr(char *);
/* Machine-dependent functions: */ /* Machine-dependent functions: */
time_t getsecs(void); time_t getsecs(void);
#endif

View File

@ -458,6 +458,9 @@ nfs_open(const char *upath, struct open_file *f)
int error; int error;
char *path; char *path;
if (netproto != NET_NFS)
return (EINVAL);
#ifdef NFS_DEBUG #ifdef NFS_DEBUG
if (debug) if (debug)
printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);
@ -1100,6 +1103,9 @@ nfs_open(const char *upath, struct open_file *f)
int error; int error;
char *path; char *path;
if (netproto != NET_NFS)
return (EINVAL);
#ifdef NFS_DEBUG #ifdef NFS_DEBUG
if (debug) if (debug)
printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);

View File

@ -200,7 +200,7 @@ recvtftp(struct tftp_handle *h, void *pkt, ssize_t len, time_t tleft,
case DATA: { case DATA: {
int got; int got;
if (htons(t->th_block) != d->xid) { if (htons(t->th_block) != (u_short) d->xid) {
/* /*
* Expected block? * Expected block?
*/ */
@ -402,6 +402,9 @@ tftp_open(const char *path, struct open_file *f)
size_t pathsize; size_t pathsize;
const char *extraslash; const char *extraslash;
if (netproto != NET_TFTP)
return (EINVAL);
if (strcmp(f->f_dev->dv_name, "net") != 0) { if (strcmp(f->f_dev->dv_name, "net") != 0) {
#ifdef __i386__ #ifdef __i386__
if (strcmp(f->f_dev->dv_name, "pxe") != 0) if (strcmp(f->f_dev->dv_name, "pxe") != 0)
@ -560,7 +563,7 @@ tftp_stat(struct open_file *f, struct stat *sb)
sb->st_nlink = 1; sb->st_nlink = 1;
sb->st_uid = 0; sb->st_uid = 0;
sb->st_gid = 0; sb->st_gid = 0;
sb->st_size = -1; sb->st_size = (off_t) tftpfile->tftp_tsize;
return (0); return (0);
} }
@ -731,6 +734,8 @@ tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len)
} else if (strcasecmp(tftp_options[i], "tsize") == 0) { } else if (strcasecmp(tftp_options[i], "tsize") == 0) {
if (i + 1 < option_idx) if (i + 1 < option_idx)
tsize = strtol(tftp_options[i + 1], (char **)NULL, 10); tsize = strtol(tftp_options[i + 1], (char **)NULL, 10);
if (tsize != 0)
h->tftp_tsize = tsize;
} else { } else {
/* Do not allow any options we did not expect to be ACKed. */ /* Do not allow any options we did not expect to be ACKed. */
printf("unexpected tftp option '%s'\n", tftp_options[i]); printf("unexpected tftp option '%s'\n", tftp_options[i]);

View File

@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
libexec/rtld-elf/tests/libpythagoras \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -313,15 +313,8 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
bpb.bpbHiddenSecs = o.hidden_sectors; bpb.bpbHiddenSecs = o.hidden_sectors;
if (!(o.floppy || (o.drive_heads && o.sectors_per_track && if (!(o.floppy || (o.drive_heads && o.sectors_per_track &&
o.bytes_per_sector && o.size && o.hidden_sectors_set))) { o.bytes_per_sector && o.size && o.hidden_sectors_set))) {
off_t delta;
getdiskinfo(fd, fname, dtype, o.hidden_sectors_set, &bpb); getdiskinfo(fd, fname, dtype, o.hidden_sectors_set, &bpb);
bpb.bpbHugeSectors -= (o.offset / bpb.bpbBytesPerSec); bpb.bpbHugeSectors -= (o.offset / bpb.bpbBytesPerSec);
delta = bpb.bpbHugeSectors % bpb.bpbSecPerTrack;
if (delta != 0) {
warnx("trim %d sectors to adjust to a multiple of %d",
(int)delta, bpb.bpbSecPerTrack);
bpb.bpbHugeSectors -= delta;
}
if (bpb.bpbSecPerClust == 0) { /* set defaults */ if (bpb.bpbSecPerClust == 0) { /* set defaults */
if (bpb.bpbHugeSectors <= 6000) /* about 3MB -> 512 bytes */ if (bpb.bpbHugeSectors <= 6000) /* about 3MB -> 512 bytes */
bpb.bpbSecPerClust = 1; bpb.bpbSecPerClust = 1;
@ -563,7 +556,7 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
bpb.bpbMedia = !bpb.bpbHiddenSecs ? 0xf0 : 0xf8; bpb.bpbMedia = !bpb.bpbHiddenSecs ? 0xf0 : 0xf8;
if (fat == 32) if (fat == 32)
bpb.bpbRootClust = RESFTE; bpb.bpbRootClust = RESFTE;
if (bpb.bpbHiddenSecs + bpb.bpbHugeSectors <= MAXU16) { if (bpb.bpbHugeSectors <= MAXU16) {
bpb.bpbSectors = bpb.bpbHugeSectors; bpb.bpbSectors = bpb.bpbHugeSectors;
bpb.bpbHugeSectors = 0; bpb.bpbHugeSectors = 0;
} }

View File

@ -9,8 +9,6 @@ DIRDEPS = \
include/gssapi \ include/gssapi \
include/rpc \ include/rpc \
include/xlocale \ include/xlocale \
kerberos5/lib/libasn1 \
kerberos5/lib/libkrb5 \
lib/${CSU_DIR} \ lib/${CSU_DIR} \
lib/libc \ lib/libc \
lib/libcompiler_rt \ lib/libcompiler_rt \

View File

@ -40,6 +40,13 @@ CFLAGS+= -DUSE_BSM_AUDIT -DHAVE_GETAUDIT_ADDR
LIBADD+= bsm LIBADD+= bsm
.endif .endif
.if ${MK_BLACKLIST_SUPPORT} != "no"
CFLAGS+= -DUSE_BLACKLIST -I${SRCTOP}/contrib/blacklist/include
SRCS+= blacklist.c
LIBADD+= blacklist
LDFLAGS+=-L${LIBBLACKLISTDIR}
.endif
.if ${MK_KERBEROS_SUPPORT} != "no" .if ${MK_KERBEROS_SUPPORT} != "no"
CFLAGS+= -include krb5_config.h CFLAGS+= -include krb5_config.h
SRCS+= krb5_config.h SRCS+= krb5_config.h

View File

@ -17,6 +17,7 @@ DIRDEPS = \
kerberos5/lib/libroken \ kerberos5/lib/libroken \
kerberos5/lib/libwind \ kerberos5/lib/libwind \
lib/${CSU_DIR} \ lib/${CSU_DIR} \
lib/libblacklist \
lib/libbsm \ lib/libbsm \
lib/libc \ lib/libc \
lib/libcom_err \ lib/libcom_err \

View File

@ -24,7 +24,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd February 29, 2016 .Dd August 30, 2016
.Dt MBUF 9 .Dt MBUF 9
.Os .Os
.\" .\"
@ -255,7 +255,7 @@ The available external buffer types are defined as follows:
#define EXT_JUMBO9 4 /* jumbo cluster 9216 bytes */ #define EXT_JUMBO9 4 /* jumbo cluster 9216 bytes */
#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */ #define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */
#define EXT_PACKET 6 /* mbuf+cluster from packet zone */ #define EXT_PACKET 6 /* mbuf+cluster from packet zone */
#define EXT_MBUF 7 /* external mbuf reference (M_IOVEC) */ #define EXT_MBUF 7 /* external mbuf reference */
#define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */ #define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */
#define EXT_MOD_TYPE 253 /* custom module's ext_buf type */ #define EXT_MOD_TYPE 253 /* custom module's ext_buf type */
#define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */ #define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */

View File

@ -82,9 +82,9 @@ _meta_filemon= 1
# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used. # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used.
.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \ .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
${.TARGETS:M*install*} == ${.TARGETS} || \ ${.TARGETS:M*install*} == ${.TARGETS} || \
make(analyze) || defined(_meta_filemon) make(analyze) || defined(_meta_filemon) || make(print-dir)
_SKIP_READ_DEPEND= 1 _SKIP_READ_DEPEND= 1
.if ${MK_DIRDEPS_BUILD} == "no" .if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir)
.MAKE.DEPENDFILE= /dev/null .MAKE.DEPENDFILE= /dev/null
.endif .endif
.endif .endif
@ -198,7 +198,7 @@ CFLAGS+= ${DEPEND_CFLAGS}
.endif # !defined(_meta_filemon) .endif # !defined(_meta_filemon)
.endif # defined(SRCS) .endif # defined(SRCS)
.if ${MK_DIRDEPS_BUILD} == "yes" .if ${MK_DIRDEPS_BUILD} == "yes" && !make(analyze) && !make(print-dir)
# Prevent meta.autodep.mk from tracking "local dependencies". # Prevent meta.autodep.mk from tracking "local dependencies".
.depend: .depend:
.include <meta.autodep.mk> .include <meta.autodep.mk>

View File

@ -31,7 +31,7 @@ _SKIP_BUILD = not building at level 0
.if ${MK_META_MODE} == "yes" .if ${MK_META_MODE} == "yes"
.if !exists(/dev/filemon) && \ .if !exists(/dev/filemon) && \
${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \ ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \
!make(showconfig) && ${.MAKEFLAGS:M-V} == "" !make(showconfig) && !make(print-dir) && ${.MAKEFLAGS:M-V} == ""
.warning The filemon module (/dev/filemon) is not loaded. .warning The filemon module (/dev/filemon) is not loaded.
.warning META_MODE is less useful for incremental builds without filemon. .warning META_MODE is less useful for incremental builds without filemon.
.warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning. .warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning.

View File

@ -51,6 +51,30 @@ CANONICALOBJDIR= ${.OBJDIR}
# but this makefile does not want it! # but this makefile does not want it!
.OBJDIR: ${.CURDIR} .OBJDIR: ${.CURDIR}
.endif .endif
# Handle special case where SRCS is full-pathed and requires
# nested objdirs. This duplicates some auto.obj.mk logic.
.if (!empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)) && \
(${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "")
_wantdirs= ${SRCS:M*/*:H} ${DPSRCS:M*/*:H}
.if !empty(_wantdirs)
_wantdirs:= ${_wantdirs:O:u}
_needdirs=
.for _dir in ${_wantdirs}
.if !exists(${.OBJDIR}/${_dir}/)
_needdirs+= ${_dir}
.endif
.endfor
.endif
.if !empty(_needdirs)
#_mkneededdirs!= umask ${OBJDIR_UMASK:U002}; ${Mkdirs} ${_needdirs}
__objdir_made != umask ${OBJDIR_UMASK:U002}; ${Mkdirs}; \
for dir in ${_needdirs}; do \
dir=${.OBJDIR}/$${dir}; \
${ECHO_TRACE} "[Creating nested objdir $${dir}...]" >&2; \
Mkdirs $${dir}; \
done
.endif
.endif # !empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)
.elif defined(MAKEOBJDIRPREFIX) .elif defined(MAKEOBJDIRPREFIX)
CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
.elif defined(MAKEOBJDIR) && ${MAKEOBJDIR:M/*} != "" .elif defined(MAKEOBJDIR) && ${MAKEOBJDIR:M/*} != ""

View File

@ -42,15 +42,15 @@ SUBDIR_TARGETS+= \
all all-man analyze buildconfig buildfiles buildincludes \ all all-man analyze buildconfig buildfiles buildincludes \
checkdpadd clean cleandepend cleandir cleanilinks \ checkdpadd clean cleandepend cleandir cleanilinks \
cleanobj depend distribute files includes installconfig \ cleanobj depend distribute files includes installconfig \
installfiles installincludes realinstall lint maninstall \ installfiles installincludes print-dir realinstall lint \
manlint obj objlink tags \ maninstall manlint obj objlink tags \
# Described above. # Described above.
STANDALONE_SUBDIR_TARGETS+= \ STANDALONE_SUBDIR_TARGETS+= \
all-man buildconfig buildfiles buildincludes check checkdpadd \ all-man buildconfig buildfiles buildincludes check checkdpadd \
clean cleandepend cleandir cleanilinks cleanobj files includes \ clean cleandepend cleandir cleanilinks cleanobj files includes \
installconfig installincludes installfiles maninstall manlint \ installconfig installincludes installfiles print-dir \
obj objlink \ maninstall manlint obj objlink
# It is safe to install in parallel when staging. # It is safe to install in parallel when staging.
.if defined(NO_ROOT) .if defined(NO_ROOT)
@ -59,6 +59,16 @@ STANDALONE_SUBDIR_TARGETS+= realinstall
.include <bsd.init.mk> .include <bsd.init.mk>
.if make(print-dir)
NEED_SUBDIR= 1
ECHODIR= :
.SILENT:
.if ${RELDIR:U.} != "."
print-dir: .PHONY
@echo ${RELDIR}
.endif
.endif
.if !defined(NEED_SUBDIR) .if !defined(NEED_SUBDIR)
.if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && !(make(clean*) || make(destroy*)) .if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && !(make(clean*) || make(destroy*))
.include <meta.subdir.mk> .include <meta.subdir.mk>

View File

@ -214,7 +214,8 @@ CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
.if !empty(TIME_STAMP) .if !empty(TIME_STAMP)
TRACER= ${TIME_STAMP} ${:U} TRACER= ${TIME_STAMP} ${:U}
.endif .endif
.if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) .if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) && \
!make(print-dir)
WITH_META_STATS= t WITH_META_STATS= t
.endif .endif

View File

@ -97,7 +97,7 @@ META_MODE?= normal
# This needs to be done early - before .PATH is computed # This needs to be done early - before .PATH is computed
# Don't do this for 'make showconfig' as it enables all options where meta mode # Don't do this for 'make showconfig' as it enables all options where meta mode
# is not expected. # is not expected.
.if !make(showconfig) .if !make(showconfig) && !make(print-dir)
.sinclude <auto.obj.mk> .sinclude <auto.obj.mk>
.endif .endif
.endif .endif

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/module.h> #include <sys/module.h>
#include <sys/gpio.h> #include <sys/gpio.h>
#include <machine/bus.h>
#include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h> #include <dev/ofw/ofw_bus_subr.h>
@ -53,25 +54,89 @@ __FBSDID("$FreeBSD$");
#include "phy_if.h" #include "phy_if.h"
#define USBPHY_NPHYS 4 #define USBPHY_NPHYS 4
#define USBPHY_NRES USBPHY_NPHYS
enum awusbphy_type {
AWUSBPHY_TYPE_A10 = 1,
AWUSBPHY_TYPE_A13,
AWUSBPHY_TYPE_A20,
AWUSBPHY_TYPE_A31,
AWUSBPHY_TYPE_A83T,
AWUSBPHY_TYPE_H3,
AWUSBPHY_TYPE_A64
};
static struct ofw_compat_data compat_data[] = { static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun4i-a10-usb-phy", 1 }, { "allwinner,sun4i-a10-usb-phy", AWUSBPHY_TYPE_A10 },
{ "allwinner,sun5i-a13-usb-phy", 1 }, { "allwinner,sun5i-a13-usb-phy", AWUSBPHY_TYPE_A13 },
{ "allwinner,sun6i-a31-usb-phy", 1 }, { "allwinner,sun6i-a31-usb-phy", AWUSBPHY_TYPE_A31 },
{ "allwinner,sun7i-a20-usb-phy", 1 }, { "allwinner,sun7i-a20-usb-phy", AWUSBPHY_TYPE_A20 },
{ "allwinner,sun8i-a83t-usb-phy", 1 }, { "allwinner,sun8i-a83t-usb-phy", AWUSBPHY_TYPE_A83T },
{ "allwinner,sun8i-h3-usb-phy", 1 }, { "allwinner,sun8i-h3-usb-phy", AWUSBPHY_TYPE_H3 },
{ "allwinner,sun50i-a64-usb-phy", AWUSBPHY_TYPE_A64 },
{ NULL, 0 } { NULL, 0 }
}; };
struct awusbphy_softc { struct awusbphy_softc {
struct resource * res[USBPHY_NRES];
regulator_t reg[USBPHY_NPHYS]; regulator_t reg[USBPHY_NPHYS];
gpio_pin_t id_det_pin; gpio_pin_t id_det_pin;
int id_det_valid; int id_det_valid;
gpio_pin_t vbus_det_pin; gpio_pin_t vbus_det_pin;
int vbus_det_valid; int vbus_det_valid;
enum awusbphy_type phy_type;
}; };
static struct resource_spec awusbphy_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_MEMORY, 1, RF_ACTIVE },
{ SYS_RES_MEMORY, 2, RF_ACTIVE | RF_OPTIONAL },
{ SYS_RES_MEMORY, 3, RF_ACTIVE | RF_OPTIONAL },
{ -1, 0 }
};
#define RD4(sc, i, o) bus_read_4((sc)->res[(i)], (o))
#define WR4(sc, i, o, v) bus_write_4((sc)->res[(i)], (o), (v))
#define CLR4(sc, i, o, m) WR4(sc, i, o, RD4(sc, i, o) & ~(m))
#define SET4(sc, i, o, m) WR4(sc, i, o, RD4(sc, i, o) | (m))
#define OTG_PHY_CFG 0x20
#define OTG_PHY_ROUTE_OTG (1 << 0)
#define PMU_IRQ_ENABLE 0x00
#define PMU_AHB_INCR8 (1 << 10)
#define PMU_AHB_INCR4 (1 << 9)
#define PMU_AHB_INCRX_ALIGN (1 << 8)
#define PMU_ULPI_BYPASS (1 << 0)
#define PMU_UNK_H3 0x10
#define PMU_UNK_H3_CLR 0x2
static void
awusbphy_configure(device_t dev, int phyno)
{
struct awusbphy_softc *sc;
sc = device_get_softc(dev);
if (sc->res[phyno] == NULL)
return;
if (sc->phy_type == AWUSBPHY_TYPE_A64) {
CLR4(sc, phyno, PMU_UNK_H3, PMU_UNK_H3_CLR);
/* EHCI0 and OTG share a PHY */
if (phyno == 0)
SET4(sc, 0, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG);
else if (phyno == 1)
CLR4(sc, 0, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG);
}
if (phyno > 0) {
/* Enable passby */
SET4(sc, phyno, PMU_IRQ_ENABLE, PMU_ULPI_BYPASS |
PMU_AHB_INCR8 | PMU_AHB_INCR4 | PMU_AHB_INCRX_ALIGN);
}
}
static int static int
awusbphy_init(device_t dev) awusbphy_init(device_t dev)
{ {
@ -86,6 +151,8 @@ awusbphy_init(device_t dev)
sc = device_get_softc(dev); sc = device_get_softc(dev);
node = ofw_bus_get_node(dev); node = ofw_bus_get_node(dev);
sc->phy_type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
/* Enable clocks */ /* Enable clocks */
for (off = 0; clk_get_by_ofw_index(dev, 0, off, &clk) == 0; off++) { for (off = 0; clk_get_by_ofw_index(dev, 0, off, &clk) == 0; off++) {
error = clk_enable(clk); error = clk_enable(clk);
@ -123,6 +190,10 @@ awusbphy_init(device_t dev)
if (error == 0) if (error == 0)
sc->vbus_det_valid = 1; sc->vbus_det_valid = 1;
/* Allocate resources */
if (bus_alloc_resources(dev, awusbphy_spec, sc->res) != 0)
device_printf(dev, "couldn't allocate resources\n");
return (0); return (0);
} }
@ -159,6 +230,9 @@ awusbphy_phy_enable(device_t dev, intptr_t phy, bool enable)
sc = device_get_softc(dev); sc = device_get_softc(dev);
/* Configure PHY */
awusbphy_configure(dev, phy);
/* Regulators are optional. If not found, return success. */ /* Regulators are optional. If not found, return success. */
reg = sc->reg[phy]; reg = sc->reg[phy];
if (reg == NULL) if (reg == NULL)

View File

@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/watchdog.h> #include <sys/watchdog.h>
#include <sys/reboot.h>
#include <sys/bus.h> #include <sys/bus.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/lock.h> #include <sys/lock.h>
@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$");
#define A10_WDOG_CTRL 0x00 #define A10_WDOG_CTRL 0x00
#define A31_WDOG_CTRL 0x10 #define A31_WDOG_CTRL 0x10
#define WDOG_CTRL_RESTART (1 << 0) #define WDOG_CTRL_RESTART (1 << 0)
#define A31_WDOG_CTRL_KEY (0xa57 << 1)
#define A10_WDOG_MODE 0x04 #define A10_WDOG_MODE 0x04
#define A31_WDOG_MODE 0x18 #define A31_WDOG_MODE 0x18
#define A10_WDOG_MODE_INTVL_SHIFT 3 #define A10_WDOG_MODE_INTVL_SHIFT 3
@ -92,6 +94,7 @@ struct aw_wdog_softc {
struct resource * res; struct resource * res;
struct mtx mtx; struct mtx mtx;
uint8_t wdog_ctrl; uint8_t wdog_ctrl;
uint32_t wdog_ctrl_key;
uint8_t wdog_mode; uint8_t wdog_mode;
uint8_t wdog_mode_intvl_shift; uint8_t wdog_mode_intvl_shift;
uint8_t wdog_mode_en; uint8_t wdog_mode_en;
@ -108,7 +111,8 @@ static struct ofw_compat_data compat_data[] = {
{NULL, 0} {NULL, 0}
}; };
static void aw_wdog_watchdog_fn(void *private, u_int cmd, int *error); static void aw_wdog_watchdog_fn(void *, u_int, int *);
static void aw_wdog_shutdown_fn(void *, int);
static int static int
aw_wdog_probe(device_t dev) aw_wdog_probe(device_t dev)
@ -160,6 +164,7 @@ aw_wdog_attach(device_t dev)
break; break;
case A31_WATCHDOG: case A31_WATCHDOG:
sc->wdog_ctrl = A31_WDOG_CTRL; sc->wdog_ctrl = A31_WDOG_CTRL;
sc->wdog_ctrl_key = A31_WDOG_CTRL_KEY;
sc->wdog_mode = A31_WDOG_MODE; sc->wdog_mode = A31_WDOG_MODE;
sc->wdog_mode_intvl_shift = A31_WDOG_MODE_INTVL_SHIFT; sc->wdog_mode_intvl_shift = A31_WDOG_MODE_INTVL_SHIFT;
sc->wdog_mode_en = WDOG_MODE_EN; sc->wdog_mode_en = WDOG_MODE_EN;
@ -173,6 +178,9 @@ aw_wdog_attach(device_t dev)
mtx_init(&sc->mtx, "AW Watchdog", "aw_wdog", MTX_DEF); mtx_init(&sc->mtx, "AW Watchdog", "aw_wdog", MTX_DEF);
EVENTHANDLER_REGISTER(watchdog_list, aw_wdog_watchdog_fn, sc, 0); EVENTHANDLER_REGISTER(watchdog_list, aw_wdog_watchdog_fn, sc, 0);
EVENTHANDLER_REGISTER(shutdown_final, aw_wdog_shutdown_fn, sc,
SHUTDOWN_PRI_LAST - 1);
return (0); return (0);
} }
@ -198,7 +206,8 @@ aw_wdog_watchdog_fn(void *private, u_int cmd, int *error)
WRITE(sc, sc->wdog_mode, WRITE(sc, sc->wdog_mode,
(wd_intervals[i].value << sc->wdog_mode_intvl_shift) | (wd_intervals[i].value << sc->wdog_mode_intvl_shift) |
sc->wdog_mode_en); sc->wdog_mode_en);
WRITE(sc, sc->wdog_ctrl, WDOG_CTRL_RESTART); WRITE(sc, sc->wdog_ctrl,
WDOG_CTRL_RESTART | sc->wdog_ctrl_key);
if (sc->wdog_config) if (sc->wdog_config)
WRITE(sc, sc->wdog_config, WRITE(sc, sc->wdog_config,
sc->wdog_config_value); sc->wdog_config_value);
@ -222,6 +231,13 @@ aw_wdog_watchdog_fn(void *private, u_int cmd, int *error)
mtx_unlock(&sc->mtx); mtx_unlock(&sc->mtx);
} }
static void
aw_wdog_shutdown_fn(void *private, int howto)
{
if ((howto & (RB_POWEROFF|RB_HALT)) == 0)
aw_wdog_watchdog_reset();
}
void void
aw_wdog_watchdog_reset() aw_wdog_watchdog_reset()
{ {
@ -237,6 +253,8 @@ aw_wdog_watchdog_reset()
if (aw_wdog_sc->wdog_config) if (aw_wdog_sc->wdog_config)
WRITE(aw_wdog_sc, aw_wdog_sc->wdog_config, WRITE(aw_wdog_sc, aw_wdog_sc->wdog_config,
aw_wdog_sc->wdog_config_value); aw_wdog_sc->wdog_config_value);
WRITE(aw_wdog_sc, aw_wdog_sc->wdog_ctrl,
WDOG_CTRL_RESTART | aw_wdog_sc->wdog_ctrl_key);
while(1) while(1)
; ;

View File

@ -364,8 +364,6 @@ ENTRY(xscalec3_setttb)
#ifdef CACHE_CLEAN_BLOCK_INTR #ifdef CACHE_CLEAN_BLOCK_INTR
msr cpsr_fsxc, r3 msr cpsr_fsxc, r3
#else
str r2, [r3]
#endif #endif
RET RET
END(xscalec3_setttb) END(xscalec3_setttb)

View File

@ -195,6 +195,16 @@ Lunmapped:
ldr r2, =(KERNVIRTADDR) ldr r2, =(KERNVIRTADDR)
mov r3, #64 mov r3, #64
bl build_pagetables bl build_pagetables
#if defined(PHYSADDR) && (KERNVIRTADDR != KERNBASE)
/*
* If the kernel wasn't loaded at the beginning of the ram, map the memory
* before the kernel too, as some ports use that for pagetables, stack, etc...
*/
ldr r1, =PHYSADDR
ldr r2, =KERNBASE
ldr r3, =((KERNVIRTADDR - KERNBASE) / L1_S_SIZE)
bl build_pagetables
#endif
/* Create a device mapping for early_printf if specified. */ /* Create a device mapping for early_printf if specified. */
#if defined(SOCDEV_PA) && defined(SOCDEV_VA) #if defined(SOCDEV_PA) && defined(SOCDEV_VA)

View File

@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h> #include <machine/bus.h>
#include "am335x_scm.h"
#define CM_PER 0 #define CM_PER 0
#define CM_PER_L4LS_CLKSTCTRL (CM_PER + 0x000) #define CM_PER_L4LS_CLKSTCTRL (CM_PER + 0x000)
#define CM_PER_L3S_CLKSTCTRL (CM_PER + 0x004) #define CM_PER_L3S_CLKSTCTRL (CM_PER + 0x004)
@ -619,10 +621,9 @@ am335x_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq)
{ {
uint32_t ctrl_status; uint32_t ctrl_status;
/* Read the input clock freq from the control module */ /* Read the input clock freq from the control module. */
/* control_status reg (0x40) */ if (ti_scm_reg_read_4(SCM_CTRL_STATUS, &ctrl_status))
if (ti_scm_reg_read_4(0x40, &ctrl_status)) return (ENXIO);
return ENXIO;
switch ((ctrl_status>>22) & 0x3) { switch ((ctrl_status>>22) & 0x3) {
case 0x0: case 0x0:

View File

@ -0,0 +1,169 @@
/*-
* Copyright (c) 2016 Rubicon Communications, LLC (Netgate)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/sysctl.h>
#include <machine/bus.h>
#include <arm/ti/am335x/am335x_scm.h>
#include <arm/ti/ti_cpuid.h>
#include <arm/ti/ti_scm.h>
#define TZ_ZEROC 2731
struct am335x_scm_softc {
int sc_last_temp;
struct sysctl_oid *sc_temp_oid;
};
static int
am335x_scm_temp_sysctl(SYSCTL_HANDLER_ARGS)
{
device_t dev;
int i, temp;
struct am335x_scm_softc *sc;
uint32_t reg;
dev = (device_t)arg1;
sc = device_get_softc(dev);
/* Read the temperature and convert to Kelvin. */
for(i = 50; i > 0; i--) {
ti_scm_reg_read_4(SCM_BGAP_CTRL, &reg);
if ((reg & SCM_BGAP_EOCZ) == 0)
break;
DELAY(50);
}
if ((reg & SCM_BGAP_EOCZ) == 0) {
sc->sc_last_temp =
(reg >> SCM_BGAP_TEMP_SHIFT) & SCM_BGAP_TEMP_MASK;
sc->sc_last_temp *= 10;
}
temp = sc->sc_last_temp + TZ_ZEROC;
return (sysctl_handle_int(oidp, &temp, 0, req));
}
static void
am335x_scm_identify(driver_t *driver, device_t parent)
{
device_t child;
/* AM335x only. */
if (ti_chip() != CHIP_AM335X)
return;
/* Make sure we attach only once. */
if (device_find_child(parent, "am335x_scm", -1) != NULL)
return;
child = device_add_child(parent, "am335x_scm", -1);
if (child == NULL)
device_printf(parent, "cannot add ti_scm child\n");
}
static int
am335x_scm_probe(device_t dev)
{
device_set_desc(dev, "AM335x Control Module Extension");
return (BUS_PROBE_DEFAULT);
}
static int
am335x_scm_attach(device_t dev)
{
struct am335x_scm_softc *sc;
struct sysctl_ctx_list *ctx;
struct sysctl_oid_list *tree;
uint32_t reg;
/* Set ADC to continous mode, clear output reset. */
reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV;
ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);
/* Flush write. */
ti_scm_reg_read_4(SCM_BGAP_CTRL, &reg);
/* Start the ADC conversion. */
reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV | SCM_BGAP_SOC;
ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);
/* Temperature sysctl. */
sc = device_get_softc(dev);
ctx = device_get_sysctl_ctx(dev);
tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
sc->sc_temp_oid = SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
"temperature", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
dev, 0, am335x_scm_temp_sysctl, "IK", "Current temperature");
return (0);
}
static int
am335x_scm_detach(device_t dev)
{
struct am335x_scm_softc *sc;
sc = device_get_softc(dev);
/* Remove temperature sysctl. */
if (sc->sc_temp_oid != NULL)
sysctl_remove_oid(sc->sc_temp_oid, 1, 0);
/* Stop the bandgap ADC. */
ti_scm_reg_write_4(SCM_BGAP_CTRL, SCM_BGAP_BGOFF);
return (0);
}
static device_method_t am335x_scm_methods[] = {
DEVMETHOD(device_identify, am335x_scm_identify),
DEVMETHOD(device_probe, am335x_scm_probe),
DEVMETHOD(device_attach, am335x_scm_attach),
DEVMETHOD(device_detach, am335x_scm_detach),
DEVMETHOD_END
};
static driver_t am335x_scm_driver = {
"am335x_scm",
am335x_scm_methods,
sizeof(struct am335x_scm_softc),
};
static devclass_t am335x_scm_devclass;
DRIVER_MODULE(am335x_scm, ti_scm, am335x_scm_driver, am335x_scm_devclass, 0, 0);
MODULE_VERSION(am335x_scm, 1);
MODULE_DEPEND(am335x_scm, ti_scm, 1, 1, 1);

View File

@ -29,6 +29,15 @@
#define __AM335X_SCM_H__ #define __AM335X_SCM_H__
/* AM335x-specific registers for control module (scm) */ /* AM335x-specific registers for control module (scm) */
#define SCM_CTRL_STATUS 0x40
#define SCM_BGAP_CTRL 0x448
#define SCM_BGAP_TEMP_MASK 0xff
#define SCM_BGAP_TEMP_SHIFT 8
#define SCM_BGAP_BGOFF (1 << 6)
#define SCM_BGAP_SOC (1 << 4)
#define SCM_BGAP_CLRZ (1 << 3)
#define SCM_BGAP_CONTCONV (1 << 2)
#define SCM_BGAP_EOCZ (1 << 1)
#define SCM_USB_CTRL0 0x620 #define SCM_USB_CTRL0 0x620
#define SCM_USB_STS0 0x624 #define SCM_USB_STS0 0x624
#define SCM_USB_CTRL1 0x628 #define SCM_USB_CTRL1 0x628

View File

@ -13,6 +13,7 @@ arm/ti/am335x/am335x_pwmss.c standard
arm/ti/am335x/am335x_ehrpwm.c standard arm/ti/am335x/am335x_ehrpwm.c standard
arm/ti/am335x/am335x_ecap.c standard arm/ti/am335x/am335x_ecap.c standard
arm/ti/am335x/am335x_rtc.c optional am335x_rtc arm/ti/am335x/am335x_rtc.c optional am335x_rtc
arm/ti/am335x/am335x_scm.c standard
arm/ti/am335x/am335x_scm_padconf.c standard arm/ti/am335x/am335x_scm_padconf.c standard
arm/ti/am335x/am335x_usbss.c optional musb fdt arm/ti/am335x/am335x_usbss.c optional musb fdt
arm/ti/am335x/am335x_musb.c optional musb fdt arm/ti/am335x/am335x_musb.c optional musb fdt

View File

@ -1019,14 +1019,14 @@ cpswp_attach(device_t dev)
IFQ_SET_READY(&ifp->if_snd); IFQ_SET_READY(&ifp->if_snd);
/* Get high part of MAC address from control module (mac_id[0|1]_hi) */ /* Get high part of MAC address from control module (mac_id[0|1]_hi) */
ti_scm_reg_read_4(0x634 + sc->unit * 8, &reg); ti_scm_reg_read_4(CPSW_MAC_ID0_HI + sc->unit * 8, &reg);
mac_addr[0] = reg & 0xFF; mac_addr[0] = reg & 0xFF;
mac_addr[1] = (reg >> 8) & 0xFF; mac_addr[1] = (reg >> 8) & 0xFF;
mac_addr[2] = (reg >> 16) & 0xFF; mac_addr[2] = (reg >> 16) & 0xFF;
mac_addr[3] = (reg >> 24) & 0xFF; mac_addr[3] = (reg >> 24) & 0xFF;
/* Get low part of MAC address from control module (mac_id[0|1]_lo) */ /* Get low part of MAC address from control module (mac_id[0|1]_lo) */
ti_scm_reg_read_4(0x630 + sc->unit * 8, &reg); ti_scm_reg_read_4(CPSW_MAC_ID0_LO + sc->unit * 8, &reg);
mac_addr[4] = reg & 0xFF; mac_addr[4] = reg & 0xFF;
mac_addr[5] = (reg >> 8) & 0xFF; mac_addr[5] = (reg >> 8) & 0xFF;

View File

@ -46,6 +46,9 @@
#define CPSW_PORT_P_SA_LO(p) (CPSW_PORT_OFFSET + 0x120 + ((p-1) * 0x100)) #define CPSW_PORT_P_SA_LO(p) (CPSW_PORT_OFFSET + 0x120 + ((p-1) * 0x100))
#define CPSW_PORT_P_SA_HI(p) (CPSW_PORT_OFFSET + 0x124 + ((p-1) * 0x100)) #define CPSW_PORT_P_SA_HI(p) (CPSW_PORT_OFFSET + 0x124 + ((p-1) * 0x100))
#define CPSW_MAC_ID0_LO 0x0630
#define CPSW_MAC_ID0_HI 0x0634
#define CPSW_CPDMA_OFFSET 0x0800 #define CPSW_CPDMA_OFFSET 0x0800
#define CPSW_CPDMA_TX_CONTROL (CPSW_CPDMA_OFFSET + 0x04) #define CPSW_CPDMA_TX_CONTROL (CPSW_CPDMA_OFFSET + 0x04)
#define CPSW_CPDMA_TX_TEARDOWN (CPSW_CPDMA_OFFSET + 0x08) #define CPSW_CPDMA_TX_TEARDOWN (CPSW_CPDMA_OFFSET + 0x08)

View File

@ -131,7 +131,10 @@ ti_scm_attach(device_t dev)
ti_scm_sc = sc; ti_scm_sc = sc;
return (0); /* Attach platform extensions, if any. */
bus_generic_probe(dev);
return (bus_generic_attach(dev));
} }
int int

View File

@ -286,7 +286,7 @@ initarm(struct arm_boot_params *abp)
cpu_setup(); cpu_setup();
i80321_calibrate_delay(); i80321_calibrate_delay();
i81342_sdram_bounds(obio_bs_tag, IOP34X_VADDR, &memstart, &memsize); i81342_sdram_bounds(arm_base_bs_tag, IOP34X_VADDR, &memstart, &memsize);
physmem = memsize / PAGE_SIZE; physmem = memsize / PAGE_SIZE;
cninit(); cninit();
/* Set stack for exception handlers */ /* Set stack for exception handlers */

View File

@ -56,8 +56,6 @@ __FBSDID("$FreeBSD$");
#include <arm/xscale/i8134x/i81342reg.h> #include <arm/xscale/i8134x/i81342reg.h>
#include <arm/xscale/i8134x/obiovar.h> #include <arm/xscale/i8134x/obiovar.h>
bus_space_tag_t obio_bs_tag;
static int static int
obio_probe(device_t dev) obio_probe(device_t dev)
{ {
@ -69,8 +67,7 @@ obio_attach(device_t dev)
{ {
struct obio_softc *sc = device_get_softc(dev); struct obio_softc *sc = device_get_softc(dev);
obio_bs_tag = arm_base_bs_tag; sc->oba_st = arm_base_bs_tag;
sc->oba_st = obio_bs_tag;
sc->oba_rman.rm_type = RMAN_ARRAY; sc->oba_rman.rm_type = RMAN_ARRAY;
sc->oba_rman.rm_descr = "OBIO I/O"; sc->oba_rman.rm_descr = "OBIO I/O";
if (rman_init(&sc->oba_rman) != 0 || if (rman_init(&sc->oba_rman) != 0 ||

View File

@ -50,6 +50,5 @@ struct obio_softc {
struct rman oba_irq_rman; struct rman oba_irq_rman;
}; };
extern bus_space_tag_t obio_bs_tag;
#endif /* _IQ80321_OBIOVAR_H_ */ #endif /* _IQ80321_OBIOVAR_H_ */

View File

@ -54,14 +54,14 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
di->ops = uart_getops(&uart_ns8250_class); di->ops = uart_getops(&uart_ns8250_class);
di->bas.chan = 0; di->bas.chan = 0;
di->bas.bst = obio_bs_tag; di->bas.bst = arm_base_bs_tag;
di->bas.regshft = 2; di->bas.regshft = 2;
di->bas.rclk = 33334000; di->bas.rclk = 33334000;
di->baudrate = 115200; di->baudrate = 115200;
di->databits = 8; di->databits = 8;
di->stopbits = 1; di->stopbits = 1;
di->parity = UART_PARITY_NONE; di->parity = UART_PARITY_NONE;
uart_bus_space_io = obio_bs_tag; uart_bus_space_io = arm_base_bs_tag;
uart_bus_space_mem = NULL; uart_bus_space_mem = NULL;
di->bas.bsh = IOP34X_UART0_VADDR; di->bas.bsh = IOP34X_UART0_VADDR;
return (0); return (0);

View File

@ -2936,14 +2936,17 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
PTE_SYNC(l3); PTE_SYNC(l3);
pmap_invalidate_page(pmap, va); pmap_invalidate_page(pmap, va);
if ((pmap != pmap_kernel()) && (pmap == &curproc->p_vmspace->vm_pmap)) if (pmap != pmap_kernel()) {
cpu_icache_sync_range(va, PAGE_SIZE); if (pmap == &curproc->p_vmspace->vm_pmap)
cpu_icache_sync_range(va, PAGE_SIZE);
if ((mpte == NULL || mpte->wire_count == NL3PG) && if ((mpte == NULL || mpte->wire_count == NL3PG) &&
pmap_superpages_enabled() && (m->flags & PG_FICTITIOUS) == 0 && pmap_superpages_enabled() &&
vm_reserv_level_iffullpop(m) == 0) { (m->flags & PG_FICTITIOUS) == 0 &&
KASSERT(lvl == 2, ("Invalid pde level %d", lvl)); vm_reserv_level_iffullpop(m) == 0) {
pmap_promote_l2(pmap, pde, va, &lock); KASSERT(lvl == 2, ("Invalid pde level %d", lvl));
pmap_promote_l2(pmap, pde, va, &lock);
}
} }
if (lock != NULL) if (lock != NULL)

View File

@ -285,6 +285,7 @@ do_el1h_sync(struct trapframe *frame)
print_registers(frame); print_registers(frame);
printf(" esr: %.8lx\n", esr); printf(" esr: %.8lx\n", esr);
panic("VFP exception in the kernel"); panic("VFP exception in the kernel");
case EXCP_INSN_ABORT:
case EXCP_DATA_ABORT: case EXCP_DATA_ABORT:
far = READ_SPECIALREG(far_el1); far = READ_SPECIALREG(far_el1);
intr_enable(); intr_enable();

View File

@ -167,13 +167,14 @@ net_open(struct open_file *f, ...)
setenv("boot.netif.ip", inet_ntoa(myip), 1); setenv("boot.netif.ip", inet_ntoa(myip), 1);
setenv("boot.netif.netmask", intoa(netmask), 1); setenv("boot.netif.netmask", intoa(netmask), 1);
setenv("boot.netif.gateway", inet_ntoa(gateip), 1); setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
#ifdef LOADER_TFTP_SUPPORT setenv("boot.netif.server", inet_ntoa(rootip), 1);
setenv("boot.tftproot.server", inet_ntoa(rootip), 1); if (netproto == NET_TFTP) {
setenv("boot.tftproot.path", rootpath, 1); setenv("boot.tftproot.server", inet_ntoa(rootip), 1);
#else setenv("boot.tftproot.path", rootpath, 1);
setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); } else if (netproto == NET_NFS) {
setenv("boot.nfsroot.path", rootpath, 1); setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
#endif setenv("boot.nfsroot.path", rootpath, 1);
}
if (intf_mtu != 0) { if (intf_mtu != 0) {
char mtu[16]; char mtu[16];
sprintf(mtu, "%u", intf_mtu); sprintf(mtu, "%u", intf_mtu);
@ -367,16 +368,24 @@ net_print(int verbose)
uint32_t uint32_t
net_parse_rootpath() net_parse_rootpath()
{ {
int i; int i, ipstart;
n_long addr = INADDR_NONE; n_long addr = INADDR_NONE;
netproto = NET_NFS;
if (tftpip.s_addr != 0) {
netproto = NET_TFTP;
addr = tftpip.s_addr;
}
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
if (rootpath[i] == ':') if (rootpath[i] == ':')
break; break;
if (i && i != FNAME_SIZE && rootpath[i] == ':') { if (i && i != FNAME_SIZE && rootpath[i] == ':') {
rootpath[i++] = '\0'; rootpath[i++] = '\0';
addr = inet_addr(&rootpath[0]); addr = inet_addr(&rootpath[ipstart]);
bcopy(&rootpath[i], rootpath, strlen(&rootpath[i])+1); bcopy(&rootpath[i], rootpath, strlen(&rootpath[i])+1);
} }
return (addr); return (addr);
} }

View File

@ -89,11 +89,15 @@ EFI_TARGET= efi-app-ia32
EFI_TARGET= binary EFI_TARGET= binary
.endif .endif
# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
# for build reproducibility.
SOURCE_DATE_EPOCH?=1451606400
boot1.efi: ${PROG} boot1.efi: ${PROG}
if ${NM} ${.ALLSRC} | grep ' U '; then \ if ${NM} ${.ALLSRC} | grep ' U '; then \
echo "Undefined symbols in ${.ALLSRC}"; \ echo "Undefined symbols in ${.ALLSRC}"; \
exit 1; \ exit 1; \
fi fi
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
-j .dynamic -j .dynsym -j .rel.dyn \ -j .dynamic -j .dynsym -j .rel.dyn \
-j .rela.dyn -j .reloc -j .eh_frame \ -j .rela.dyn -j .reloc -j .eh_frame \

View File

@ -13,10 +13,6 @@ SRCS+= time.c
SRCS+= time_event.c SRCS+= time_event.c
.endif .endif
.if defined(LOADER_TFTP_SUPPORT)
CFLAGS+= -DLOADER_TFTP_SUPPORT -DNETIF_OPEN_CLOSE_ONCE
.endif
# We implement a slightly non-standard %S in that it always takes a # We implement a slightly non-standard %S in that it always takes a
# CHAR16 that's common in UEFI-land instead of a wchar_t. This only # CHAR16 that's common in UEFI-land instead of a wchar_t. This only
# seems to matter on arm64 where wchar_t defaults to an int instead # seems to matter on arm64 where wchar_t defaults to an int instead

View File

@ -21,10 +21,6 @@ SRCS= autoload.c \
smbios.c \ smbios.c \
vers.c vers.c
.if defined(LOADER_TFTP_SUPPORT)
CFLAGS+= -DLOADER_TFTP_SUPPORT -DNETIF_OPEN_CLOSE_ONCE
.endif
.if ${MK_ZFS} != "no" .if ${MK_ZFS} != "no"
SRCS+= zfs.c SRCS+= zfs.c
.PATH: ${.CURDIR}/../../zfs .PATH: ${.CURDIR}/../../zfs
@ -135,11 +131,15 @@ EFI_TARGET= efi-app-ia32
EFI_TARGET= binary EFI_TARGET= binary
.endif .endif
# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
# for build reproducibility.
SOURCE_DATE_EPOCH?=1451606400
loader.efi: ${PROG} loader.efi: ${PROG}
if ${NM} ${.ALLSRC} | grep ' U '; then \ if ${NM} ${.ALLSRC} | grep ' U '; then \
echo "Undefined symbols in ${.ALLSRC}"; \ echo "Undefined symbols in ${.ALLSRC}"; \
exit 1; \ exit 1; \
fi fi
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
-j .dynamic -j .dynsym -j .rel.dyn \ -j .dynamic -j .dynsym -j .rel.dyn \
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \

View File

@ -51,11 +51,8 @@ struct fs_ops *file_system[] = {
&dosfs_fsops, &dosfs_fsops,
&ufs_fsops, &ufs_fsops,
&cd9660_fsops, &cd9660_fsops,
#ifdef LOADER_TFTP_SUPPORT
&tftp_fsops, &tftp_fsops,
#else
&nfs_fsops, &nfs_fsops,
#endif
&gzipfs_fsops, &gzipfs_fsops,
&bzipfs_fsops, &bzipfs_fsops,
NULL NULL

View File

@ -1,5 +1,5 @@
# $FreeBSD$ # $FreeBSD$
SUBDIR=arm mips powerpc SUBDIR=arm arm64 mips powerpc
.include <bsd.subdir.mk> .include <bsd.subdir.mk>

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