1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-28 08:02:54 +00:00

Merge ^/head r325663 through r325841.

This commit is contained in:
Hans Petter Selasky 2017-11-15 11:28:11 +00:00
commit 55b1c6e7e4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/bsd_rdma_4_9/; revision=325842
1303 changed files with 25526 additions and 86011 deletions

View File

@ -86,7 +86,7 @@ sh(1) jilles Pre-commit review requested. This also applies
compiled in as builtins.
share/mk imp, bapt, bdrewery, emaste, sjg Make is hard.
share/mk/*.test.mk freebsd-testing,ngie (same list as share/mk too) Pre-commit review requested.
sys/boot/forth dteske Pre-commit review requested.
stand/forth dteske Pre-commit review requested.
sys/compat/linuxkpi hselasky If in doubt, ask.
sys/dev/e1000 erj Pre-commit phabricator review requested.
sys/dev/ixgbe erj Pre-commit phabricator review requested.

View File

@ -130,7 +130,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
installkernel.debug packagekernel packageworld \
reinstallkernel reinstallkernel.debug \
installworld kernel-toolchain libraries lint maninstall \
obj objlink rerelease showconfig tags toolchain update \
obj objlink showconfig tags toolchain update \
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
_build-tools _build-metadata _cross-tools _includes _libraries \
build32 distribute32 install32 buildsoft distributesoft installsoft \
@ -167,6 +167,18 @@ META_TGT_WHITELIST+= \
tinderbox toolchain \
toolchains universe world worlds xdev xdev-build
# Likewise for AUTO_OBJ. Many targets do not need object directories created
# for each visited directory. Only when things are being built are they
# needed. Having AUTO_OBJ disabled in a build target is fine as it should
# fallback to running 'make obj' as needed. If a target is not in this list
# then it is ran with MK_AUTO_OBJ=no in environment.
# 'showconfig' is in the list to avoid forcing MK_AUTO_OBJ=no for it.
AUTO_OBJ_TGT_WHITELIST+= \
_* all all-man build* depend everything *toolchain* includes \
libraries obj objlink showconfig tags xdev xdev-build native-xtools \
stage* create-packages* real-packages sign-packages package-pkg \
tinderbox universe* kernel kernels world worlds bmake
.ORDER: buildworld installworld
.ORDER: buildworld distrib-dirs
.ORDER: buildworld distribution
@ -235,8 +247,11 @@ SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
_MAKE= PATH=${PATH} MAKE_CMD="${MAKE}" ${SUB_MAKE} -f Makefile.inc1 \
TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
.if defined(MK_META_MODE) && ${MK_META_MODE} == "yes"
# Only allow meta mode for the whitelisted targets. See META_TGT_WHITELIST
# above.
# above. If overridden as a make argument then don't bother trying to
# disable it.
.if empty(.MAKEOVERRIDES:MMK_META_MODE)
.for _tgt in ${META_TGT_WHITELIST}
.if make(${_tgt})
_CAN_USE_META_MODE?= yes
@ -244,17 +259,37 @@ _CAN_USE_META_MODE?= yes
.endfor
.if !defined(_CAN_USE_META_MODE)
_MAKE+= MK_META_MODE=no
MK_META_MODE= no
.if defined(.PARSEDIR)
.unexport META_MODE
.endif
.elif defined(MK_META_MODE) && ${MK_META_MODE} == "yes"
.endif # !defined(_CAN_USE_META_MODE)
.endif # empty(.MAKEOVERRIDES:MMK_META_MODE)
.if ${MK_META_MODE} == "yes"
.if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig)
# Require filemon be loaded to provide a working incremental build
.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. \
${.newline}ERROR: WITH_META_MODE is enabled but requires filemon for an incremental build. \
${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error.
.endif # !exists(/dev/filemon) && !defined(NO_FILEMON)
.endif # !defined(_CAN_USE_META_MODE)
.endif # ${MK_META_MODE} == yes
.endif # defined(MK_META_MODE) && ${MK_META_MODE} == yes
# Only allow AUTO_OBJ for the whitelisted targets. See AUTO_OBJ_TGT_WHITELIST
# above. MK_AUTO_OBJ not checked here for "yes" as it may not yet be enabled
# since it is opportunistic.
.if empty(.MAKEOVERRIDES:MMK_AUTO_OBJ)
.for _tgt in ${AUTO_OBJ_TGT_WHITELIST}
.if make(${_tgt})
_CAN_USE_AUTO_OBJ?= yes
.endif
.endfor
.if !defined(_CAN_USE_AUTO_OBJ)
_MAKE+= MK_AUTO_OBJ=no
MK_AUTO_OBJ= no
.endif
.endif # empty(.MAKEOVERRIDES:MMK_AUTO_OBJ)
# Guess target architecture from target type, and vice versa, based on
# historic FreeBSD practice of tending to have TARGET == TARGET_ARCH
@ -290,6 +325,15 @@ ${XTGTS}: _assert_target
_TARGET?= ${MACHINE}
_TARGET_ARCH?= ${MACHINE_ARCH}
.if make(native-xtools*)
NXB_TARGET:= ${_TARGET}
NXB_TARGET_ARCH:= ${_TARGET_ARCH}
_TARGET= ${MACHINE}
_TARGET_ARCH= ${MACHINE_ARCH}
_MAKE+= NXB_TARGET=${NXB_TARGET} \
NXB_TARGET_ARCH=${NXB_TARGET_ARCH}
.endif
.if make(print-dir)
.SILENT:
.endif
@ -554,7 +598,7 @@ universe_${target}_kernels: universe_${target}_worlds .PHONY
universe_${target}_kernels: universe_${target}_prologue .MAKE .PHONY
.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
${SUB_MAKE} -DNO_OBJ LINT \
${SUB_MAKE} LINT \
> ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
(echo "${target} 'make LINT' failed," \
"check _.${target}.makeLINT for details"| ${MAKEFAIL}))

View File

@ -251,6 +251,9 @@ SUBDIR+=secure
.if !defined(NO_SHARE)
SUBDIR+=share
.endif
.if ${MK_BOOT} != "no"
SUBDIR+=stand
.endif
SUBDIR+=sys usr.bin usr.sbin
.if ${MK_TESTS} != "no"
SUBDIR+= tests
@ -1986,6 +1989,9 @@ _rescue=rescue/rescue
.if ${MK_TCSH} != "no"
_tcsh=bin/csh
.endif
.if ${MK_FILE} != "no"
_libmagic=lib/libmagic
.endif
# kernel-toolchain skips _cleanobj, so handle cleaning up previous
# build-tools directories if needed.
@ -2002,7 +2008,7 @@ _bt_clean= ${CLEANDIR}
${_rescue} \
${_share} \
usr.bin/awk \
lib/libmagic \
${_libmagic} \
usr.bin/mkesdb_static \
usr.bin/mkcsmapper_static \
usr.bin/vi/catalog \
@ -2079,7 +2085,7 @@ _clang_libs= lib/clang
_gcc= gnu/usr.bin/cc
.endif
.if ${MK_USB} != "no"
_usb_tools= sys/boot/usb/tools
_usb_tools= stand/usb/tools
.endif
cross-tools: .MAKE .PHONY
@ -2110,7 +2116,7 @@ cross-tools: .MAKE .PHONY
# to pickup.
#
NXBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/nxb/
NXBOBJTOP= ${NXBOBJROOT}${TARGET}.${TARGET_ARCH}
NXBOBJTOP= ${NXBOBJROOT}${NXB_TARGET}.${NXB_TARGET_ARCH}
NXTP?= /nxb-bin
.if ${NXTP:N/*}
.error NXTP variable should be an absolute path
@ -2180,20 +2186,27 @@ NXBDIRS+= \
usr.bin/yacc \
usr.sbin/chown
SUBDIR_DEPEND_usr.bin/clang= lib/clang
.if ${MK_CLANG} != "no"
NXBDIRS+= lib/clang
SUBDIR_DEPEND_usr.bin/clang= lib/clang
NXBDIRS+= usr.bin/clang
.elif ${MK_GCC} != "no"
.endif
.if ${MK_GCC} != "no"
NXBDIRS+= gnu/usr.bin/cc
.endif
.if ${MK_BINUTILS} != "no"
NXBDIRS+= gnu/usr.bin/binutils
.endif
# XXX: native-xtools passes along ${NXBDIRS} in SUBDIR_OVERRIDE that needs
# to be evaluated after NXBDIRS is set.
.if make(install) && !empty(SUBDIR_OVERRIDE)
SUBDIR= ${SUBDIR_OVERRIDE}
.endif
NXBMAKEARGS+= \
OBJTOP=${NXBOBJTOP:Q} \
OBJROOT=${NXBOBJROOT:Q} \
MAKEOBJDIRPREFIX= \
-DNO_SHARED \
-DNO_CPU_CFLAGS \
-DNO_PIC \
@ -2216,7 +2229,10 @@ NXBMAKEARGS+= \
MK_WARNS=no \
MK_ZFS=no
.if make(native-xtools*) && \
(!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH))
.error Missing NXB_TARGET / NXB_TARGET_ARCH
.endif
# For 'toolchain' we want to produce native binaries that themselves generate
# native binaries.
NXBTMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS:N-DNO_PIC:N-DNO_SHARED} \
@ -2224,11 +2240,32 @@ NXBTMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS:N-DNO_PIC:N-DNO_SHARED} \
# For 'everything' we want to produce native binaries (hence -target to
# be MACHINE) that themselves generate TARGET.TARGET_ARCH binaries.
# TARGET/TARGET_ARCH are still passed along from user.
NXBMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS} \
#
# Use the toolchain we create as an external toolchain.
.if ${USING_SYSTEM_COMPILER} == "yes" || ${XCC:N${CCACHE_BIN}:M/*}
NXBMAKE+= XCC="${XCC}" \
XCXX="${XCXX}" \
XCPP="${XCPP}"
.else
NXBMAKE+= XCC="${NXBOBJTOP}/tmp/usr/bin/cc" \
XCXX="${NXBOBJTOP}/tmp/usr/bin/c++" \
XCPP="${NXBOBJTOP}/tmp/usr/bin/cpp"
.endif
NXBMAKE+= ${NXBMAKEENV} ${MAKE} -f Makefile.inc1 ${NXBMAKEARGS} \
TARGET=${NXB_TARGET} TARGET_ARCH=${NXB_TARGET_ARCH} \
TARGET_TRIPLE=${MACHINE_TRIPLE:Q}
# NXBDIRS is improperly based on MACHINE rather than NXB_TARGET. Need to
# invoke a sub-make to reevaluate MK_GCC, etc, for NXBDIRS.
NXBMAKE+= SUBDIR_OVERRIDE='$${NXBDIRS:M*}'
# Need to avoid the -isystem logic when using clang as an external toolchain
# even if the TARGET being built for wants GCC.
NXBMAKE+= WANT_COMPILER_TYPE='$${X_COMPILER_TYPE}'
native-xtools: .PHONY
${_+_}cd ${.CURDIR}; ${NXBTMAKE} _cleanobj
# Build the bootstrap/host/cross tools that produce native binaries
${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain
# Pass along MK_GCC=yes to ensure GCC-needed build tools are built.
# We don't quite know what the NXB_TARGET wants so just build it.
${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain MK_GCC=yes
# Populate includes/libraries sysroot that produce native binaries.
# This is split out from 'toolchain' above mostly so that target LLVM
# libraries have a proper LLVM_DEFAULT_TARGET_TRIPLE without
@ -2238,10 +2275,9 @@ native-xtools: .PHONY
${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes MK_CLANG=no MK_GCC=no
${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries MK_CLANG=no MK_GCC=no
.if !defined(NO_OBJWALK)
${_+_}cd ${.CURDIR}; ${NXBMAKE} SUBDIR_OVERRIDE="${NXBDIRS:M*}" _obj
${_+_}cd ${.CURDIR}; ${NXBMAKE} _obj
.endif
${_+_}cd ${.CURDIR}; ${NXBMAKE} SUBDIR_OVERRIDE="${NXBDIRS:M*}" \
everything
${_+_}cd ${.CURDIR}; ${NXBMAKE} everything
@echo ">> native-xtools done. Use 'make native-xtools-install' to install to a given DESTDIR"
native-xtools-install: .PHONY
@ -2250,9 +2286,8 @@ native-xtools-install: .PHONY
-p ${NXBDESTDIR}/usr >/dev/null
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${NXBDESTDIR}/usr/include >/dev/null
${_+_}cd ${.CURDIR}; ${NXBMAKE} -f Makefile.inc1 \
${_+_}cd ${.CURDIR}; ${NXBMAKE} \
DESTDIR=${NXBDESTDIR} \
SUBDIR_OVERRIDE="${NXBDIRS:M*}" \
-DNO_ROOT \
install
@ -2785,7 +2820,8 @@ cleanworld cleanuniverse: .PHONY
-chflags -R 0 ${BW_CANONICALOBJDIR}
rm -rf ${BW_CANONICALOBJDIR}*
.endif
.if make(cleanworld) && ${MK_AUTO_OBJ} == "no"
.if make(cleanworld) && ${MK_AUTO_OBJ} == "no" && \
(empty(BW_CANONICALOBJDIR) || ${.CURDIR:tA} == ${BW_CANONICALOBJDIR:tA})
.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
# To be safe in this case, fall back to a 'make cleandir'
${_+_}@cd ${.CURDIR}; ${MAKE} cleandir

View File

@ -38,6 +38,25 @@
# xargs -n1 | sort | uniq -d;
# done
# 20171114: Removal of all fortune datfiles other than freebsd-tips
OLD_FILES+=usr/share/games/fortune/fortunes
OLD_FILES+=usr/share/games/fortune/fortunes.dat
OLD_FILES+=usr/share/games/fortune/gerrold.limerick
OLD_FILES+=usr/share/games/fortune/gerrold.limerick.dat
OLD_FILES+=usr/share/games/fortune/limerick
OLD_FILES+=usr/share/games/fortune/limerick.dat
OLD_FILES+=usr/share/games/fortune/murphy
OLD_FILES+=usr/share/games/fortune/murphy-o
OLD_FILES+=usr/share/games/fortune/murphy-o.dat
OLD_FILES+=usr/share/games/fortune/murphy.dat
OLD_FILES+=usr/share/games/fortune/startrek
OLD_FILES+=usr/share/games/fortune/startrek.dat
OLD_FILES+=usr/share/games/fortune/zippy
OLD_FILES+=usr/share/games/fortune/zippy.dat
# 20171112: Removal of eqnchar definition
OLD_FILES+=usr/share/misc/eqnchar
# 20171110: Removal of mailaddr man page
OLD_FILES+=usr/share/man/man7/mailaddr.7.gz
# 20171108: badsect(8) removal
OLD_FILES+=sbin/badsect
OLD_FILES+=rescue/badsect
@ -71,7 +90,7 @@ OLD_FILES+=usr/lib/libcap_random.a
OLD_FILES+=usr/lib/libcap_random_p.a
OLD_FILES+=usr/lib/libcap_sysctl.a
OLD_FILES+=usr/lib/libcap_sysctl_p.a
# 20171031: Removal of obsolete man files
# 20171031: Removal of adding_user man page
OLD_FILES+=usr/share/man/man7/adding_user.7.gz
# 20171031: Disconnected libpathconv tests
OLD_DIRS+=usr/tests/lib/libpathconv

View File

@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
****************************** SPECIAL WARNING: ******************************
201711xx:
The LOADER_FIREWIRE_SUPPORT build variable as been renamed to
WITH/OUT_LOADER_FIREWIRE. LOADER_{NO_,}GELI_SUPPORT has been renamed
to WITH/OUT_LOADER_GELI.
20171106:
The naive and non-compliant support of posix_fallocate(2) in ZFS
has been removed as of r325320. The system call now returns EINVAL

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 5, 2013
.Dd November 14, 2017
.Dt FREEBSD-VERSION 1
.Os
.Sh NAME
@ -33,7 +33,7 @@
.Nd print the version and patch level of the installed system
.Sh SYNOPSIS
.Nm
.Op Fl ku
.Op Fl kru
.Sh DESCRIPTION
The
.Nm
@ -50,6 +50,11 @@ if a new kernel has been installed but the system has not yet
rebooted,
.Nm
will print the version and patch level of the new kernel.
.It Fl r
Print the version and patch level of the running kernel.
Unlike
.Xr uname 1 ,
this is unaffected by environment variables.
.It Fl u
Print the version and patch level of the installed userland.
These are hardcoded into
@ -57,14 +62,10 @@ These are hardcoded into
during the build.
.El
.Pp
If both
.Fl k
and
.Fl u
are specified,
If several of the above options are specified,
.Nm
will print the kernel version first, then the userland version, on
separate lines.
will print the installed kernel version first, then the running kernel
version, and finally the userland version, on separate lines.
If neither is specified, it will print the userland version only.
.Sh IMPLEMENTATION NOTES
The

View File

@ -38,7 +38,7 @@ LOADER_RE1='^\([A-Z_a-z][0-9A-Z_a-z]*=[-./0-9A-Z_a-z]\{1,\}\).*$'
LOADER_RE2='^\([A-Z_a-z][0-9A-Z_a-z]*="[-./0-9A-Z_a-z]\{1,\}"\).*$'
KERNEL_RE='^@@TYPE@@ \([-.0-9A-Za-z]\{1,\}\) .*$'
progname=$(basename $0)
progname=${0##*/}
#
# Print an error message and exit.
@ -70,6 +70,13 @@ kernel_version() {
what -qs "$kernfile" | sed -n "s/$KERNEL_RE/\\1/p"
}
#
# Print the version of the currently running kernel.
#
running_version() {
sysctl -n kern.osrelease
}
#
# Print the hardcoded userland version.
#
@ -81,7 +88,7 @@ userland_version() {
# Print a usage string and exit.
#
usage() {
echo "usage: $progname [-ku]" >&2
echo "usage: $progname [-kru]" >&2
exit 1
}
@ -90,11 +97,14 @@ usage() {
#
main() {
# parse command-line arguments
while getopts "ku" option ; do
while getopts "kru" option ; do
case $option in
k)
opt_k=1
;;
r)
opt_r=1
;;
u)
opt_u=1
;;
@ -108,15 +118,20 @@ main() {
fi
# default is -u
if [ $((opt_k + opt_u)) -eq 0 ] ; then
if [ $((opt_k + opt_r + opt_u)) -eq 0 ] ; then
opt_u=1
fi
# print kernel version
# print installed kernel version
if [ $opt_k ] ; then
kernel_version
fi
# print running kernel version
if [ $opt_r ] ; then
running_version
fi
# print userland version
if [ $opt_u ] ; then
userland_version

View File

@ -1,11 +0,0 @@
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
The examples provided by Facebook are for non-commercial testing and evaluation
purposes only. Facebook reserves all rights not expressly granted.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,85 +0,0 @@
Zstandard library files
================================
The __lib__ directory contains several directories.
Depending on target use case, it's enough to include only files from relevant directories.
#### API
Zstandard's stable API is exposed within [zstd.h](zstd.h),
at the root of `lib` directory.
#### Advanced API
Some additional API may be useful if you're looking into advanced features :
- common/error_public.h : transforms `size_t` function results into an `enum`,
for precise error handling.
- ZSTD_STATIC_LINKING_ONLY : if you define this macro _before_ including `zstd.h`,
it will give access to advanced and experimental API.
These APIs shall ___never be used with dynamic library___ !
They are not "stable", their definition may change in the future.
Only static linking is allowed.
#### ZSTDMT API
To enable multithreaded compression within the library, invoke `make lib-mt` target.
Prototypes are defined in header file `compress/zstdmt_compress.h`.
When linking a program that uses ZSTDMT API against libzstd.a on a POSIX system,
`-pthread` flag must be provided to the compiler and linker.
Note : ZSTDMT prototypes can still be used with a library built without multithread support,
but in this case, they will be single threaded only.
#### Modular build
Directory `common/` is required in all circumstances.
You can select to support compression only, by just adding files from the `compress/` directory,
In a similar way, you can build a decompressor-only library with the `decompress/` directory.
Other optional functionalities provided are :
- `dictBuilder/` : source files to create dictionaries.
The API can be consulted in `dictBuilder/zdict.h`.
This module also depends on `common/` and `compress/` .
- `legacy/` : source code to decompress previous versions of zstd, starting from `v0.1`.
This module also depends on `common/` and `decompress/` .
Library compilation must include directive `ZSTD_LEGACY_SUPPORT = 1` .
The main API can be consulted in `legacy/zstd_legacy.h`.
Advanced API from each version can be found in their relevant header file.
For example, advanced API for version `v0.4` is in `legacy/zstd_v04.h` .
#### Using MinGW+MSYS to create DLL
DLL can be created using MinGW+MSYS with the `make libzstd` command.
This command creates `dll\libzstd.dll` and the import library `dll\libzstd.lib`.
The import library is only required with Visual C++.
The header file `zstd.h` and the dynamic library `dll\libzstd.dll` are required to
compile a project using gcc/MinGW.
The dynamic library has to be added to linking options.
It means that if a project that uses ZSTD consists of a single `test-dll.c`
file it should be linked with `dll\libzstd.dll`. For example:
```
gcc $(CFLAGS) -Iinclude/ test-dll.c -o test-dll dll\libzstd.dll
```
The compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`.
#### Obsolete streaming API
Streaming is now provided within `zstd.h`.
Older streaming API is still available within `deprecated/zbuff.h`.
It will be removed in a future version.
Consider migrating code towards newer streaming API in `zstd.h`.
#### Miscellaneous
The other files are not source code. There are :
- LICENSE : contains the BSD license text
- Makefile : script to compile or install zstd library (static and dynamic)
- libzstd.pc.in : for pkg-config (`make install`)
- README.md : this file

View File

@ -1,103 +0,0 @@
/**
* Copyright (c) 2016 Tino Reichardt
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* You can contact the author at:
* - zstdmt source repository: https://github.com/mcmilk/zstdmt
*/
#ifndef THREADING_H_938743
#define THREADING_H_938743
#if defined (__cplusplus)
extern "C" {
#endif
#if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
/**
* Windows minimalist Pthread Wrapper, based on :
* http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
*/
#ifdef WINVER
# undef WINVER
#endif
#define WINVER 0x0600
#ifdef _WIN32_WINNT
# undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0600
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
/* mutex */
#define pthread_mutex_t CRITICAL_SECTION
#define pthread_mutex_init(a,b) (InitializeCriticalSection((a)), 0)
#define pthread_mutex_destroy(a) DeleteCriticalSection((a))
#define pthread_mutex_lock(a) EnterCriticalSection((a))
#define pthread_mutex_unlock(a) LeaveCriticalSection((a))
/* condition variable */
#define pthread_cond_t CONDITION_VARIABLE
#define pthread_cond_init(a, b) (InitializeConditionVariable((a)), 0)
#define pthread_cond_destroy(a) /* No delete */
#define pthread_cond_wait(a, b) SleepConditionVariableCS((a), (b), INFINITE)
#define pthread_cond_signal(a) WakeConditionVariable((a))
#define pthread_cond_broadcast(a) WakeAllConditionVariable((a))
/* pthread_create() and pthread_join() */
typedef struct {
HANDLE handle;
void* (*start_routine)(void*);
void* arg;
} pthread_t;
int pthread_create(pthread_t* thread, const void* unused,
void* (*start_routine) (void*), void* arg);
#define pthread_join(a, b) _pthread_join(&(a), (b))
int _pthread_join(pthread_t* thread, void** value_ptr);
/**
* add here more wrappers as required
*/
#elif defined(ZSTD_MULTITHREAD) /* posix assumed ; need a better detection method */
/* === POSIX Systems === */
# include <pthread.h>
#else /* ZSTD_MULTITHREAD not defined */
/* No multithreading support */
#define pthread_mutex_t int /* #define rather than typedef, because sometimes pthread support is implicit, resulting in duplicated symbols */
#define pthread_mutex_init(a,b) ((void)a, 0)
#define pthread_mutex_destroy(a)
#define pthread_mutex_lock(a)
#define pthread_mutex_unlock(a)
#define pthread_cond_t int
#define pthread_cond_init(a,b) ((void)a, 0)
#define pthread_cond_destroy(a)
#define pthread_cond_wait(a,b)
#define pthread_cond_signal(a)
#define pthread_cond_broadcast(a)
/* do not use pthread_t */
#endif /* ZSTD_MULTITHREAD */
#if defined (__cplusplus)
}
#endif
#endif /* THREADING_H_938743 */

View File

@ -1,108 +0,0 @@
# ##########################################################################
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This Makefile is validated for Linux, and macOS targets
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
# ##########################################################################
CFLAGS ?= -O3
CXXFLAGS ?= -O3
ZSTDDIR = ../../lib
PRGDIR = ../../programs
FUZZ_CPPFLAGS := -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
-I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR) \
-DZSTD_DEBUG=1 -DMEM_FORCE_MEMORY_ACCESS=0 \
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION $(CPPFLAGS)
FUZZ_CFLAGS := -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
-Wstrict-prototypes -Wundef -Wformat-security \
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
-Wredundant-decls \
-g -fno-omit-frame-pointer $(CFLAGS)
FUZZ_CXXFLAGS := -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
-Wstrict-aliasing=1 -Wswitch-enum \
-Wdeclaration-after-statement -Wstrict-prototypes -Wundef \
-Wformat-security -Wvla -Wformat=2 -Winit-self -Wfloat-equal \
-Wwrite-strings -Wredundant-decls \
-g -fno-omit-frame-pointer -std=c++11 $(CXXFLAGS)
FUZZ_LDFLAGS := $(LDFLAGS)
FUZZ_ARFLAGS := $(ARFLAGS)
FUZZ_TARGET_FLAGS = $(FUZZ_CPPFLAGS) $(FUZZ_CXXFLAGS) $(FUZZ_LDFLAGS)
FUZZ_HEADERS := fuzz_helpers.h fuzz.h
ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c
ZSTDCOMP_FILES := $(ZSTDDIR)/compress/*.c
ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/*.c
ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES)
ZSTD_OBJ := $(patsubst %.c,%.o, $(wildcard $(ZSTD_FILES)))
LIBFUZZER ?= -lFuzzer
.PHONY: default all clean
default: all
all: round_trip simple_decompress
%.o: %.c
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $^ -c -o $@
simple_round_trip: $(FUZZ_HEADERS) $(ZSTD_OBJ) simple_round_trip.o
$(CXX) $(FUZZ_TARGET_FLAGS) $(ZSTD_OBJ) simple_round_trip.o $(LIBFUZZER) -o $@
stream_round_trip: $(FUZZ_HEADERS) $(ZSTD_OBJ) stream_round_trip.o
$(CXX) $(FUZZ_TARGET_FLAGS) $(ZSTD_OBJ) stream_round_trip.o $(LIBFUZZER) -o $@
simple_decompress: $(FUZZ_HEADERS) $(ZSTD_OBJ) simple_decompress.o
$(CXX) $(FUZZ_TARGET_FLAGS) $(ZSTD_OBJ) simple_decompress.o $(LIBFUZZER) -o $@
stream_decompress: $(FUZZ_HEADERS) $(ZSTD_OBJ) stream_decompress.o
$(CXX) $(FUZZ_TARGET_FLAGS) $(ZSTD_OBJ) stream_decompress.o $(LIBFUZZER) -o $@
libregression.a: $(FUZZ_HEADERS) $(PRGDIR)/util.h regression_driver.o
$(AR) $(FUZZ_ARFLAGS) $@ regression_driver.o
%-regression: libregression.a
$(RM) $*
$(MAKE) $* LDFLAGS="$(FUZZ_LDFLAGS) -L." LIBFUZZER=-lregression
%-regression-test: %-regression
./$* corpora/$*
regression-test: \
simple_round_trip-regression-test \
stream_round_trip-regression-test \
simple_decompress-regression-test \
stream_decompress-regression-test
%-msan: clean
$(MAKE) $* CFLAGS="-fsanitize=memory $(FUZZ_CFLAGS)" \
CXXFLAGS="-fsanitize=memory $(FUZZ_CXXFLAGS)"
UASAN_FLAGS := -fsanitize=address,undefined -fno-sanitize-recover=undefined \
-fno-sanitize=pointer-overflow
%-uasan: clean
$(MAKE) $* CFLAGS="$(FUZZ_CFLAGS) $(UASAN_FLAGS)" \
CXXFLAGS="$(FUZZ_CXXFLAGS) $(UASAN_FLAGS)"
# Install libfuzzer (not usable for MSAN testing)
# Provided for convienence. To use this library run make libFuzzer and
# set LDFLAGS=-L.
.PHONY: libFuzzer
libFuzzer:
@$(RM) -rf Fuzzer
@git clone https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer
@./Fuzzer/build.sh
clean:
@$(MAKE) -C $(ZSTDDIR) clean
@$(RM) -f *.a *.o
@$(RM) -f simple_round_trip stream_round_trip simple_decompress stream_decompress

View File

@ -1,34 +0,0 @@
# Fuzzing
Each fuzzing target can be built with multiple engines.
## LibFuzzer
You can install `libFuzzer` with `make libFuzzer`. Then you can make each target
with `make target LDFLAGS=-L. CC=clang CXX=clang++`.
## AFL
The regression driver also serves as a binary for `afl-fuzz`. You can make each
target with one of these commands:
```
make target-regression CC=afl-clang CXX=afl-clang++
AFL_MSAN=1 make target-regression-msan CC=afl-clang CXX=afl-clang++
AFL_ASAN=1 make target-regression-uasan CC=afl-clang CXX=afl-clang++
```
Then run as `./target @@`.
## Regression Testing
Each fuzz target has a corpus checked into the repo under `fuzz/corpora/`.
You can run regression tests on the corpora to ensure that inputs which
previously exposed bugs still pass. You can make these targets to run the
regression tests with different sanitizers.
```
make regression-test
make regression-test-msan
make regression-test-uasan
```

View File

@ -1,153 +0,0 @@
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* This fuzz target performs a zstd round-trip test (compress & decompress),
* compares the result with the original, and calls abort() on corruption.
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "fuzz_helpers.h"
#include "zstd.h"
static const int kMaxClevel = 19;
static ZSTD_CStream *cstream = NULL;
static ZSTD_DCtx *dctx = NULL;
static uint8_t* cBuf = NULL;
static uint8_t* rBuf = NULL;
static size_t bufSize = 0;
static uint32_t seed;
static ZSTD_outBuffer makeOutBuffer(uint8_t *dst, size_t capacity)
{
ZSTD_outBuffer buffer = { dst, 0, 0 };
FUZZ_ASSERT(capacity > 0);
buffer.size = (FUZZ_rand(&seed) % capacity) + 1;
FUZZ_ASSERT(buffer.size <= capacity);
return buffer;
}
static ZSTD_inBuffer makeInBuffer(const uint8_t **src, size_t *size)
{
ZSTD_inBuffer buffer = { *src, 0, 0 };
FUZZ_ASSERT(*size > 0);
buffer.size = (FUZZ_rand(&seed) % *size) + 1;
FUZZ_ASSERT(buffer.size <= *size);
*src += buffer.size;
*size -= buffer.size;
return buffer;
}
static size_t compress(uint8_t *dst, size_t capacity,
const uint8_t *src, size_t srcSize)
{
int cLevel = FUZZ_rand(&seed) % kMaxClevel;
size_t dstSize = 0;
FUZZ_ASSERT(!ZSTD_isError(ZSTD_initCStream(cstream, cLevel)));
while (srcSize > 0) {
ZSTD_inBuffer in = makeInBuffer(&src, &srcSize);
/* Mode controls the action. If mode == -1 we pick a new mode */
int mode = -1;
while (in.pos < in.size) {
ZSTD_outBuffer out = makeOutBuffer(dst, capacity);
/* Previous action finished, pick a new mode. */
if (mode == -1) mode = FUZZ_rand(&seed) % 10;
switch (mode) {
case 0: /* fall-though */
case 1: /* fall-though */
case 2: {
size_t const ret = ZSTD_flushStream(cstream, &out);
FUZZ_ASSERT_MSG(!ZSTD_isError(ret), ZSTD_getErrorName(ret));
if (ret == 0) mode = -1;
break;
}
case 3: {
size_t ret = ZSTD_endStream(cstream, &out);
FUZZ_ASSERT_MSG(!ZSTD_isError(ret), ZSTD_getErrorName(ret));
/* Reset the compressor when the frame is finished */
if (ret == 0) {
cLevel = FUZZ_rand(&seed) % kMaxClevel;
ret = ZSTD_initCStream(cstream, cLevel);
FUZZ_ASSERT(!ZSTD_isError(ret));
mode = -1;
}
break;
}
default: {
size_t const ret = ZSTD_compressStream(cstream, &out, &in);
FUZZ_ASSERT_MSG(!ZSTD_isError(ret), ZSTD_getErrorName(ret));
mode = -1;
}
}
dst += out.pos;
dstSize += out.pos;
capacity -= out.pos;
}
}
for (;;) {
ZSTD_outBuffer out = makeOutBuffer(dst, capacity);
size_t const ret = ZSTD_endStream(cstream, &out);
FUZZ_ASSERT_MSG(!ZSTD_isError(ret), ZSTD_getErrorName(ret));
dst += out.pos;
dstSize += out.pos;
capacity -= out.pos;
if (ret == 0) break;
}
return dstSize;
}
int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size)
{
size_t const neededBufSize = ZSTD_compressBound(size) * 2;
seed = FUZZ_seed(src, size);
/* Allocate all buffers and contexts if not already allocated */
if (neededBufSize > bufSize) {
free(cBuf);
free(rBuf);
cBuf = (uint8_t*)malloc(neededBufSize);
rBuf = (uint8_t*)malloc(neededBufSize);
bufSize = neededBufSize;
FUZZ_ASSERT(cBuf && rBuf);
}
if (!cstream) {
cstream = ZSTD_createCStream();
FUZZ_ASSERT(cstream);
}
if (!dctx) {
dctx = ZSTD_createDCtx();
FUZZ_ASSERT(dctx);
}
{
size_t const cSize = compress(cBuf, neededBufSize, src, size);
size_t const rSize =
ZSTD_decompressDCtx(dctx, rBuf, neededBufSize, cBuf, cSize);
FUZZ_ASSERT_MSG(!ZSTD_isError(rSize), ZSTD_getErrorName(rSize));
FUZZ_ASSERT_MSG(rSize == size, "Incorrect regenerated size");
FUZZ_ASSERT_MSG(!memcmp(src, rBuf, size), "Corruption!");
}
#ifndef STATEFULL_FUZZING
ZSTD_freeCStream(cstream); cstream = NULL;
ZSTD_freeDCtx(dctx); dctx = NULL;
#endif
return 0;
}

View File

@ -152,8 +152,6 @@ BIN1+= regdomain.xml
# -rwxr-xr-x root:wheel, for the new cron root:wheel
BIN2= netstart pccard_ether rc.suspend rc.resume
PPPCNF= ppp.conf
.if ${MK_SENDMAIL} == "no"
ETCMAIL=mailer.conf aliases
.else

View File

@ -20,7 +20,8 @@ options {
#XXX Yes, these are gross -- imp
set scsi-controller-regex
"(aac|adv|adw|aha|ahc|ahd|aic|amr|bt|ciss|dpt|\
esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm)\
esp|ida|iir|ips|isp|mlx|mly|mpr|mps|mpt|ncr|ncv|nsp|stg|sym|\
trm)\
[0-9]+";
set wifi-driver-regex
"(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|ral|rsu|rtwn|rum|run|\

View File

@ -790,16 +790,7 @@ clang/StaticAnalyzer/Checkers/Checkers.inc: \
${CLANG_SRCS}/include/clang/StaticAnalyzer/Checkers/Checkers.td
TGHDRS+= clang/StaticAnalyzer/Checkers/Checkers.inc
.for dep in ${TGHDRS:C/$/.d/}
. if ${MAKE_VERSION} < 20160220
. if !make(depend)
. sinclude "${dep}"
. endif
. else
. dinclude "${dep}"
. endif
.endfor
DEPENDFILES+= ${TGHDRS:C/$/.d/}
DPSRCS+= ${TGHDRS}
CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/}

View File

@ -1412,16 +1412,7 @@ TGHDRS+= X86GenRegisterBank.inc
TGHDRS+= X86GenRegisterInfo.inc
TGHDRS+= X86GenSubtargetInfo.inc
.for dep in ${TGHDRS:C/$/.d/}
. if ${MAKE_VERSION} < 20160220
. if !make(depend)
. sinclude "${dep}"
. endif
. else
. dinclude "${dep}"
. endif
.endfor
DEPENDFILES+= ${TGHDRS:C/$/.d/}
DPSRCS+= ${TGHDRS}
CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/}

View File

@ -54,6 +54,11 @@ bytes from string
.Fa src
to string
.Fa dst .
If
.Fa src
and
.Fa dst
overlap, the results are not defined.
.Sh RETURN VALUES
The
.Fn memcpy

View File

@ -62,6 +62,11 @@ then add a terminating
The string
.Fa s
must have sufficient space to hold the result.
If
.Fa s
and
.Fa append
overlap, the results are undefined.
.Pp
The
.Fn strncat
@ -72,6 +77,11 @@ characters from
.Fa append ,
and then adds a terminating
.Ql \e0 .
If
.Fa s
and
.Fa append
overlap, the results are undefined.
.Sh RETURN VALUES
The
.Fn strcat

View File

@ -63,6 +63,11 @@ to
(including the terminating
.Ql \e0
character.)
If
.Fa src
and
.Fa dst
overlap, the results are undefined.
.Pp
The
.Fn stpncpy
@ -89,6 +94,11 @@ Otherwise,
is
.Em not
terminated.
If
.Fa src
and
.Fa dst
overlap, the results are undefined.
.Sh RETURN VALUES
The
.Fn strcpy

View File

@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 23, 2017
.Dd November 13, 2017
.Dt _UMTX_OP 2
.Os
.Sh NAME
@ -61,7 +61,7 @@ All objects require ABI-mandated alignment, but this is not currently
enforced consistently on all architectures.
.Pp
The following flags are defined for flag fields of all structures:
.Bl -tag -width "Dv USYNC_PROCESS_SHARED"
.Bl -tag -width indent
.It Dv USYNC_PROCESS_SHARED
Allow selection of the process-shared sleep queue for the thread sleep
container, when the lock ownership cannot be granted immediately,
@ -77,7 +77,6 @@ See the
.Sx SLEEP QUEUES
subsection below for more details on sleep queues.
.El
.Pp
.Bl -hang -offset indent
.It Sy Mutex
.Bd -literal
@ -96,7 +95,7 @@ It contains either the thread identifier of the lock owner in the
locked state, or zero when the lock is unowned.
The highest bit set indicates that there is contention on the lock.
The constants are defined for special values:
.Bl -tag -width "Dv UMUTEX_RB_OWNERDEAD"
.Bl -tag -width indent
.It Dv UMUTEX_UNOWNED
Zero, the value stored in the unowned lock.
.It Dv UMUTEX_CONTESTED
@ -113,7 +112,7 @@ The
.Dv m_flags
field may contain the following umutex-specific flags, in addition to
the common flags:
.Bl -tag -width "Dv UMUTEX_NONCONSISTENT"
.Bl -tag -width indent
.It Dv UMUTEX_PRIO_INHERIT
Mutex implements
.Em Priority Inheritance
@ -136,8 +135,9 @@ In the manual page, mutexes not having
and
.Dv UMUTEX_PRIO_PROTECT
flags set, are called normal mutexes.
Each type of mutex, i.e. normal mutexes, priority-inherited mutexes,
and priority-protected mutexes, have a separate sleep queue associated
Each type of mutex
.Pq normal, priority-inherited, and priority-protected
has a separate sleep queue associated
with the given key.
.Pp
For priority protected mutexes, the
@ -182,8 +182,8 @@ request.
The
.Dv c_flags
field contains flags.
Only the common flags, i.e.
.Dv USYNC_PROCESS_SHARED ,
Only the common flags
.Pq Dv USYNC_PROCESS_SHARED
are defined for ucond.
.Pp
The
@ -193,23 +193,34 @@ member provides the clock identifier to use for timeout, when the
request has both the
.Dv CVWAIT_CLOCKID
flag and the timeout specified.
Valid clock identifiers are subset of the valid clock ids for the
.Xr clock_gettime 2
syscall, namely,
.Dv CLOCK_REALTIME ,
.Dv CLOCK_VIRTUAL ,
.Dv CLOCK_PROF ,
.Dv CLOCK_MONOTONIC ,
.Dv CLOCK_UPTIME ,
.Dv CLOCK_UPTIME_PRECISE ,
.Dv CLOCK_UPTIME_FAST ,
.Dv CLOCK_REALTIME_PRECISE ,
.Dv CLOCK_REALTIME_FAST ,
.Dv CLOCK_MONOTONIC_PRECISE ,
.Dv CLOCK_MONOTONIC_FAST ,
and
Valid clock identifiers are a subset of those for
.Xr clock_gettime 2 :
.Bl -bullet -compact
.It
.Dv CLOCK_MONOTONIC
.It
.Dv CLOCK_MONOTONIC_FAST
.It
.Dv CLOCK_MONOTONIC_PRECISE
.It
.Dv CLOCK_PROF
.It
.Dv CLOCK_REALTIME
.It
.Dv CLOCK_REALTIME_FAST
.It
.Dv CLOCK_REALTIME_PRECISE
.It
.Dv CLOCK_SECOND
are allowed.
.It
.Dv CLOCK_UPTIME
.It
.Dv CLOCK_UPTIME_FAST
.It
.Dv CLOCK_UPTIME_PRECISE
.It
.Dv CLOCK_VIRTUAL
.El
.It Sy Reader/writer lock
.Bd -literal
struct urwlock {
@ -228,7 +239,7 @@ granted.
Names of the
.Dv rw_state
bits are following:
.Bl -tag -width "Dv URWLOCK_WRITE_WAITERS"
.Bl -tag -width indent
.It Dv URWLOCK_WRITE_OWNER
Write lock was granted.
.It Dv URWLOCK_WRITE_WAITERS
@ -253,7 +264,7 @@ The following flags for the
member of
.Vt struct urwlock
are defined, in addition to the common flags:
.Bl -tag -width "Dv URWLOCK_PREFER_READER"
.Bl -tag -width indent
.It Dv URWLOCK_PREFER_READER
If specified, immediately grant read lock requests when
.Dv urwlock
@ -302,7 +313,7 @@ The
.Dv USEM_COUNT()
macro, applied to the
.Dv _count
word, returns the current semaphore counter, i.e. the number of posts
word, returns the current semaphore counter, which is the number of posts
issued on the semaphore.
.Pp
The following bits for the
@ -310,7 +321,7 @@ The following bits for the
member of
.Vt struct _usem2
are defined, in addition to the common flags:
.Bl -tag -width "Dv USEM_NAMED"
.Bl -tag -width indent
.It Dv USEM_NAMED
Flag is ignored by kernel.
.El
@ -359,7 +370,7 @@ Interval counting is always performed by the monotonic wall clock.
The
.Dv _flags
argument allows the following flags to further define the timeout behaviour:
.Bl -tag -width "It Dv UMTX_ABSTIME"
.Bl -tag -width indent
.It Dv UMTX_ABSTIME
The
.Dv _timeout
@ -374,7 +385,6 @@ start.
.El
.El
.Ss SLEEP QUEUES
.Pp
When a locking request cannot be immediately satisfied, the thread is
typically put to
.Em sleep ,
@ -416,7 +426,7 @@ regardless of the kind of backing memory.
.Pp
Only the address of the start byte of the variable specified as key is
important for determining corresponding sleep queue.
The size of the variable does not matter, so e.g. sleep on the same
The size of the variable does not matter, so, for example, sleep on the same
address interpeted as
.Vt uint32_t
and
@ -505,11 +515,11 @@ error for lock attempts, without granting the lock.
The following operations, requested by the
.Fa op
argument to the function, are implemented:
.Bl -tag -width "It Dv UMTX_OP_WAIT_UINT_PRIVATE"
.Bl -tag -width indent
.It Dv UMTX_OP_WAIT
Wait.
The arguments for the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to a variable of type
.Vt long .
@ -558,7 +568,7 @@ Optionally, a timeout for the request may be specified.
Wake the threads possibly sleeping due to
.Dv UMTX_OP_WAIT .
The arguments for the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to a variable, used as a key to find sleeping threads.
.It Fa val
@ -572,7 +582,7 @@ to wake up all waiters.
.It Dv UMTX_OP_MUTEX_TRYLOCK
Try to lock umutex.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the umutex.
.El
@ -585,7 +595,7 @@ instead of sleeping if the lock cannot be obtained immediately.
.It Dv UMTX_OP_MUTEX_LOCK
Lock umutex.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the umutex.
.El
@ -624,7 +634,7 @@ from a signal handler.
.It Dv UMTX_OP_MUTEX_UNLOCK
Unlock umutex.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the umutex.
.El
@ -661,7 +671,7 @@ priority protected protocol mutex.
.It Dv UMTX_OP_SET_CEILING
Set ceiling for the priority protected umutex.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "uaddr"
.It Fa obj
Pointer to the umutex.
.It Fa val
@ -696,7 +706,7 @@ interface.
.It Dv UMTX_OP_CV_WAIT
Wait for a condition.
The arguments to the request are:
.Bl -tag -width "It Fa uaddr2"
.Bl -tag -width "uaddr2"
.It Fa obj
Pointer to the
.Vt struct ucond .
@ -743,7 +753,7 @@ After wakeup, the
umutex is not relocked.
.Pp
The following flags are defined:
.Bl -tag -width "Dv CVWAIT_CLOCKID"
.Bl -tag -width "CVWAIT_CLOCKID"
.It Dv CVWAIT_ABSTIME
Timeout is absolute.
.It Dv CVWAIT_CLOCKID
@ -782,7 +792,7 @@ error.
.It Dv UMTX_OP_CV_SIGNAL
Wake up one condition waiter.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to
.Vt struct ucond .
@ -800,7 +810,7 @@ is cleared.
.It Dv UMTX_OP_CV_BROADCAST
Wake up all condition waiters.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to
.Vt struct ucond .
@ -820,14 +830,14 @@ Same as
but the type of the variable pointed to by
.Fa obj
is
.Vt u_int ,
i.e. 32-bit integer.
.Vt u_int
.Pq a 32-bit integer .
.It Dv UMTX_OP_RW_RDLOCK
Read-lock a
.Vt struct rwlock
lock.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the lock (of type
.Vt struct rwlock )
@ -837,7 +847,7 @@ Additional flags to augment locking behaviour.
The valid flags in the
.Fa val
argument are:
.Bl -tag -width "It Dv URWLOCK_PREFER_READER"
.Bl -tag -width indent
.It Dv URWLOCK_PREFER_READER
.El
.El
@ -889,7 +899,7 @@ Write-lock a
.Vt struct rwlock
lock.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the lock (of type
.Vt struct rwlock )
@ -925,7 +935,7 @@ error.
.It Dv UMTX_OP_RW_UNLOCK
Unlock rwlock.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the lock (of type
.Vt struct rwlock )
@ -967,7 +977,7 @@ but unconditionally select the process-private sleep queue.
.It Dv UMTX_OP_MUTEX_WAIT
Wait for mutex availability.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Address of the mutex.
.El
@ -991,7 +1001,6 @@ priority inherited protocol mutexes.
.Pp
Optionally, a timeout for the request may be specified.
.Pp
.Pp
A request with a timeout specified is not restartable.
An unblocked signal delivered during the wait always results in sleep
interruption and
@ -1007,7 +1016,7 @@ member
.It Dv UMTX_OP_NWAKE_PRIVATE
Wake up a batch of sleeping threads.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the array of pointers.
.It Fa val
@ -1024,7 +1033,7 @@ being the byte addressed by the array element.
.It Dv UMTX_OP_MUTEX_WAKE
Check if a normal umutex is unlocked and wake up a waiter.
The arguments for the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the umutex.
.El
@ -1058,7 +1067,7 @@ bit may then modify freed memory.
.It Dv UMTX_OP_MUTEX_WAKE2
Check if a umutex is unlocked and wake up a waiter.
The arguments for the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the umutex.
.It Fa val
@ -1088,11 +1097,12 @@ word of the
.It Dv UMTX_OP_SEM2_WAIT
Wait until semaphore is available.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the semaphore (of type
.Vt struct _usem2 ) .
.El
.Pp
Put the requesting thread onto a sleep queue if the semaphore counter
is zero.
If the thread is put to sleep, the
@ -1117,7 +1127,7 @@ error.
.It Dv UMTX_OP_SEM2_WAKE
Wake up waiters on semaphore lock.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "obj"
.It Fa obj
Pointer to the semaphore (of type
.Vt struct _usem2 ) .
@ -1145,7 +1155,7 @@ The
argument specifies the sub-request of the
.Dv UMTX_OP_SHM
request:
.Bl -tag -width "Dv UMTX_SHM_DESTROY"
.Bl -tag -width indent
.It Dv UMTX_SHM_CREAT
Creates the anonymous shared memory object, which can be looked up
with the specified key
@ -1191,7 +1201,7 @@ creation or lookup.
.It Dv UMTX_OP_ROBUST_LISTS
Register the list heads for the current thread's robust mutex lists.
The arguments to the request are:
.Bl -tag -width "It Fa obj"
.Bl -tag -width "uaddr"
.It Fa val
Size of the structure passed in the
.Fa uaddr
@ -1261,8 +1271,8 @@ variable is set to indicate the error.
.Sh ERRORS
The
.Fn _umtx_op
operations will return the following errors:
.Bl -tag -width "Bq Er ENOTRECOVERABLE"
operations can fail with the following errors:
.Bl -tag -width "[ETIMEDOUT]"
.It Bq Er EFAULT
One of the arguments point to invalid memory.
.It Bq Er EINVAL

View File

@ -56,11 +56,13 @@ typedef struct nvlist nvlist_t;
struct cap_channel;
typedef struct cap_channel cap_channel_t;
#define CASPER_SUPPORT (1)
#else
struct cap_channel {
int cch_fd;
};
typedef struct cap_channel cap_channel_t;
#define CASPER_SUPPORT (0)
#endif /* ! WITH_CASPER */
#endif /* ! _CAP_CHANNEL_T_DECLARED */

View File

@ -7,6 +7,7 @@ SUBDIR+= cap_grp
SUBDIR+= cap_pwd
SUBDIR+= cap_random
SUBDIR+= cap_sysctl
SUBDIR+= cap_syslog
SUBDIR.${MK_TESTS}+= tests

View File

@ -0,0 +1,24 @@
# $FreeBSD$
SHLIBDIR?= /lib/casper
.include <src.opts.mk>
PACKAGE=libcasper
SHLIB_MAJOR= 0
INCSDIR?= ${INCLUDEDIR}/casper
.if ${MK_CASPER} != "no"
SHLIB= cap_syslog
SRCS= cap_syslog.c
.endif
INCS= cap_syslog.h
LIBADD= nv
CFLAGS+=-I${.CURDIR}
.include <bsd.lib.mk>

View File

@ -0,0 +1,199 @@
/*-
* Copyright (c) 2017 Mariusz Zaborski <oshogbo@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/dnv.h>
#include <sys/nv.h>
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <libcasper.h>
#include <libcasper_service.h>
#include "cap_syslog.h"
#define CAP_SYSLOG_LIMIT 2048
void
cap_syslog(cap_channel_t *chan, int pri, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
cap_vsyslog(chan, pri, fmt, ap);
va_end(ap);
}
void
cap_vsyslog(cap_channel_t *chan, int priority, const char *fmt, va_list ap)
{
nvlist_t *nvl;
char message[CAP_SYSLOG_LIMIT];
(void)vsnprintf(message, sizeof(message), fmt, ap);
nvl = nvlist_create(0);
nvlist_add_string(nvl, "cmd", "vsyslog");
nvlist_add_number(nvl, "priority", priority);
nvlist_add_string(nvl, "message", message);
nvl = cap_xfer_nvlist(chan, nvl, 0);
if (nvl == NULL) {
return;
}
nvlist_destroy(nvl);
}
void
cap_openlog(cap_channel_t *chan, const char *ident, int logopt, int facility)
{
nvlist_t *nvl;
nvl = nvlist_create(0);
nvlist_add_string(nvl, "cmd", "openlog");
if (ident != NULL) {
nvlist_add_string(nvl, "ident", ident);
}
nvlist_add_number(nvl, "logopt", logopt);
nvlist_add_number(nvl, "facility", facility);
nvl = cap_xfer_nvlist(chan, nvl, 0);
if (nvl == NULL) {
return;
}
nvlist_destroy(nvl);
}
void
cap_closelog(cap_channel_t *chan)
{
nvlist_t *nvl;
nvl = nvlist_create(0);
nvlist_add_string(nvl, "cmd", "closelog");
nvl = cap_xfer_nvlist(chan, nvl, 0);
if (nvl == NULL) {
return;
}
nvlist_destroy(nvl);
}
int
cap_setlogmask(cap_channel_t *chan, int maskpri)
{
nvlist_t *nvl;
int omask;
nvl = nvlist_create(0);
nvlist_add_string(nvl, "cmd", "setlogmask");
nvlist_add_number(nvl, "maskpri", maskpri);
nvl = cap_xfer_nvlist(chan, nvl, 0);
omask = nvlist_get_number(nvl, "omask");
nvlist_destroy(nvl);
return (omask);
}
/*
* Service functions.
*/
static char *LogTag;
static void
slog_vsyslog(const nvlist_t *limits __unused, const nvlist_t *nvlin,
nvlist_t *nvlout __unused)
{
syslog(nvlist_get_number(nvlin, "priority"), "%s",
nvlist_get_string(nvlin, "message"));
}
static void
slog_openlog(const nvlist_t *limits __unused, const nvlist_t *nvlin,
nvlist_t *nvlout __unused)
{
const char *ident;
ident = dnvlist_get_string(nvlin, "ident", NULL);
if (ident != NULL) {
free(LogTag);
LogTag = strdup(ident);
}
openlog(LogTag, nvlist_get_number(nvlin, "logopt"),
nvlist_get_number(nvlin, "facility"));
}
static void
slog_closelog(const nvlist_t *limits __unused, const nvlist_t *nvlin __unused,
nvlist_t *nvlout __unused)
{
closelog();
free(LogTag);
LogTag = NULL;
}
static void
slog_setlogmask(const nvlist_t *limits __unused, const nvlist_t *nvlin,
nvlist_t *nvlout)
{
int omask;
omask = setlogmask(nvlist_get_number(nvlin, "maskpri"));
nvlist_add_number(nvlout, "omask", omask);
}
static int
syslog_command(const char *cmd, const nvlist_t *limits, nvlist_t *nvlin,
nvlist_t *nvlout)
{
if (strcmp(cmd, "vsyslog") == 0) {
slog_vsyslog(limits, nvlin, nvlout);
} else if (strcmp(cmd, "openlog") == 0) {
slog_openlog(limits, nvlin, nvlout);
} else if (strcmp(cmd, "closelog") == 0) {
slog_closelog(limits, nvlin, nvlout);
} else if (strcmp(cmd, "setlogmask") == 0) {
slog_setlogmask(limits, nvlin, nvlout);
} else {
return (EINVAL);
}
return (0);
}
CREATE_SERVICE("system.syslog", NULL, syslog_command, 0);

View File

@ -0,0 +1,54 @@
/*-
* Copyright (c) 2017 Mariusz Zaborski <oshogbo@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _CAP_SYSLOG_H_
#define _CAP_SYSLOG_H_
#ifdef WITH_CASPER
void cap_syslog(cap_channel_t *chan, int pri,
const char *fmt, ...) __printflike(3, 4);
void cap_vsyslog(cap_channel_t *chan, int priority, const char *fmt,
va_list ap) __printflike(3, 0);
void cap_openlog(cap_channel_t *chan, const char *ident, int logopt,
int facility);
void cap_closelog(cap_channel_t *chan);
int cap_setlogmask(cap_channel_t *chan, int maskpri);
#else
#define cap_syslog(chan, pri, ...) syslog(pri, __VA_ARGS__)
#define cap_vsyslog(chan, pri, fmt, ap) vsyslog(pri, fmt, ap)
#define cap_openlog(chan, ident, logopt, facility) \
openlog(ident, logopt, facility)
#define cap_closelog(chan) closelog()
#define cap_setlogmask(chan, maskpri) setlogmask(maskpri)
#endif /* !WITH_CASPER */
#endif /* !_CAP_SYSLOG_H_ */

View File

@ -26,7 +26,7 @@
.include <src.opts.mk>
EFIBOOT=${SRCTOP}/sys/boot/efi
EFIBOOT=${SRCTOP}/stand/efi
EDK2INC=${SRCTOP}/sys/contrib/edk2/Include
.PATH: ${EFIBOOT}/libefi

View File

@ -150,7 +150,7 @@ efi_append_variable(efi_guid_t guid, const char *name,
{
return efi_set_variable(guid, name, data, data_size,
attributes | EFI_VARIABLE_APPEND_WRITE, 0);
attributes | EFI_VARIABLE_APPEND_WRITE);
}
int
@ -158,7 +158,7 @@ efi_del_variable(efi_guid_t guid, const char *name)
{
/* data_size of 0 deletes the variable */
return efi_set_variable(guid, name, NULL, 0, 0, 0);
return efi_set_variable(guid, name, NULL, 0, 0);
}
int
@ -358,7 +358,7 @@ efi_name_to_guid(const char *name, efi_guid_t *guid)
int
efi_set_variable(efi_guid_t guid, const char *name,
uint8_t *data, size_t data_size, uint32_t attributes, mode_t mode __unused)
uint8_t *data, size_t data_size, uint32_t attributes)
{
struct efi_var_ioc var;
int rv;

View File

@ -83,7 +83,7 @@ int efi_guid_to_symbol(efi_guid_t *guid, char **symbol);
int efi_guid_to_str(const efi_guid_t *guid, char **sp);
int efi_name_to_guid(const char *name, efi_guid_t *guid);
int efi_set_variable(efi_guid_t guid, const char *name,
uint8_t *data, size_t data_size, uint32_t attributes, mode_t mode);
uint8_t *data, size_t data_size, uint32_t attributes);
int efi_str_to_guid(const char *s, efi_guid_t *guid);
int efi_variables_supported(void);
@ -99,37 +99,4 @@ int efi_known_guid(struct uuid_table **);
extern const efi_guid_t efi_guid_empty;
/* Stubs that are expected, but aren't really used */
static inline int
efi_error_get(unsigned int n __unused, char ** const fn __unused,
char ** const func __unused, int *line __unused,
char ** const msg __unused, int *err __unused)
{
return 0;
}
static inline int
efi_error_set(const char *fn __unused, const char *func __unused,
int line __unused, int err __unused, const char *fmt __unused, ...)
{
return 0;
}
static inline void
efi_error_clear(void)
{
}
static inline int
efi_error(const char *fmt __unused, ...)
{
return 0;
}
static inline int
efi_error_val(int val __unused, const char *fmt __unused, ...)
{
return 0;
}
#endif /* _EFIVAR_H_ */

View File

@ -49,6 +49,7 @@ static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94";
#include <sys/linker.h>
#include <sys/pcpu.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <net/vnet.h>
@ -299,6 +300,10 @@ kvm_close(kvm_t *kd)
free((void *)kd->argv);
if (kd->pt_map != NULL)
free(kd->pt_map);
if (kd->page_map != NULL)
free(kd->page_map);
if (kd->sparse_map != MAP_FAILED)
munmap(kd->sparse_map, kd->pt_sparse_size);
free((void *)kd);
return (error);
@ -487,3 +492,13 @@ kvm_native(kvm_t *kd)
return (1);
return (kd->arch->ka_native(kd));
}
int
kvm_walk_pages(kvm_t *kd, kvm_walk_pages_cb_t *cb, void *closure)
{
if (kd->arch->ka_walk_pages == NULL)
return (0);
return (kd->arch->ka_walk_pages(kd, cb, closure));
}

View File

@ -37,6 +37,14 @@
#include <sys/types.h>
#include <nlist.h>
/*
* Including vm/vm.h causes namespace pollution issues. For the
* most part, only things using kvm_walk_pages() need to #include it.
*/
#ifndef VM_H
typedef u_char vm_prot_t;
#endif
/* Default version symbol. */
#define VRS_SYM "_version"
#define VRS_KEY "VERSION"
@ -73,7 +81,19 @@ struct kvm_swap {
u_int ksw_reserved2;
};
struct kvm_page {
unsigned int version;
u_long paddr;
u_long kmap_vaddr;
u_long dmap_vaddr;
vm_prot_t prot;
u_long offset;
size_t len;
/* end of version 1 */
};
#define SWIF_DEV_PREFIX 0x0002
#define LIBKVM_WALK_PAGES_VERSION 1
__BEGIN_DECLS
int kvm_close(kvm_t *);
@ -104,6 +124,9 @@ ssize_t kvm_read(kvm_t *, unsigned long, void *, size_t);
ssize_t kvm_read_zpcpu(kvm_t *, unsigned long, void *, size_t, int);
ssize_t kvm_read2(kvm_t *, kvaddr_t, void *, size_t);
ssize_t kvm_write(kvm_t *, unsigned long, const void *, size_t);
typedef int kvm_walk_pages_cb_t(struct kvm_page *, void *);
int kvm_walk_pages(kvm_t *, kvm_walk_pages_cb_t *, void *);
__END_DECLS
#endif /* !_KVM_H_ */

View File

@ -40,7 +40,13 @@ typedef uint64_t aarch64_pte_t;
#define AARCH64_PAGE_SIZE (1 << AARCH64_PAGE_SHIFT)
#define AARCH64_PAGE_MASK (AARCH64_PAGE_SIZE - 1)
/* Source: arm64/include/pte.h */
#define AARCH64_ATTR_MASK 0xfff0000000000fff
#define AARCH64_ATTR_UXN (1ULL << 54)
#define AARCH64_ATTR_PXN (1ULL << 53)
#define AARCH64_ATTR_XN (AARCH64_ATTR_PXN | AARCH64_ATTR_UXN)
#define AARCH64_ATTR_AP(x) ((x) << 6)
#define AARCH64_ATTR_AP_RO (1 << 1)
#define AARCH64_ATTR_DESCR_MASK 3

View File

@ -51,6 +51,7 @@ static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93";
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vm/vm.h>
#include <kvm.h>
#include <limits.h>

View File

@ -55,7 +55,9 @@ typedef uint64_t amd64_pml4e_t;
#define AMD64_NPML4EPG (AMD64_PAGE_SIZE / sizeof(amd64_pml4e_t))
#define AMD64_PML4SHIFT 39
#define AMD64_PG_NX (1ULL << 63)
#define AMD64_PG_V 0x001
#define AMD64_PG_RW 0x002
#define AMD64_PG_PS 0x080
#define AMD64_PG_FRAME (0x000ffffffffff000)
#define AMD64_PG_PS_FRAME (0x000fffffffe00000)

View File

@ -53,6 +53,19 @@ typedef uint32_t arm_pt_entry_t;
#define ARM_L2_S_OFFSET (ARM_L2_S_SIZE - 1)
#define ARM_L2_S_FRAME (~ARM_L2_S_OFFSET)
#define ARM_L2_S_SHIFT 12
#define ARM_L2_TEX1 0x00000080
#define ARM_PTE2_RO ARM_L2_TEX1
#define ARM_L2_NX 0x00000001
#define ARM_PTE2_NX ARM_L2_NX
/*
* Note: L2_S_PROT_W differs depending on whether the system is generic or
* xscale. This isn't easily accessible in this context, so use an
* approximation of 'xscale' which is a subset of 'generic'.
*/
#define ARM_L2_AP0(x) ((x) << 4)
#define ARM_AP_W 0x01
#define ARM_L2_S_PROT_W (ARM_L2_AP0(ARM_AP_W))
#define ARM_L1_TYPE_INV 0x00 /* Invalid (fault) */
#define ARM_L1_TYPE_C 0x01 /* Coarse L2 */

View File

@ -51,6 +51,7 @@ static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93";
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vm/vm.h>
#include <kvm.h>
#ifdef __i386__

View File

@ -53,8 +53,11 @@ typedef uint64_t i386_pde_pae_t;
#define I386_NBPDR_PAE (1 << I386_PDRSHIFT_PAE)
#define I386_PAGE_PS_MASK_PAE (I386_NBPDR_PAE - 1)
/* Source: i386/include/pmap.h */
#define I386_PG_V 0x001
#define I386_PG_RW 0x002
#define I386_PG_PS 0x080
#define I386_PG_NX (1ULL << 63)
#define I386_PG_FRAME_PAE (0x000ffffffffff000ull)
#define I386_PG_PS_FRAME_PAE (0x000fffffffe00000ull)
#define I386_PG_FRAME (0xfffff000)

View File

@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vm/vm.h>
#include <kvm.h>
#include "../../sys/arm64/include/minidump.h"
@ -50,9 +51,16 @@ __FBSDID("$FreeBSD$");
struct vmstate {
struct minidumphdr hdr;
uint64_t *page_map;
};
static aarch64_pte_t
_aarch64_pte_get(kvm_t *kd, u_long pteindex)
{
aarch64_pte_t *pte = _kvm_pmap_get(kd, pteindex, sizeof(*pte));
return le64toh(*pte);
}
static int
_aarch64_minidump_probe(kvm_t *kd)
{
@ -66,7 +74,6 @@ _aarch64_minidump_freevtop(kvm_t *kd)
{
struct vmstate *vm = kd->vmst;
free(vm->page_map);
free(vm);
kd->vmst = NULL;
}
@ -116,28 +123,11 @@ _aarch64_minidump_initvtop(kvm_t *kd)
aarch64_round_page(vmst->hdr.pmapsize);
if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off,
AARCH64_PAGE_SIZE, sizeof(uint64_t)) == -1) {
_kvm_err(kd, kd->program, "cannot load core bitmap");
return (-1);
}
off += aarch64_round_page(vmst->hdr.bitmapsize);
vmst->page_map = _kvm_malloc(kd, vmst->hdr.pmapsize);
if (vmst->page_map == NULL) {
_kvm_err(kd, kd->program,
"cannot allocate %d bytes for page_map",
vmst->hdr.pmapsize);
return (-1);
}
/* This is the end of the dump, savecore may have truncated it. */
/*
* XXX: This doesn't make sense. The pmap is not at the end,
* and if it is truncated we don't have any actual data (it's
* all stored after the bitmap and pmap. -- jhb
*/
if (pread(kd->pmfd, vmst->page_map, vmst->hdr.pmapsize, off) <
AARCH64_PAGE_SIZE) {
_kvm_err(kd, kd->program, "cannot read %d bytes for page_map",
vmst->hdr.pmapsize);
if (_kvm_pmap_init(kd, vmst->hdr.pmapsize, off) == -1) {
return (-1);
}
off += aarch64_round_page(vmst->hdr.pmapsize);
@ -161,7 +151,7 @@ _aarch64_minidump_vatop(kvm_t *kd, kvaddr_t va, off_t *pa)
if (va >= vm->hdr.dmapbase && va < vm->hdr.dmapend) {
a = (va - vm->hdr.dmapbase + vm->hdr.dmapphys) &
~AARCH64_PAGE_MASK;
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, AARCH64_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program, "_aarch64_minidump_vatop: "
"direct map address 0x%jx not in minidump",
@ -172,16 +162,16 @@ _aarch64_minidump_vatop(kvm_t *kd, kvaddr_t va, off_t *pa)
return (AARCH64_PAGE_SIZE - offset);
} else if (va >= vm->hdr.kernbase) {
l3_index = (va - vm->hdr.kernbase) >> AARCH64_L3_SHIFT;
if (l3_index >= vm->hdr.pmapsize / sizeof(*vm->page_map))
if (l3_index >= vm->hdr.pmapsize / sizeof(l3))
goto invalid;
l3 = le64toh(vm->page_map[l3_index]);
l3 = _aarch64_pte_get(kd, l3_index);
if ((l3 & AARCH64_ATTR_DESCR_MASK) != AARCH64_L3_PAGE) {
_kvm_err(kd, kd->program,
"_aarch64_minidump_vatop: pde not valid");
goto invalid;
}
a = l3 & ~AARCH64_ATTR_MASK;
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, AARCH64_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program, "_aarch64_minidump_vatop: "
"physical address 0x%jx not in minidump",
@ -225,12 +215,73 @@ _aarch64_native(kvm_t *kd __unused)
#endif
}
static vm_prot_t
_aarch64_entry_to_prot(aarch64_pte_t pte)
{
vm_prot_t prot = VM_PROT_READ;
/* Source: arm64/arm64/pmap.c:pmap_protect() */
if ((pte & AARCH64_ATTR_AP(AARCH64_ATTR_AP_RO)) == 0)
prot |= VM_PROT_WRITE;
if ((pte & AARCH64_ATTR_XN) == 0)
prot |= VM_PROT_EXECUTE;
return prot;
}
static int
_aarch64_minidump_walk_pages(kvm_t *kd, kvm_walk_pages_cb_t *cb, void *arg)
{
struct vmstate *vm = kd->vmst;
u_long nptes = vm->hdr.pmapsize / sizeof(aarch64_pte_t);
u_long bmindex, dva, pa, pteindex, va;
struct kvm_bitmap bm;
vm_prot_t prot;
int ret = 0;
if (!_kvm_bitmap_init(&bm, vm->hdr.bitmapsize, &bmindex))
return (0);
for (pteindex = 0; pteindex < nptes; pteindex++) {
aarch64_pte_t pte = _aarch64_pte_get(kd, pteindex);
if ((pte & AARCH64_ATTR_DESCR_MASK) != AARCH64_L3_PAGE)
continue;
va = vm->hdr.kernbase + (pteindex << AARCH64_L3_SHIFT);
pa = pte & ~AARCH64_ATTR_MASK;
dva = vm->hdr.dmapbase + pa;
if (!_kvm_visit_cb(kd, cb, arg, pa, va, dva,
_aarch64_entry_to_prot(pte), AARCH64_PAGE_SIZE, 0)) {
goto out;
}
}
while (_kvm_bitmap_next(&bm, &bmindex)) {
pa = bmindex * AARCH64_PAGE_SIZE;
dva = vm->hdr.dmapbase + pa;
if (vm->hdr.dmapend < (dva + AARCH64_PAGE_SIZE))
break;
va = 0;
prot = VM_PROT_READ | VM_PROT_WRITE;
if (!_kvm_visit_cb(kd, cb, arg, pa, va, dva,
prot, AARCH64_PAGE_SIZE, 0)) {
goto out;
}
}
ret = 1;
out:
_kvm_bitmap_deinit(&bm);
return (ret);
}
static struct kvm_arch kvm_aarch64_minidump = {
.ka_probe = _aarch64_minidump_probe,
.ka_initvtop = _aarch64_minidump_initvtop,
.ka_freevtop = _aarch64_minidump_freevtop,
.ka_kvatop = _aarch64_minidump_kvatop,
.ka_native = _aarch64_native,
.ka_walk_pages = _aarch64_minidump_walk_pages,
};
KVM_ARCH(kvm_aarch64_minidump);

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vm/vm.h>
#include <kvm.h>
#include "../../sys/amd64/include/minidump.h"
@ -46,12 +47,59 @@ __FBSDID("$FreeBSD$");
#include "kvm_amd64.h"
#define amd64_round_page(x) roundup2((kvaddr_t)(x), AMD64_PAGE_SIZE)
#define VM_IS_V1(vm) (vm->hdr.version == 1)
#define VA_OFF(vm, va) \
(VM_IS_V1(vm) ? ((va) & (AMD64_PAGE_SIZE - 1)) : ((va) & AMD64_PAGE_MASK))
struct vmstate {
struct minidumphdr hdr;
amd64_pte_t *page_map;
};
static vm_prot_t
_amd64_entry_to_prot(uint64_t entry)
{
vm_prot_t prot = VM_PROT_READ;
if ((entry & AMD64_PG_RW) != 0)
prot |= VM_PROT_WRITE;
if ((entry & AMD64_PG_NX) == 0)
prot |= VM_PROT_EXECUTE;
return prot;
}
/*
* Version 2 minidumps use page directory entries, while version 1 use page
* table entries.
*/
static amd64_pde_t
_amd64_pde_get(kvm_t *kd, u_long pdeindex)
{
amd64_pde_t *pde = _kvm_pmap_get(kd, pdeindex, sizeof(*pde));
return le64toh(*pde);
}
static amd64_pte_t
_amd64_pte_get(kvm_t *kd, u_long pteindex)
{
amd64_pte_t *pte = _kvm_pmap_get(kd, pteindex, sizeof(*pte));
return le64toh(*pte);
}
/* Get the first page table entry for a given page directory index. */
static amd64_pte_t *
_amd64_pde_first_pte(kvm_t *kd, u_long pdeindex)
{
u_long *pa;
pa = _kvm_pmap_get(kd, pdeindex, sizeof(amd64_pde_t));
if (pa == NULL)
return NULL;
return _kvm_map_get(kd, *pa & AMD64_PG_FRAME, AMD64_PAGE_SIZE);
}
static int
_amd64_minidump_probe(kvm_t *kd)
{
@ -65,7 +113,6 @@ _amd64_minidump_freevtop(kvm_t *kd)
{
struct vmstate *vm = kd->vmst;
free(vm->page_map);
free(vm);
kd->vmst = NULL;
}
@ -116,21 +163,11 @@ _amd64_minidump_initvtop(kvm_t *kd)
amd64_round_page(vmst->hdr.pmapsize);
if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off,
AMD64_PAGE_SIZE, sizeof(uint64_t)) == -1) {
_kvm_err(kd, kd->program, "cannot load core bitmap");
return (-1);
}
off += amd64_round_page(vmst->hdr.bitmapsize);
vmst->page_map = _kvm_malloc(kd, vmst->hdr.pmapsize);
if (vmst->page_map == NULL) {
_kvm_err(kd, kd->program, "cannot allocate %d bytes for page_map",
vmst->hdr.pmapsize);
return (-1);
}
if (pread(kd->pmfd, vmst->page_map, vmst->hdr.pmapsize, off) !=
(ssize_t)vmst->hdr.pmapsize) {
_kvm_err(kd, kd->program, "cannot read %d bytes for page_map",
vmst->hdr.pmapsize);
if (_kvm_pmap_init(kd, vmst->hdr.pmapsize, off) == -1) {
return (-1);
}
off += amd64_round_page(vmst->hdr.pmapsize);
@ -153,16 +190,16 @@ _amd64_minidump_vatop_v1(kvm_t *kd, kvaddr_t va, off_t *pa)
if (va >= vm->hdr.kernbase) {
pteindex = (va - vm->hdr.kernbase) >> AMD64_PAGE_SHIFT;
if (pteindex >= vm->hdr.pmapsize / sizeof(*vm->page_map))
if (pteindex >= vm->hdr.pmapsize / sizeof(pte))
goto invalid;
pte = le64toh(vm->page_map[pteindex]);
pte = _amd64_pte_get(kd, pteindex);
if ((pte & AMD64_PG_V) == 0) {
_kvm_err(kd, kd->program,
"_amd64_minidump_vatop_v1: pte not valid");
goto invalid;
}
a = pte & AMD64_PG_FRAME;
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, AMD64_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program,
"_amd64_minidump_vatop_v1: physical address 0x%jx not in minidump",
@ -173,7 +210,7 @@ _amd64_minidump_vatop_v1(kvm_t *kd, kvaddr_t va, off_t *pa)
return (AMD64_PAGE_SIZE - offset);
} else if (va >= vm->hdr.dmapbase && va < vm->hdr.dmapend) {
a = (va - vm->hdr.dmapbase) & ~AMD64_PAGE_MASK;
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, AMD64_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program,
"_amd64_minidump_vatop_v1: direct map address 0x%jx not in minidump",
@ -212,9 +249,9 @@ _amd64_minidump_vatop(kvm_t *kd, kvaddr_t va, off_t *pa)
if (va >= vm->hdr.kernbase) {
pdeindex = (va - vm->hdr.kernbase) >> AMD64_PDRSHIFT;
if (pdeindex >= vm->hdr.pmapsize / sizeof(*vm->page_map))
if (pdeindex >= vm->hdr.pmapsize / sizeof(pde))
goto invalid;
pde = le64toh(vm->page_map[pdeindex]);
pde = _amd64_pde_get(kd, pdeindex);
if ((pde & AMD64_PG_V) == 0) {
_kvm_err(kd, kd->program,
"_amd64_minidump_vatop: pde not valid");
@ -223,7 +260,7 @@ _amd64_minidump_vatop(kvm_t *kd, kvaddr_t va, off_t *pa)
if ((pde & AMD64_PG_PS) == 0) {
a = pde & AMD64_PG_FRAME;
/* TODO: Just read the single PTE */
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, AMD64_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program,
"cannot find page table entry for %ju",
@ -250,7 +287,7 @@ _amd64_minidump_vatop(kvm_t *kd, kvaddr_t va, off_t *pa)
a = pde & AMD64_PG_PS_FRAME;
a += (va & AMD64_PDRMASK) ^ offset;
}
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, AMD64_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program,
"_amd64_minidump_vatop: physical address 0x%jx not in minidump",
@ -261,7 +298,7 @@ _amd64_minidump_vatop(kvm_t *kd, kvaddr_t va, off_t *pa)
return (AMD64_PAGE_SIZE - offset);
} else if (va >= vm->hdr.dmapbase && va < vm->hdr.dmapend) {
a = (va - vm->hdr.dmapbase) & ~AMD64_PAGE_MASK;
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, AMD64_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program,
"_amd64_minidump_vatop: direct map address 0x%jx not in minidump",
@ -297,12 +334,99 @@ _amd64_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
return (_amd64_minidump_vatop(kd, va, pa));
}
static int
_amd64_minidump_walk_pages(kvm_t *kd, kvm_walk_pages_cb_t *cb, void *arg)
{
struct vmstate *vm = kd->vmst;
u_long npdes = vm->hdr.pmapsize / sizeof(amd64_pde_t);
u_long bmindex, dva, pa, pdeindex, va;
struct kvm_bitmap bm;
int ret = 0;
vm_prot_t prot;
unsigned int pgsz = AMD64_PAGE_SIZE;
if (vm->hdr.version < 2)
return (0);
if (!_kvm_bitmap_init(&bm, vm->hdr.bitmapsize, &bmindex))
return (0);
for (pdeindex = 0; pdeindex < npdes; pdeindex++) {
amd64_pde_t pde = _amd64_pde_get(kd, pdeindex);
amd64_pte_t *ptes;
u_long i;
va = vm->hdr.kernbase + (pdeindex << AMD64_PDRSHIFT);
if ((pde & AMD64_PG_V) == 0)
continue;
if ((pde & AMD64_PG_PS) != 0) {
/*
* Large page. Iterate on each 4K page section
* within this page. This differs from 4K pages in
* that every page here uses the same PDE to
* generate permissions.
*/
pa = (pde & AMD64_PG_PS_FRAME) +
((va & AMD64_PDRMASK) ^ VA_OFF(vm, va));
dva = vm->hdr.dmapbase + pa;
_kvm_bitmap_set(&bm, pa, AMD64_PAGE_SIZE);
if (!_kvm_visit_cb(kd, cb, arg, pa, va, dva,
_amd64_entry_to_prot(pde), AMD64_NBPDR, pgsz)) {
goto out;
}
continue;
}
/* 4K pages: pde references another page of entries. */
ptes = _amd64_pde_first_pte(kd, pdeindex);
/* Ignore page directory pages that were not dumped. */
if (ptes == NULL)
continue;
for (i = 0; i < AMD64_NPTEPG; i++) {
amd64_pte_t pte = (u_long)ptes[i];
pa = pte & AMD64_PG_FRAME;
dva = vm->hdr.dmapbase + pa;
if ((pte & AMD64_PG_V) != 0) {
_kvm_bitmap_set(&bm, pa, AMD64_PAGE_SIZE);
if (!_kvm_visit_cb(kd, cb, arg, pa, va, dva,
_amd64_entry_to_prot(pte), pgsz, 0)) {
goto out;
}
}
va += AMD64_PAGE_SIZE;
}
}
while (_kvm_bitmap_next(&bm, &bmindex)) {
pa = bmindex * AMD64_PAGE_SIZE;
dva = vm->hdr.dmapbase + pa;
if (vm->hdr.dmapend < (dva + pgsz))
break;
va = 0;
/* amd64/pmap.c: create_pagetables(): dmap always R|W. */
prot = VM_PROT_READ | VM_PROT_WRITE;
if (!_kvm_visit_cb(kd, cb, arg, pa, va, dva, prot, pgsz, 0)) {
goto out;
}
}
ret = 1;
out:
_kvm_bitmap_deinit(&bm);
return (ret);
}
static struct kvm_arch kvm_amd64_minidump = {
.ka_probe = _amd64_minidump_probe,
.ka_initvtop = _amd64_minidump_initvtop,
.ka_freevtop = _amd64_minidump_freevtop,
.ka_kvatop = _amd64_minidump_kvatop,
.ka_native = _amd64_native,
.ka_walk_pages = _amd64_minidump_walk_pages,
};
KVM_ARCH(kvm_amd64_minidump);

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/endian.h>
#include <sys/param.h>
#include <vm/vm.h>
#include <kvm.h>
#include <limits.h>
#include <stdint.h>
@ -51,10 +52,17 @@ __FBSDID("$FreeBSD$");
struct vmstate {
struct minidumphdr hdr;
void *ptemap;
unsigned char ei_data;
};
static arm_pt_entry_t
_arm_pte_get(kvm_t *kd, u_long pteindex)
{
arm_pt_entry_t *pte = _kvm_pmap_get(kd, pteindex, sizeof(*pte));
return _kvm32toh(kd, *pte);
}
static int
_arm_minidump_probe(kvm_t *kd)
{
@ -68,7 +76,6 @@ _arm_minidump_freevtop(kvm_t *kd)
{
struct vmstate *vm = kd->vmst;
free(vm->ptemap);
free(vm);
kd->vmst = NULL;
}
@ -122,22 +129,11 @@ _arm_minidump_initvtop(kvm_t *kd)
arm_round_page(vmst->hdr.ptesize);
if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off,
ARM_PAGE_SIZE, sizeof(uint32_t)) == -1) {
_kvm_err(kd, kd->program, "cannot load core bitmap");
return (-1);
}
off += arm_round_page(vmst->hdr.bitmapsize);
vmst->ptemap = _kvm_malloc(kd, vmst->hdr.ptesize);
if (vmst->ptemap == NULL) {
_kvm_err(kd, kd->program, "cannot allocate %d bytes for "
"ptemap", vmst->hdr.ptesize);
return (-1);
}
if (pread(kd->pmfd, vmst->ptemap, vmst->hdr.ptesize, off) !=
(ssize_t)vmst->hdr.ptesize) {
_kvm_err(kd, kd->program, "cannot read %d bytes for ptemap",
vmst->hdr.ptesize);
if (_kvm_pmap_init(kd, vmst->hdr.ptesize, off) == -1) {
return (-1);
}
off += arm_round_page(vmst->hdr.ptesize);
@ -153,7 +149,6 @@ _arm_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
arm_physaddr_t offset, a;
kvaddr_t pteindex;
off_t ofs;
arm_pt_entry_t *ptemap;
if (ISALIVE(kd)) {
_kvm_err(kd, 0, "_arm_minidump_kvatop called in live kernel!");
@ -161,13 +156,12 @@ _arm_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
}
vm = kd->vmst;
ptemap = vm->ptemap;
if (va >= vm->hdr.kernbase) {
pteindex = (va - vm->hdr.kernbase) >> ARM_PAGE_SHIFT;
if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap))
if (pteindex >= vm->hdr.ptesize / sizeof(pte))
goto invalid;
pte = _kvm32toh(kd, ptemap[pteindex]);
pte = _arm_pte_get(kd, pteindex);
if ((pte & ARM_L2_TYPE_MASK) == ARM_L2_TYPE_INV) {
_kvm_err(kd, kd->program,
"_arm_minidump_kvatop: pte not valid");
@ -190,7 +184,7 @@ _arm_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
a = pte & ARM_L2_S_FRAME;
}
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, ARM_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program, "_arm_minidump_kvatop: "
"physical address 0x%jx not in minidump",
@ -209,12 +203,69 @@ _arm_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
return (0);
}
static vm_prot_t
_arm_entry_to_prot(kvm_t *kd, arm_pt_entry_t pte)
{
struct vmstate *vm = kd->vmst;
vm_prot_t prot = VM_PROT_READ;
/* Source: arm/arm/pmap-v4.c:pmap_fault_fixup() */
if (vm->hdr.mmuformat == MINIDUMP_MMU_FORMAT_V4) {
if (pte & ARM_L2_S_PROT_W)
prot |= VM_PROT_WRITE;
return prot;
}
/* Source: arm/arm/pmap-v6.c:pmap_protect() */
if ((pte & ARM_PTE2_RO) == 0)
prot |= VM_PROT_WRITE;
if ((pte & ARM_PTE2_NX) == 0)
prot |= VM_PROT_EXECUTE;
return prot;
}
static int
_arm_minidump_walk_pages(kvm_t *kd, kvm_walk_pages_cb_t *cb, void *arg)
{
struct vmstate *vm = kd->vmst;
u_long nptes = vm->hdr.ptesize / sizeof(arm_pt_entry_t);
u_long dva, pa, pteindex, va;
for (pteindex = 0; pteindex < nptes; pteindex++) {
arm_pt_entry_t pte = _arm_pte_get(kd, pteindex);
if ((pte & ARM_L2_TYPE_MASK) == ARM_L2_TYPE_INV)
continue;
va = vm->hdr.kernbase + (pteindex << ARM_PAGE_SHIFT);
if ((pte & ARM_L2_TYPE_MASK) == ARM_L2_TYPE_L) {
/* 64K page */
pa = (pte & ARM_L2_L_FRAME) +
(va & ARM_L2_L_OFFSET & ARM_L2_S_FRAME);
} else {
if (vm->hdr.mmuformat == MINIDUMP_MMU_FORMAT_V4 &&
(pte & ARM_L2_TYPE_MASK) == ARM_L2_TYPE_T) {
continue;
}
/* 4K page */
pa = pte & ARM_L2_S_FRAME;
}
dva = 0; /* no direct map on this platform */
if (!_kvm_visit_cb(kd, cb, arg, pa, va, dva,
_arm_entry_to_prot(kd, pte), ARM_PAGE_SIZE, 0))
return (0);
}
return (1);
}
static struct kvm_arch kvm_arm_minidump = {
.ka_probe = _arm_minidump_probe,
.ka_initvtop = _arm_minidump_initvtop,
.ka_freevtop = _arm_minidump_freevtop,
.ka_kvatop = _arm_minidump_kvatop,
.ka_native = _arm_native,
.ka_walk_pages = _arm_minidump_walk_pages,
};
KVM_ARCH(kvm_arm_minidump);

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vm/vm.h>
#include <kvm.h>
#include "../../sys/i386/include/minidump.h"
@ -49,9 +50,24 @@ __FBSDID("$FreeBSD$");
struct vmstate {
struct minidumphdr hdr;
void *ptemap;
};
static i386_pte_pae_t
_i386_pte_pae_get(kvm_t *kd, u_long pteindex)
{
i386_pte_pae_t *pte = _kvm_pmap_get(kd, pteindex, sizeof(*pte));
return le64toh(*pte);
}
static i386_pte_t
_i386_pte_get(kvm_t *kd, u_long pteindex)
{
i386_pte_t *pte = _kvm_pmap_get(kd, pteindex, sizeof(*pte));
return le32toh(*pte);
}
static int
_i386_minidump_probe(kvm_t *kd)
{
@ -65,7 +81,6 @@ _i386_minidump_freevtop(kvm_t *kd)
{
struct vmstate *vm = kd->vmst;
free(vm->ptemap);
free(vm);
kd->vmst = NULL;
}
@ -110,19 +125,11 @@ _i386_minidump_initvtop(kvm_t *kd)
i386_round_page(vmst->hdr.ptesize);
if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off,
I386_PAGE_SIZE, sizeof(uint32_t)) == -1) {
_kvm_err(kd, kd->program, "cannot load core bitmap");
return (-1);
}
off += i386_round_page(vmst->hdr.bitmapsize);
vmst->ptemap = _kvm_malloc(kd, vmst->hdr.ptesize);
if (vmst->ptemap == NULL) {
_kvm_err(kd, kd->program, "cannot allocate %d bytes for ptemap", vmst->hdr.ptesize);
return (-1);
}
if (pread(kd->pmfd, vmst->ptemap, vmst->hdr.ptesize, off) !=
(ssize_t)vmst->hdr.ptesize) {
_kvm_err(kd, kd->program, "cannot read %d bytes for ptemap", vmst->hdr.ptesize);
if (_kvm_pmap_init(kd, vmst->hdr.ptesize, off) == -1) {
return (-1);
}
off += i386_round_page(vmst->hdr.ptesize);
@ -139,24 +146,22 @@ _i386_minidump_vatop_pae(kvm_t *kd, kvaddr_t va, off_t *pa)
kvaddr_t pteindex;
i386_physaddr_pae_t a;
off_t ofs;
i386_pte_pae_t *ptemap;
vm = kd->vmst;
ptemap = vm->ptemap;
offset = va & I386_PAGE_MASK;
if (va >= vm->hdr.kernbase) {
pteindex = (va - vm->hdr.kernbase) >> I386_PAGE_SHIFT;
if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap))
if (pteindex >= vm->hdr.ptesize / sizeof(pte))
goto invalid;
pte = le64toh(ptemap[pteindex]);
pte = _i386_pte_pae_get(kd, pteindex);
if ((pte & I386_PG_V) == 0) {
_kvm_err(kd, kd->program,
"_i386_minidump_vatop_pae: pte not valid");
goto invalid;
}
a = pte & I386_PG_FRAME_PAE;
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, I386_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program,
"_i386_minidump_vatop_pae: physical address 0x%jx not in minidump",
@ -186,24 +191,22 @@ _i386_minidump_vatop(kvm_t *kd, kvaddr_t va, off_t *pa)
kvaddr_t pteindex;
i386_physaddr_t a;
off_t ofs;
i386_pte_t *ptemap;
vm = kd->vmst;
ptemap = vm->ptemap;
offset = va & I386_PAGE_MASK;
if (va >= vm->hdr.kernbase) {
pteindex = (va - vm->hdr.kernbase) >> I386_PAGE_SHIFT;
if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap))
if (pteindex >= vm->hdr.ptesize / sizeof(pte))
goto invalid;
pte = le32toh(ptemap[pteindex]);
pte = _i386_pte_get(kd, pteindex);
if ((pte & I386_PG_V) == 0) {
_kvm_err(kd, kd->program,
"_i386_minidump_vatop: pte not valid");
goto invalid;
}
a = pte & I386_PG_FRAME;
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, I386_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program,
"_i386_minidump_vatop: physical address 0x%jx not in minidump",
@ -238,12 +241,99 @@ _i386_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
return (_i386_minidump_vatop(kd, va, pa));
}
static vm_prot_t
_i386_entry_to_prot(uint64_t pte)
{
vm_prot_t prot = VM_PROT_READ;
/* Source: i386/pmap.c:pmap_protect() */
if (pte & I386_PG_RW)
prot |= VM_PROT_WRITE;
if ((pte & I386_PG_NX) == 0)
prot |= VM_PROT_EXECUTE;
return prot;
}
struct i386_iter {
kvm_t *kd;
u_long nptes;
u_long pteindex;
};
static void
_i386_iterator_init(struct i386_iter *it, kvm_t *kd)
{
struct vmstate *vm = kd->vmst;
it->kd = kd;
it->pteindex = 0;
if (vm->hdr.paemode) {
it->nptes = vm->hdr.ptesize / sizeof(i386_pte_pae_t);
} else {
it->nptes = vm->hdr.ptesize / sizeof(i386_pte_t);
}
return;
}
static int
_i386_iterator_next(struct i386_iter *it, u_long *pa, u_long *va, u_long *dva,
vm_prot_t *prot)
{
struct vmstate *vm = it->kd->vmst;
i386_pte_t pte32;
i386_pte_pae_t pte64;
int found = 0;
*dva = 0;
*pa = 0;
*va = 0;
*dva = 0;
*prot = 0;
for (; it->pteindex < it->nptes && found == 0; it->pteindex++) {
if (vm->hdr.paemode) {
pte64 = _i386_pte_pae_get(it->kd, it->pteindex);
if ((pte64 & I386_PG_V) == 0)
continue;
*prot = _i386_entry_to_prot(pte64);
*pa = pte64 & I386_PG_FRAME_PAE;
} else {
pte32 = _i386_pte_get(it->kd, it->pteindex);
if ((pte32 & I386_PG_V) == 0)
continue;
*prot = _i386_entry_to_prot(pte32);
*pa = pte32 & I386_PG_FRAME;
}
*va = vm->hdr.kernbase + (it->pteindex << I386_PAGE_SHIFT);
found = 1;
}
return found;
}
static int
_i386_minidump_walk_pages(kvm_t *kd, kvm_walk_pages_cb_t *cb, void *arg)
{
struct i386_iter it;
u_long dva, pa, va;
vm_prot_t prot;
_i386_iterator_init(&it, kd);
while (_i386_iterator_next(&it, &pa, &va, &dva, &prot)) {
if (!_kvm_visit_cb(kd, cb, arg, pa, va, dva,
prot, I386_PAGE_SIZE, 0)) {
return (0);
}
}
return (1);
}
static struct kvm_arch kvm_i386_minidump = {
.ka_probe = _i386_minidump_probe,
.ka_initvtop = _i386_minidump_initvtop,
.ka_freevtop = _i386_minidump_freevtop,
.ka_kvatop = _i386_minidump_kvatop,
.ka_native = _i386_native,
.ka_walk_pages = _i386_minidump_walk_pages,
};
KVM_ARCH(kvm_i386_minidump);

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
*/
#include <sys/param.h>
#include <vm/vm.h>
#include <kvm.h>
#include <limits.h>
#include <stdint.h>
@ -52,7 +53,6 @@ __FBSDID("$FreeBSD$");
struct vmstate {
struct minidumphdr hdr;
void *ptemap;
int pte_size;
};
@ -73,7 +73,6 @@ _mips_minidump_freevtop(kvm_t *kd)
{
struct vmstate *vm = kd->vmst;
free(vm->ptemap);
free(vm);
kd->vmst = NULL;
}
@ -129,22 +128,11 @@ _mips_minidump_initvtop(kvm_t *kd)
mips_round_page(vmst->hdr.ptesize);
if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off,
MIPS_PAGE_SIZE, sizeof(uint32_t)) == -1) {
_kvm_err(kd, kd->program, "cannot load core bitmap");
return (-1);
}
off += mips_round_page(vmst->hdr.bitmapsize);
vmst->ptemap = _kvm_malloc(kd, vmst->hdr.ptesize);
if (vmst->ptemap == NULL) {
_kvm_err(kd, kd->program, "cannot allocate %d bytes for "
"ptemap", vmst->hdr.ptesize);
return (-1);
}
if (pread(kd->pmfd, vmst->ptemap, vmst->hdr.ptesize, off) !=
(ssize_t)vmst->hdr.ptesize) {
_kvm_err(kd, kd->program, "cannot read %d bytes for ptemap",
vmst->hdr.ptesize);
if (_kvm_pmap_init(kd, vmst->hdr.ptesize, off) == -1) {
return (-1);
}
off += mips_round_page(vmst->hdr.ptesize);
@ -156,12 +144,12 @@ static int
_mips_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
{
struct vmstate *vm;
uint64_t pte;
mips_physaddr_t offset, a;
kvaddr_t pteindex;
u_long valid;
off_t ofs;
uint32_t *ptemap32;
uint64_t *ptemap64;
mips32_pte_t pte32;
mips64_pte_t pte64;
if (ISALIVE(kd)) {
_kvm_err(kd, 0, "_mips_minidump_kvatop called in live kernel!");
@ -173,9 +161,6 @@ _mips_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
va &= ~MIPS_PAGE_MASK;
vm = kd->vmst;
ptemap32 = vm->ptemap;
ptemap64 = vm->ptemap;
if (kd->nlehdr.e_ident[EI_CLASS] == ELFCLASS64) {
if (va >= MIPS_XKPHYS_START && va < MIPS_XKPHYS_END) {
a = va & MIPS_XKPHYS_PHYS_MASK;
@ -202,17 +187,22 @@ _mips_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
if (va >= vm->hdr.kernbase) {
pteindex = (va - vm->hdr.kernbase) >> MIPS_PAGE_SHIFT;
if (vm->pte_size == 64) {
if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap64))
valid = pteindex < vm->hdr.ptesize / sizeof(pte64);
if (pteindex >= vm->hdr.ptesize / sizeof(pte64))
goto invalid;
pte = _kvm64toh(kd, ptemap64[pteindex]);
a = MIPS64_PTE_TO_PA(pte);
pte64 = _mips64_pte_get(kd, pteindex);
valid = pte64 & MIPS_PTE_V;
if (valid)
a = MIPS64_PTE_TO_PA(pte64);
} else {
if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap32))
if (pteindex >= vm->hdr.ptesize / sizeof(pte32))
goto invalid;
pte = _kvm32toh(kd, ptemap32[pteindex]);
a = MIPS32_PTE_TO_PA(pte);
pte32 = _mips32_pte_get(kd, pteindex);
valid = pte32 & MIPS_PTE_V;
if (valid)
a = MIPS32_PTE_TO_PA(pte32);
}
if (!pte) {
if (!valid) {
_kvm_err(kd, kd->program, "_mips_minidump_kvatop: pte "
"not valid");
goto invalid;
@ -224,7 +214,7 @@ _mips_minidump_kvatop(kvm_t *kd, kvaddr_t va, off_t *pa)
}
found:
ofs = _kvm_pt_find(kd, a);
ofs = _kvm_pt_find(kd, a, MIPS_PAGE_SIZE);
if (ofs == -1) {
_kvm_err(kd, kd->program, "_mips_minidump_kvatop: physical "
"address 0x%jx not in minidump", (uintmax_t)a);
@ -273,12 +263,101 @@ _mips_native(kvm_t *kd __unused)
#endif
}
struct mips_iter {
kvm_t *kd;
u_long nptes;
u_long pteindex;
};
static void
_mips_iterator_init(struct mips_iter *it, kvm_t *kd)
{
struct vmstate *vm = kd->vmst;
it->kd = kd;
it->pteindex = 0;
if (vm->pte_size == 64)
it->nptes = vm->hdr.ptesize / sizeof(mips64_pte_t);
else
it->nptes = vm->hdr.ptesize / sizeof(mips32_pte_t);
return;
}
static int
_mips_iterator_next(struct mips_iter *it, u_long *pa, u_long *va, u_long *dva,
vm_prot_t *prot)
{
struct vmstate *vm = it->kd->vmst;
int found = 0;
mips64_pte_t pte64;
mips32_pte_t pte32;
/*
* mips/mips/pmap.c: init_pte_prot / pmap_protect indicate that all
* pages are R|X at least.
*/
*prot = VM_PROT_READ | VM_PROT_EXECUTE;
*pa = 0;
*va = 0;
*dva = 0;
for (;it->pteindex < it->nptes && found == 0; it->pteindex++) {
if (vm->pte_size == 64) {
pte64 = _mips64_pte_get(it->kd, it->pteindex);
if ((pte64 & MIPS_PTE_V) == 0)
continue;
if ((pte64 & MIPS64_PTE_RO) == 0)
*prot |= VM_PROT_WRITE;
*pa = MIPS64_PTE_TO_PA(pte64);
} else {
pte32 = _mips32_pte_get(it->kd, it->pteindex);
if ((pte32 & MIPS_PTE_V) == 0)
continue;
if ((pte32 & MIPS32_PTE_RO) == 0)
*prot |= VM_PROT_WRITE;
*pa = MIPS32_PTE_TO_PA(pte32);
}
*va = vm->hdr.kernbase + (it->pteindex << MIPS_PAGE_SHIFT);
found = 1;
/* advance pteindex regardless */
}
return found;
}
static int
_mips_minidump_walk_pages(kvm_t *kd, kvm_walk_pages_cb_t *cb, void *arg)
{
struct mips_iter it;
u_long dva, pa, va;
vm_prot_t prot;
/* Generate direct mapped entries; need page entries for prot etc? */
if (kd->nlehdr.e_ident[EI_CLASS] == ELFCLASS64) {
/* MIPS_XKPHYS_START..MIPS_XKPHYS_END */
/* MIPS64_KSEG0_START..MIPS64_KSEG0_END */
/* MIPS64_KSEG1_START..MIPS64_KSEG1_START */
} else {
/* MIPS32_KSEG0_START..MIPS32_KSEG0_END */
/* MIPS32_KSEG1_START..MIPS32_KSEG1_END */
}
_mips_iterator_init(&it, kd);
while (_mips_iterator_next(&it, &pa, &va, &dva, &prot)) {
if (!_kvm_visit_cb(kd, cb, arg, pa, va, dva,
prot, MIPS_PAGE_SIZE, 0)) {
return (0);
}
}
return (1);
}
static struct kvm_arch kvm_mips_minidump = {
.ka_probe = _mips_minidump_probe,
.ka_initvtop = _mips_minidump_initvtop,
.ka_freevtop = _mips_minidump_freevtop,
.ka_kvatop = _mips_minidump_kvatop,
.ka_native = _mips_native,
.ka_walk_pages = _mips_minidump_walk_pages,
};
KVM_ARCH(kvm_mips_minidump);

View File

@ -35,6 +35,9 @@
typedef uint64_t mips_physaddr_t;
typedef uint32_t mips32_pte_t;
typedef uint64_t mips64_pte_t;
#define MIPS_PAGE_SHIFT 12
#define MIPS_PAGE_SIZE (1 << MIPS_PAGE_SHIFT)
#define MIPS_PAGE_MASK (MIPS_PAGE_SIZE - 1)
@ -58,6 +61,28 @@ typedef uint64_t mips_physaddr_t;
#define MIPS64_PTE_TO_PFN(pte) ((pte) & MIPS64_PFN_MASK)
#define MIPS64_PTE_TO_PA(pte) (MIPS_PFN_TO_PA(MIPS64_PTE_TO_PFN((pte))))
#define MIPS32_SWBITS_SHIFT 29
#define MIPS64_SWBITS_SHIFT 55
#define MIPS_PTE_V 0x02
#define MIPS32_PTE_RO ((mips32_pte_t)0x01 << MIPS32_SWBITS_SHIFT)
#define MIPS64_PTE_RO ((mips64_pte_t)0x01 << MIPS64_SWBITS_SHIFT)
static inline mips32_pte_t
_mips32_pte_get(kvm_t *kd, u_long pteindex)
{
mips32_pte_t *pte = _kvm_pmap_get(kd, pteindex, sizeof(*pte));
return _kvm32toh(kd, *pte);
}
static inline mips64_pte_t
_mips64_pte_get(kvm_t *kd, u_long pteindex)
{
mips64_pte_t *pte = _kvm_pmap_get(kd, pteindex, sizeof(*pte));
return _kvm64toh(kd, *pte);
}
#ifdef __mips__
_Static_assert(PAGE_SHIFT == MIPS_PAGE_SHIFT, "PAGE_SHIFT mismatch");
_Static_assert(PAGE_SIZE == MIPS_PAGE_SIZE, "PAGE_SIZE mismatch");

View File

@ -43,11 +43,13 @@ __FBSDID("$FreeBSD$");
#include <sys/linker.h>
#include <sys/pcpu.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <net/vnet.h>
#include <assert.h>
#include <fcntl.h>
#include <vm/vm.h>
#include <kvm.h>
#include <limits.h>
#include <paths.h>
@ -57,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
#include <inttypes.h>
#include "kvm_private.h"
@ -258,6 +261,32 @@ popcount_bytes(uint64_t *addr, uint32_t bit0, uint32_t bitN)
return (count);
}
void *
_kvm_pmap_get(kvm_t *kd, u_long idx, size_t len)
{
uintptr_t off = idx * len;
if ((off_t)off >= kd->pt_sparse_off)
return (NULL);
return (void *)((uintptr_t)kd->page_map + off);
}
void *
_kvm_map_get(kvm_t *kd, u_long pa, unsigned int page_size)
{
off_t off;
uintptr_t addr;
off = _kvm_pt_find(kd, pa, page_size);
if (off == -1)
return NULL;
addr = (uintptr_t)kd->page_map + off;
if (off >= kd->pt_sparse_off)
addr = (uintptr_t)kd->sparse_map + (off - kd->pt_sparse_off);
return (void *)addr;
}
int
_kvm_pt_init(kvm_t *kd, size_t map_len, off_t map_off, off_t sparse_off,
int page_size, int word_size)
@ -300,8 +329,10 @@ _kvm_pt_init(kvm_t *kd, size_t map_len, off_t map_off, off_t sparse_off,
res = map_len;
pc_bins = 1 + (res * NBBY + POPCOUNT_BITS / 2) / POPCOUNT_BITS;
kd->pt_popcounts = calloc(pc_bins, sizeof(uint32_t));
if (kd->pt_popcounts == NULL)
if (kd->pt_popcounts == NULL) {
_kvm_err(kd, kd->program, "cannot allocate popcount bins");
return (-1);
}
for (popcount_bin = &kd->pt_popcounts[1]; res > 0;
addr++, res -= sizeof(*addr)) {
@ -318,9 +349,46 @@ _kvm_pt_init(kvm_t *kd, size_t map_len, off_t map_off, off_t sparse_off,
((uintptr_t)popcount_bin - (uintptr_t)kd->pt_popcounts));
kd->pt_sparse_off = sparse_off;
kd->pt_sparse_size = (uint64_t)*popcount_bin * PAGE_SIZE;
kd->pt_sparse_size = (uint64_t)*popcount_bin * page_size;
kd->pt_page_size = page_size;
kd->pt_word_size = word_size;
/*
* Map the sparse page array. This is useful for performing point
* lookups of specific pages, e.g. for kvm_walk_pages. Generally,
* this is much larger than is reasonable to read in up front, so
* mmap it in instead.
*/
kd->sparse_map = mmap(NULL, kd->pt_sparse_size, PROT_READ,
MAP_PRIVATE, kd->pmfd, kd->pt_sparse_off);
if (kd->sparse_map == MAP_FAILED) {
_kvm_err(kd, kd->program, "cannot map %" PRIu64
" bytes from fd %d offset %jd for sparse map: %s",
kd->pt_sparse_size, kd->pmfd,
(intmax_t)kd->pt_sparse_off, strerror(errno));
return (-1);
}
return (0);
}
int
_kvm_pmap_init(kvm_t *kd, uint32_t pmap_size, off_t pmap_off)
{
ssize_t exp_len = pmap_size;
kd->page_map_size = pmap_size;
kd->page_map_off = pmap_off;
kd->page_map = _kvm_malloc(kd, pmap_size);
if (kd->page_map == NULL) {
_kvm_err(kd, kd->program, "cannot allocate %u bytes "
"for page map", pmap_size);
return (-1);
}
if (pread(kd->pmfd, kd->page_map, pmap_size, pmap_off) != exp_len) {
_kvm_err(kd, kd->program, "cannot read %d bytes from "
"offset %jd for page map", pmap_size, (intmax_t)pmap_off);
return (-1);
}
return (0);
}
@ -328,7 +396,7 @@ _kvm_pt_init(kvm_t *kd, size_t map_len, off_t map_off, off_t sparse_off,
* Find the offset for the given physical page address; returns -1 otherwise.
*
* A page's offset is represented by the sparse page base offset plus the
* number of bits set before its bit multiplied by PAGE_SIZE. This means
* number of bits set before its bit multiplied by page size. This means
* that if a page exists in the dump, it's necessary to know how many pages
* in the dump precede it. Reduce this O(n) counting to O(1) by caching the
* number of bits set at POPCOUNT_BITS intervals.
@ -339,10 +407,10 @@ _kvm_pt_init(kvm_t *kd, size_t map_len, off_t map_off, off_t sparse_off,
* checked by also counting down from the next higher bin if it's closer.
*/
off_t
_kvm_pt_find(kvm_t *kd, uint64_t pa)
_kvm_pt_find(kvm_t *kd, uint64_t pa, unsigned int page_size)
{
uint64_t *bitmap = kd->pt_map;
uint64_t pte_bit_id = pa / PAGE_SIZE;
uint64_t pte_bit_id = pa / page_size;
uint64_t pte_u64 = pte_bit_id / BITS_IN(*bitmap);
uint64_t popcount_id = pte_bit_id / POPCOUNT_BITS;
uint64_t pte_mask = 1ULL << (pte_bit_id % BITS_IN(*bitmap));
@ -383,10 +451,10 @@ _kvm_pt_find(kvm_t *kd, uint64_t pa)
* This can only happen if the core is truncated. Treat these
* entries as if they don't exist, since their backing doesn't.
*/
if (count >= (kd->pt_sparse_size / PAGE_SIZE))
if (count >= (kd->pt_sparse_size / page_size))
return (-1);
return (kd->pt_sparse_off + (uint64_t)count * PAGE_SIZE);
return (kd->pt_sparse_off + (uint64_t)count * page_size);
}
static int
@ -630,3 +698,70 @@ _kvm_nlist(kvm_t *kd, struct kvm_nlist *nl, int initialize)
_kvm_syserr(kd, kd->program, "kvm_nlist");
return (error);
}
int
_kvm_bitmap_init(struct kvm_bitmap *bm, u_long bitmapsize, u_long *idx)
{
*idx = ULONG_MAX;
bm->map = calloc(bitmapsize, sizeof *bm->map);
if (bm->map == NULL)
return (0);
bm->size = bitmapsize;
return (1);
}
void
_kvm_bitmap_set(struct kvm_bitmap *bm, u_long pa, unsigned int page_size)
{
u_long bm_index = pa / page_size;
uint8_t *byte = &bm->map[bm_index / 8];
*byte |= (1UL << (bm_index % 8));
}
int
_kvm_bitmap_next(struct kvm_bitmap *bm, u_long *idx)
{
u_long first_invalid = bm->size * CHAR_BIT;
if (*idx == ULONG_MAX)
*idx = 0;
else
(*idx)++;
/* Find the next valid idx. */
for (; *idx < first_invalid; (*idx)++) {
unsigned int mask = *idx % CHAR_BIT;
if ((bm->map[*idx * CHAR_BIT] & mask) == 0)
break;
}
return (*idx < first_invalid);
}
void
_kvm_bitmap_deinit(struct kvm_bitmap *bm)
{
free(bm->map);
}
int
_kvm_visit_cb(kvm_t *kd, kvm_walk_pages_cb_t *cb, void *arg, u_long pa,
u_long kmap_vaddr, u_long dmap_vaddr, vm_prot_t prot, size_t len,
unsigned int page_size)
{
unsigned int pgsz = page_size ? page_size : len;
struct kvm_page p = {
.version = LIBKVM_WALK_PAGES_VERSION,
.paddr = pa,
.kmap_vaddr = kmap_vaddr,
.dmap_vaddr = dmap_vaddr,
.prot = prot,
.offset = _kvm_pt_find(kd, pa, pgsz),
.len = len,
};
return cb(&p, arg);
}

View File

@ -44,6 +44,7 @@ struct kvm_arch {
void (*ka_freevtop)(kvm_t *);
int (*ka_kvatop)(kvm_t *, kvaddr_t, off_t *);
int (*ka_native)(kvm_t *);
int (*ka_walk_pages)(kvm_t *, kvm_walk_pages_cb_t *, void *);
};
#define KVM_ARCH(ka) DATA_SET(kvm_arch, ka)
@ -107,6 +108,17 @@ struct __kvm {
uint32_t *pt_popcounts;
unsigned int pt_page_size;
unsigned int pt_word_size;
/* Page & sparse map structures. */
void *page_map;
uint32_t page_map_size;
off_t page_map_off;
void *sparse_map;
};
struct kvm_bitmap {
uint8_t *map;
u_long size;
};
/* Page table lookup constants. */
@ -137,6 +149,11 @@ _kvm64toh(kvm_t *kd, uint64_t val)
return (be64toh(val));
}
int _kvm_bitmap_init(struct kvm_bitmap *, u_long, u_long *);
void _kvm_bitmap_set(struct kvm_bitmap *, u_long, unsigned int);
int _kvm_bitmap_next(struct kvm_bitmap *, u_long *);
void _kvm_bitmap_deinit(struct kvm_bitmap *);
void _kvm_err(kvm_t *kd, const char *program, const char *fmt, ...)
__printflike(3, 4);
void _kvm_freeprocs(kvm_t *kd);
@ -154,4 +171,9 @@ int _kvm_probe_elf_kernel(kvm_t *, int, int);
int _kvm_is_minidump(kvm_t *);
int _kvm_read_core_phdrs(kvm_t *, size_t *, GElf_Phdr **);
int _kvm_pt_init(kvm_t *, size_t, off_t, off_t, int, int);
off_t _kvm_pt_find(kvm_t *, uint64_t);
off_t _kvm_pt_find(kvm_t *, uint64_t, unsigned int);
int _kvm_visit_cb(kvm_t *, kvm_walk_pages_cb_t *, void *, u_long,
u_long, u_long, vm_prot_t, size_t, unsigned int);
int _kvm_pmap_init(kvm_t *, uint32_t, off_t);
void * _kvm_pmap_get(kvm_t *, u_long, size_t);
void * _kvm_map_get(kvm_t *, u_long, unsigned int);

View File

@ -42,14 +42,9 @@
The
.Fn hexdump
function prints an array of bytes to standard out in hexadecimal form,
along with the
.Tn ASCII
representation of the bytes, if possible.
By default, each line of
output will start with an offset count, followed by 16 hexadecimal values,
followed by 16
.Tn ASCII
characters.
along with the ASCII representation of the bytes, if possible.
By default, each line of output will start with an offset count, followed by 16
hexadecimal values, followed by 16 ASCII characters.
.Bl -tag -width indent
.It Fa ptr
Pointer to the array of bytes to print.
@ -73,12 +68,10 @@ Flags for controlling the formatting of the output.
Integer value of the number of bytes to display on each line.
A value of 0 implies that the default value of 16 will be used.
.It Bits 8-15
Character
.Tn ASCII
value to use as the separator for the hexadecimal output.
Character ASCII value to use as the separator for the hexadecimal output.
A value of 0 implies that the default value of 32
.Tn ( ASCII
space) will be used.
.Pq ASCII space
will be used.
.It Dv HD_OMIT_COUNT
Do not print the offset column at the beginning of each line.
.It Dv HD_OMIT_HEX

View File

@ -19,7 +19,12 @@ SRCS= entropy_common.c \
zbuff_decompress.c \
cover.c \
divsufsort.c \
zdict.c
zdict.c \
zstd_fast.c \
zstd_lazy.c \
zstd_ldm.c \
zstd_opt.c \
zstd_double_fast.c
WARNS= 2
INCS= zstd.h
CFLAGS+= -I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_ \
@ -28,7 +33,7 @@ LIBADD= pthread
PRIVATELIB= yes
ZSTDDIR= ${SRCTOP}/contrib/zstd
ZSTDDIR= ${SRCTOP}/sys/contrib/zstd
.PATH: ${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \
${ZSTDDIR}/lib/decompress ${ZSTDDIR}/lib/deprecated \
${ZSTDDIR}/lib/dictBuilder ${ZSTDDIR}/lib

View File

@ -32,7 +32,9 @@
#include <machine/asm.h>
#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4)
.cfi_sections .debug_frame
#endif
.globl _C_LABEL(_rtld_relocate_nonplt_self)
.globl _C_LABEL(_rtld)

View File

@ -57,7 +57,7 @@ TLD?= ${FTPDIR}/releases
.endif
.if defined(EMBEDDED) && !empty(EMBEDDED)
. if ${TARGET:Marm*} != "" && (${TARGET_ARCH:Marmv[67]} != "" || ${TARGET_ARCH} == "aarch64")
. if ${TARGET:Marm*} != "" && (${TARGET_ARCH:Marm*} != "" || ${TARGET_ARCH} == "aarch64")
. if !defined(BOARDNAME) && empty(BOARDNAME)
BOARDNAME:= ${KERNCONF}
. else

View File

@ -5,7 +5,7 @@
EMBEDDEDBUILD=1
EMBEDDED_TARGET="arm"
EMBEDDED_TARGET_ARCH="armv6"
EMBEDDED_TARGET_ARCH="arm"
EMBEDDEDPORTS="sysutils/u-boot-duovero"
KERNEL="GUMSTIX"
IMAGE_SIZE="3072M"

View File

@ -26,12 +26,12 @@ arm_install_uboot() {
of=/dev/${mddev} bs=1k seek=8 conv=sync
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}
chroot ${CHROOTDIR} mount /dev/${mddev}s2 ${UFSMOUNT}
BOOTFILES="$(chroot ${CHROOTDIR} \
env TARGET=${EMBEDDED_TARGET} TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \
WITH_UNIFIED_OBJDIR=yes \
make -C ${WORLDDIR}/sys/boot -V .OBJDIR)"
make -C ${WORLDDIR}/stand -V .OBJDIR)"
BOOTFILES="$(realpath ${BOOTFILES})"
chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/EFI/BOOT

View File

@ -45,7 +45,7 @@ arm_install_uboot() {
BOOTFILES="$(chroot ${CHROOTDIR} \
env TARGET=${EMBEDDED_TARGET} TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \
WITH_UNIFIED_OBJDIR=yes \
make -C ${WORLDDIR}/sys/boot -V .OBJDIR)"
make -C ${WORLDDIR}/stand -V .OBJDIR)"
BOOTFILES="$(realpath ${BOOTFILES})"
chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/EFI/BOOT

View File

@ -32,7 +32,7 @@ cat > bootinfo.txt << EOF
<CHRP-BOOT>
<DESCRIPTION>FreeBSD/powerpc bootloader</DESCRIPTION>
<OS-NAME>FreeBSD</OS-NAME>
<VERSION> $FreeBSD: head/sys/boot/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10
<VERSION> $FreeBSD: head/stand/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10
-31 00:52:31Z nwhitehorn $ </VERSION>
<COMPATIBLE>

View File

@ -148,7 +148,7 @@ env_check() {
WITH_COMPRESSED_IMAGES=
NODOC=yes
case ${EMBEDDED_TARGET}:${EMBEDDED_TARGET_ARCH} in
arm:armv6|arm:armv7|arm64:aarch64)
arm:arm*|arm64:aarch64)
chroot_build_release_cmd="chroot_arm_build_release"
;;
*)

View File

@ -16,7 +16,7 @@ write_partition_layout() {
BOOTFILES="$(env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
WITH_UNIFIED_OBJDIR=yes \
make -C ${WORLDDIR}/sys/boot -V .OBJDIR)"
make -C ${WORLDDIR}/stand -V .OBJDIR)"
BOOTFILES="$(realpath ${BOOTFILES})"
case "${TARGET}:${TARGET_ARCH}" in

View File

@ -44,6 +44,12 @@ MAN= dhclient.8 dhclient.conf.5 dhclient.leases.5 dhcp-options.5 \
dhclient-script.8
LIBADD= util
.if ${MK_CASPER} != "no" && !defined(RESCUE)
LIBADD+= casper
LIBADD+= cap_syslog
CFLAGS+=-DWITH_CASPER
.endif
WARNS?= 2
HAS_TESTS=

View File

@ -84,6 +84,8 @@ __FBSDID("$FreeBSD$");
#define CLIENT_PATH "PATH=/usr/bin:/usr/sbin:/bin:/sbin"
cap_channel_t *capsyslog;
time_t cur_time;
time_t default_lease_time = 43200; /* 12 hours... */
@ -345,6 +347,21 @@ routehandler(struct protocol *p)
exit(1);
}
static void
init_casper(void)
{
cap_channel_t *casper;
casper = cap_init();
if (casper == NULL)
error("unable to start casper");
capsyslog = cap_service_open(casper, "system.syslog");
cap_close(casper);
if (capsyslog == NULL)
error("unable to open system.syslog service");
}
int
main(int argc, char *argv[])
{
@ -356,9 +373,11 @@ main(int argc, char *argv[])
pid_t otherpid;
cap_rights_t rights;
init_casper();
/* Initially, log errors to stderr as well as to syslogd. */
openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
setlogmask(LOG_UPTO(LOG_DEBUG));
cap_openlog(capsyslog, __progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
cap_setlogmask(capsyslog, LOG_UPTO(LOG_DEBUG));
while ((ch = getopt(argc, argv, "bc:dl:p:qu")) != -1)
switch (ch) {
@ -518,7 +537,7 @@ main(int argc, char *argv[])
setproctitle("%s", ifi->name);
if (cap_enter() < 0 && errno != ENOSYS)
if (CASPER_SUPPORT && cap_enter() < 0 && errno != ENOSYS)
error("can't enter capability mode: %m");
if (immediate_daemon)
@ -2404,7 +2423,7 @@ go_daemon(void)
/* Stop logging to stderr... */
log_perror = 0;
if (daemon(1, 0) == -1)
if (daemon(1, 1) == -1)
error("daemon");
cap_rights_init(&rights);

View File

@ -73,6 +73,9 @@
#include <time.h>
#include <unistd.h>
#include <libcasper.h>
#include <casper/cap_syslog.h>
#include "dhcp.h"
#include "tree.h"
@ -352,6 +355,7 @@ int addr_eq(struct iaddr, struct iaddr);
char *piaddr(struct iaddr);
/* dhclient.c */
extern cap_channel_t *capsyslog;
extern char *path_dhclient_conf;
extern char *path_dhclient_db;
extern time_t cur_time;

View File

@ -298,7 +298,8 @@ interface_status(struct interface_info *ifinfo)
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(ifsock, SIOCGIFFLAGS, &ifr) < 0) {
syslog(LOG_ERR, "ioctl(SIOCGIFFLAGS) on %s: %m", ifname);
cap_syslog(capsyslog, LOG_ERR, "ioctl(SIOCGIFFLAGS) on %s: %m",
ifname);
goto inactive;
}
@ -316,9 +317,8 @@ interface_status(struct interface_info *ifinfo)
strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
if (ioctl(ifsock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
if (errno != EINVAL) {
syslog(LOG_DEBUG, "ioctl(SIOCGIFMEDIA) on %s: %m",
ifname);
cap_syslog(capsyslog, LOG_DEBUG,
"ioctl(SIOCGIFMEDIA) on %s: %m", ifname);
ifinfo->noifmedia = 1;
goto active;
}
@ -479,8 +479,8 @@ interface_link_status(char *ifname)
if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifmr) == -1) {
/* EINVAL -> link state unknown. treat as active */
if (errno != EINVAL)
syslog(LOG_DEBUG, "ioctl(SIOCGIFMEDIA) on %s: %m",
ifname);
cap_syslog(capsyslog, LOG_DEBUG,
"ioctl(SIOCGIFMEDIA) on %s: %m", ifname);
close(sock);
return (1);
}

View File

@ -69,7 +69,7 @@ error(char *fmt, ...)
va_end(list);
#ifndef DEBUG
syslog(log_priority | LOG_ERR, "%s", mbuf);
cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", mbuf);
#endif
/* Also log it to stderr? */
@ -78,7 +78,7 @@ error(char *fmt, ...)
write(2, "\n", 1);
}
syslog(LOG_CRIT, "exiting.");
cap_syslog(capsyslog, LOG_CRIT, "exiting.");
if (log_perror) {
fprintf(stderr, "exiting.\n");
fflush(stderr);
@ -103,7 +103,7 @@ warning(char *fmt, ...)
va_end(list);
#ifndef DEBUG
syslog(log_priority | LOG_ERR, "%s", mbuf);
cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", mbuf);
#endif
if (log_perror) {
@ -129,7 +129,7 @@ note(char *fmt, ...)
va_end(list);
#ifndef DEBUG
syslog(log_priority | LOG_INFO, "%s", mbuf);
cap_syslog(capsyslog, log_priority | LOG_INFO, "%s", mbuf);
#endif
if (log_perror) {
@ -155,7 +155,7 @@ debug(char *fmt, ...)
va_end(list);
#ifndef DEBUG
syslog(log_priority | LOG_DEBUG, "%s", mbuf);
cap_syslog(capsyslog, log_priority | LOG_DEBUG, "%s", mbuf);
#endif
if (log_perror) {
@ -217,10 +217,10 @@ parse_warn(char *fmt, ...)
va_end(list);
#ifndef DEBUG
syslog(log_priority | LOG_ERR, "%s", mbuf);
syslog(log_priority | LOG_ERR, "%s", token_line);
cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", mbuf);
cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", token_line);
if (lexline < 81)
syslog(log_priority | LOG_ERR,
cap_syslog(capsyslog, log_priority | LOG_ERR,
"%s^", &spaces[sizeof(spaces) - lexchar]);
#endif

View File

@ -709,7 +709,7 @@ main(int argc, char *const *argv)
if (options & F_NUMERIC)
cansandbox = true;
else if (capdns != NULL)
cansandbox = true;
cansandbox = CASPER_SUPPORT;
else
cansandbox = false;

View File

@ -11,7 +11,7 @@ SUBDIR.${MK_TESTS}+= tests
# These are the programs which depend on crypto, but not Kerberos.
SPROGS= lib/libfetch lib/libpam lib/libradius lib/libtelnet \
bin/ed libexec/telnetd usr.bin/fetch usr.bin/telnet \
usr.sbin/pkg_install usr.sbin/ppp usr.sbin/tcpdump/tcpdump
usr.sbin/ppp usr.sbin/tcpdump/tcpdump
.if ${MK_SENDMAIL} != "no"
SPROGS+=usr.sbin/sendmail
.endif

View File

@ -1,6 +1,6 @@
Here you can find some simple examples how to use BootFORTH (part of the
new bootloader) together with terminal emulation code (available when
compiling /sys/boot/i386/libi386 with -DTERM_EMU).
compiling /stand/i386/libi386 with -DTERM_EMU).
Normally, you can place the files in /boot as they are here, and they will be
automatically loaded by /boot/loader. You must choose between boot.4th or

View File

@ -171,7 +171,7 @@
#BOOT_COMCONSOLE_SPEED= 115200
#
# By default the 'pxeboot' loader retrieves the kernel via NFS. Defining
# this and recompiling /usr/src/sys/boot will cause it to retrieve the kernel
# this and recompiling /usr/src/stand will cause it to retrieve the kernel
# via TFTP. This allows pxeboot to load a custom BOOTP diskless kernel yet
# still mount the server's '/' (i.e. rather than load the server's kernel).
#

View File

@ -95,7 +95,7 @@ computer system in a human-readable form, with certain hierarchical structure
The default location for DTS files in the
.Fx
source repository is
.Pa sys/boot/fdt/dts
.Pa sys/dts
directory.
.It Va Device tree blob (DTB)
The textual device tree description (DTS file) is first converted (compiled)
@ -156,7 +156,7 @@ kernel.
The indicated DTS file will be converted (compiled) into a binary form
along with building the kernel itself.
The DTS file name is relative to the default location of DTS sources i.e.
.Pa sys/boot/fdt/dts .
.Pa sys/dts .
This makeoption is not mandatory unless FDT_DTB_STATIC is also defined (see
below).
.It Va options FDT_DTB_STATIC

View File

@ -137,7 +137,7 @@ on the GPIO IIC bit-banging bus.
For more details about the
.Va gpios
property, please consult
.Pa /usr/src/sys/boot/fdt/dts/bindings-gpio.txt .
.Pa /usr/src/sys/dts/bindings-gpio.txt .
.It Va scl
The
.Va scl

View File

@ -134,7 +134,7 @@ The only restriction is that a GPIO pin cannot be mapped by two different
For more details about the
.Va gpios
property, please consult
.Pa /usr/src/sys/boot/fdt/dts/bindings-gpio.txt .
.Pa /usr/src/sys/dts/bindings-gpio.txt .
.Pp
The property
.Va name

View File

@ -68,7 +68,7 @@ to.
For more details about the
.Va gpios
property, please consult
.Pa /usr/src/sys/boot/fdt/dts/bindings-gpio.txt .
.Pa /usr/src/sys/dts/bindings-gpio.txt .
.Sh SEE ALSO
.Xr gpiobus 4 ,
.Xr ow 4 ,

View File

@ -93,5 +93,4 @@ The user's forwarding instructions.
.El
.Sh SEE ALSO
.Xr aliases 5 ,
.Xr mailaddr 7 ,
.Xr sendmail 8

View File

@ -374,7 +374,7 @@ By default the
.Xr pxeboot 8
loader retrieves the kernel via NFS.
Defining this and recompiling
.Pa /usr/src/sys/boot
.Pa /usr/src/stand
will cause it to retrieve the kernel via TFTP.
This allows
.Xr pxeboot 8
@ -385,7 +385,7 @@ rather than load the server's kernel.
.It Va LOADER_FIREWIRE_SUPPORT
.Pq Vt bool
Defining this and recompiling
.Pa /usr/src/sys/boot/i386
.Pa /usr/src/stand/i386
will add
.Xr dcons 4
console driver to

View File

@ -22,7 +22,6 @@ MAN= arch.7 \
hostname.7 \
intro.7 \
maclabel.7 \
mailaddr.7 \
operator.7 \
ports.7 \
release.7 \

View File

@ -340,6 +340,103 @@ Architecture-specific macros:
.It riscv64sf Ta Dv __riscv, Dv __riscv_xlen == 64
.It sparc64 Ta Dv __sparc64__
.El
.Ss Important Xr make 1 variables
Most of the externally settable variables are defined in the
.Xr build 7
man page.
These variables are not otherwise documented and are used extensively
in the build system.
.Bl -column -offset indent "Sy Variable" "Sy Meaning and usage"
.It Dv MACHINE Represent the hardware platform.
This is the same as the native platform's
.Xr uname 1
.Fl m
output.
It defines both the userland / kernel interface, as well as the
bootloader / kernel interface.
It should only be used in these contexts.
Each CPU architecture may have multiple hardware platforms it supports
where
.Dv MACHINE
differs among them.
It is used to collect together all the files from
.Xr config 8
to build the kernel.
It is often the same as
.Dv MACHINE_ARCH
just as one CPU architecture can be implemented by many different
hardware platforms, one hardware platform may support multiple CPU
architecture family members, though with different binaries.
For example,
.Dv MACHINE
of i386 supported the IBM-AT hardware platform while the
.Dv MACHINE
of pc98 supported the Japanese company NEC's PC-9801 and PC-9821
hardware platforms.
Both of these hardware platforms supported only the
.Dv MACHINE_ARCH
of i386 where they shared a common ABI, except for certain kernel /
userland interfaces relating to underlying hardware platform
differences in bus architecture, device enumeration and boot interface.
Generally,
.Dv MACHINE
should only be used in src/sys and src/stand or in system imagers or
installers.
.It Dv MACHINE_ARCH Represents the CPU processor architecture.
This is the same as the native platforms
.Xr uname 1
.Fl p
output.
It defines the CPU instruction family supported.
It may also encode a variation in the byte ordering of multi-byte
integers (endian).
It may also encode a variation in the size of the integer or pointer.
It may also encode a ISA revision.
It may also encode hard versus soft floating point ABI and usage.
It may also encode a variant ABI when there other factors don't
uniquely define the ABI (eg, MIPS' n32 ABI).
It, along with
.Dv MACHINE, define the ABI used by the system.
For example, the MIPS CPU processor family supports 9 different
combinations encoding pointer size, endian and hard vs soft float (for
8 combinations) as well as N32 (which only ever had one variation of
all these).
Generally, the plain CPU name specifies the most common (or at least
first) variant of the CPU.
This is why mips and mips64 imply 'big endian' while 'arm' and 'armv7'
imply little endian.
If we ever were to support the so-called x32 ABI (using 32-bit
pointers on the amd64 architecture), it would most likely be encoded
as amd64-x32.
It is unfortunate that amd64 speifies the 64-bit evolution of the x86
platform (it matches the 'first rule') as everybody else uses x86_64.
There is no standard name for the processor: each OS selects its own
conventions.
.It Dv MACHINE_CPUARCH Represents the source location for a given
.Dv MACHINE_ARCH .
For example,
.Dv MACHINE_CPUARCH
is defined to be mips for all the flavors of mips that we support
since we support them all with a shared set of sources.
One might thing that it should be x86 for both amd64 and i386.
However, since we don't support these two architectures with the same
source base, that's not done despite it's logical appeal.
.It Dv CPUTYPE Sets the flavor of
.Dv MACHINE_ARCH
to build.
It is used to optimize the build for a specific CPU / core that the
binaries run on.
Generally, this doesn't change the ABI, though it can be a fine line
between optimization for specific cases.
.It Dv TARGET Used to set Dv MACHINE in the top level Makefile for cross building.
Unused outside of that scope.
It is not passed down to the rest of the build.
Makefiles outside of the top level shouldn't use it at all (though
some have their own private copy for hysterical raisons).
.It Dv TARGET_ARCH Used to set Dv MACHINE_ARCH by Fx's top level Makefile for cross building.
Like
.Dv TARGET , it is unused outside of that scope.
.El
.Sh SEE ALSO
.Xr src.conf 5 ,
.Xr build 7

View File

@ -82,7 +82,6 @@ by a system-wide configuration file (see
.Sh SEE ALSO
.Xr gethostbyname 3 ,
.Xr resolver 5 ,
.Xr mailaddr 7
.Sh HISTORY
.Nm Hostname
appeared in

View File

@ -1,158 +0,0 @@
.\" Copyright (c) 1983, 1987, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)mailaddr.7 8.1 (Berkeley) 6/16/93
.\" $FreeBSD$
.\"
.Dd June 16, 1993
.Dt MAILADDR 7
.Os
.Sh NAME
.Nm mailaddr
.Nd mail addressing description
.Sh DESCRIPTION
Mail addresses are based on the Internet protocol listed at the end of this
manual page.
These addresses are in the general format
.Pp
.Dl user@domain
.Pp
where a domain is a hierarchical dot separated list of subdomains.
For
example, a valid address is:
.Pp
.Dl eric@CS.Berkeley.EDU
.Pp
Unlike some other forms of addressing, domains do not imply any routing.
Thus, although this address is specified as an Internet address, it might
travel by an alternate route if that were more convenient or efficient.
For example, at Berkeley, the associated message would probably go directly
to CS over the Ethernet rather than going via the Berkeley Internet
gateway.
.Ss Abbreviation.
Under certain circumstances it may not be necessary to type the entire
domain name.
In general, anything following the first dot may be omitted
if it is the same as the domain from which you are sending the message.
For example, a user on ``calder.berkeley.edu'' could send to ``eric@CS''
without adding the ``berkeley.edu'' since it is the same on both sending
and receiving hosts.
.Ss Compatibility.
Certain old address formats are converted to the new format to provide
compatibility with the previous mail system.
In particular,
.Pp
.Dl user@host
.Pp
and
.Dl user@host.domain
.Pp
are allowed;
.Pp
.Dl host.domain!user
.Pp
is converted to
.Pp
.Dl user@host.domain
.Pp
and
.Pp
.Dl host!user
.Pp
is converted to
.Pp
.Dl user@host.UUCP
.Pp
This is normally converted back to the ``host!user'' form before being sent
on for compatibility with older UUCP hosts.
.Ss Case Distinctions.
Domain names (i.e., anything after the ``@'' sign) may be given in any mixture
of upper and lower case with the exception of UUCP hostnames.
Most hosts
accept any combination of case in user names, with the notable exception of
MULTICS sites.
.Ss Route-addrs.
Under some circumstances it may be necessary to route a message through
several hosts to get it to the final destination.
Normally this routing
is done automatically, but sometimes it is desirable to route the message
manually.
Addresses which show these relays are termed ``route-addrs.''
These use the syntax:
.Pp
.Dl <@hosta,@hostb:user@hostc>
.Pp
This specifies that the message should be sent to hosta, from there to hostb,
and finally to hostc.
This path is forced even if there is a more efficient
path to hostc.
.Pp
Route-addrs occur frequently on return addresses, since these are generally
augmented by the software at each host.
It is generally possible to ignore
all but the ``user@hostc'' part of the address to determine the actual
sender.
.Pp
[Note: the route-addr syntax is officially deprecated
in RFC 1123 and should not be used.]
.Pp
Many sites also support the ``percent hack'' for simplistic routing:
.Pp
.Dl user%hostc%hostb@hosta
.Pp
is routed as indicated in the previous example.
.Ss Postmaster.
Every site is required to have a user or user alias designated ``postmaster''
to which problems with the mail system may be addressed.
.Ss Other Networks.
Some other networks can be reached by giving the name of the network as the
last component of the domain.
.Em This is not a standard feature
and may
not be supported at all sites.
For example, messages to CSNET or BITNET sites
can often be sent to ``user@host.CSNET'' or ``user@host.BITNET'' respectively.
.Sh SEE ALSO
.Xr mail 1 ,
.Xr sendmail 8
.Rs
.%A Crocker, D. H.
.%T Standard for the Format of Arpa Internet Text Messages
.%O RFC822
.Re
.Sh HISTORY
.Nm Mailaddr
appeared in
.Bx 4.2 .
.Sh BUGS
The RFC822 group syntax (``group:user1,user2,user3;'') is not supported
except in the special case of ``group:;'' because of a conflict with old
berknet-style addresses.
.Pp
Route-Address syntax is grotty.
.Pp
UUCP- and Internet-style addresses do not coexist politely.

View File

@ -124,7 +124,7 @@ the
.Nm
machine, which may not be what you want to have happen.
.Bd -literal -offset indent
cd /usr/src/sys/boot/i386
cd /usr/src/stand/i386
make clean; make; make install
cp /boot/pxeboot /tftpdir/
.Ed

View File

@ -6,7 +6,7 @@
.PATH: ${.CURDIR}/../../sys/dev/usb
FILES= ascii birthtoken bsd-family-tree committers-doc.dot committers-ports.dot \
committers-src.dot eqnchar flowers init.ee \
committers-src.dot flowers init.ee \
iso3166 iso639 latin1 mdoc.template operator pci_vendors \
scsi_modes \
organization.dot

View File

@ -1,90 +0,0 @@
.EQ
tdefine ciplus % "\o'\(pl\(ci'" %
ndefine ciplus % O+ %
tdefine citimes % "\o'\(mu\(ci'" %
ndefine citimes % Ox %
tdefine =wig % "\(eq\h'-\w'\(eq'u-\w'\s-2\(ap'u/2u'\v'-.4m'\s-2\z\(ap\(ap\s+2\v'.4m'\h'\w'\(eq'u-\w'\s-2\(ap'u/2u'" %
ndefine =wig % ="~" %
tdefine bigstar % "\o'\(pl\(mu'" %
ndefine bigstar % X|- %
tdefine =dot % "\z\(eq\v'-.6m'\h'.2m'\s+2.\s-2\v'.6m'\h'.1m'" %
ndefine =dot % = dot %
tdefine orsign % "\s-2\v'-.15m'\z\e\e\h'-.05m'\z\(sl\(sl\v'.15m'\s+2" %
ndefine orsign % \e/ %
tdefine andsign % "\s-2\v'-.15m'\z\(sl\(sl\h'-.05m'\z\e\e\v'.15m'\s+2" %
ndefine andsign % /\e %
tdefine =del % "\v'.3m'\z=\v'-.6m'\h'.3m'\s-1\(*D\s+1\v'.3m'" %
ndefine =del % = to DELTA %
tdefine oppA % "\s-2\v'-.15m'\z\e\e\h'-.05m'\z\(sl\(sl\v'-.15m'\h'-.75m'\z-\z-\h'.2m'\z-\z-\v'.3m'\h'.4m'\s+2" %
ndefine oppA % V- %
tdefine oppE %"\s-3\v'.2m'\z\(em\v'-.5m'\z\(em\v'-.5m'\z\(em\v'.55m'\h'.9m'\z\(br\z\(br\v'.25m'\s+3" %
ndefine oppE % E/ %
tdefine incl % "\s-1\z\(or\h'-.1m'\v'-.45m'\z\(em\v'.7m'\z\(em\v'.2m'\(em\v'-.45m'\s+1" %
ndefine incl % C_ %
tdefine nomem % "\o'\(mo\(sl'" %
ndefine nomem % C-/ %
tdefine angstrom % "\fR\zA\v'-.3m'\h'.2m'\(de\v'.3m'\fP\h'.2m'" %
ndefine angstrom % A to o %
tdefine star %{ roman "\v'.5m'\s+3*\s-3\v'-.5m'"}%
ndefine star % * %
tdefine || % \(or\(or %
tdefine <wig % "\z<\v'.4m'\(ap\v'-.4m'" %
ndefine <wig %{ < from "~" }%
tdefine >wig % "\z>\v'.4m'\(ap\v'-.4m'" %
ndefine >wig %{ > from "~" }%
tdefine langle % "\s-3\b'\(sl\e'\s0" %
ndefine langle %<%
tdefine rangle % "\s-3\b'\e\(sl'\s0" %
ndefine rangle %>%
tdefine hbar % "\zh\v'-.6m'\h'.05m'\(ru\v'.6m'" %
ndefine hbar % h\u-\d %
ndefine ppd % _| %
tdefine ppd % "\o'\(ru\s-2\(or\s+2'" %
tdefine <-> % "\o'\(<-\(->'" %
ndefine <-> % "<-->" %
tdefine <=> % "\s-2\z<\v'.05m'\h'.2m'\z=\h'.55m'=\h'-.6m'\v'-.05m'>\s+2" %
ndefine <=> % "<=>" %
tdefine |< % "\o'<\(or'" %
ndefine |< % <| %
tdefine |> % "\o'>\(or'" %
ndefine |> % |> %
tdefine ang % "\v'-.15m'\z\s-2\(sl\s+2\v'.15m'\(ru" %
ndefine ang % /_ %
tdefine rang % "\z\(or\h'.15m'\(ru" %
ndefine rang % L %
tdefine 3dot % "\v'-.8m'\z.\v'.5m'\z.\v'.5m'.\v'-.2m'" %
ndefine 3dot % .\u.\u.\d\d %
tdefine thf % ".\v'-.5m'.\v'.5m'." %
ndefine thf % ..\u.\d %
tdefine quarter % roman \(14 %
ndefine quarter % 1/4 %
tdefine 3quarter % roman \(34 %
ndefine 3quarter % 3/4 %
tdefine degree % \(de %
ndefine degree % nothing sup o %
tdefine square % \(sq %
ndefine square % [] %
tdefine circle % \(ci %
ndefine circle % O %
tdefine blot % "\fB\(sq\fP" %
ndefine blot % HIX %
tdefine bullet % \(bu %
ndefine bullet % oxe %
tdefine -wig % "\(~=" %
ndefine -wig % - to "~" %
tdefine wig % \(ap %
ndefine wig % "~" %
tdefine prop % \(pt %
ndefine prop % oc %
tdefine empty % \(es %
ndefine empty % O/ %
tdefine member % \(mo %
ndefine member % C- %
tdefine cup % \(cu %
ndefine cup % U %
define cap % \(ca %
define subset % \(sb %
define supset % \(sp %
define !subset % \(ib %
define !supset % \(ip %
.EN

File diff suppressed because it is too large Load Diff

View File

@ -122,7 +122,11 @@ ${OUTPUTS}: ${CONF}
${CRUNCHGEN} -fq -m ${OUTMK} -c ${OUTC} ${CONF}
# Avoid redundantly calling 'make objs' which we've done by our
# own dependencies.
sed -i '' -e "s/^\(${PROG}:.*\) \$$(SUBMAKE_TARGETS)/\1/" ${OUTMK}
# Also avoid unneeded 'make depend' call.
sed -i '' \
-e "s/^\(${PROG}:.*\) \$$(SUBMAKE_TARGETS)/\1/" \
-e '/$$(CRUNCHMAKE) $$(BUILDOPTS).* \<depend\> &&.*/d' \
${OUTMK}
# These 2 targets cannot use .MAKE since they depend on the generated
# ${OUTMK} above.
@ -154,14 +158,18 @@ build-tools: build-tools-${_tool}
# Yes, this does seem to partly duplicate bsd.subdir.mk, but I can't
# get that to cooperate with bsd.prog.mk. Besides, many of the standard
# targets should NOT be propagated into the components.
.for __target in clean cleandepend cleandir obj objlink
.if ${MK_AUTO_OBJ} == "no"
_obj= obj
.endif
.for __target in clean cleandepend cleandir ${_obj} objlink
.for D in ${CRUNCH_SRCDIRS}
.for P in ${CRUNCH_PROGS_${D}}
${__target}_crunchdir_${P}: .PHONY .MAKE
${_+_}cd ${CRUNCH_SRCDIR_${P}} && \
${CRUNCHENV} MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
${CRUNCHARGS} \
DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${__target}
DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} \
${CRUNCH_BUILDOPTS_${P}} ${__target}
${__target}: ${__target}_crunchdir_${P}
.endfor
.endfor

View File

@ -182,7 +182,7 @@ DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
.if !empty(DEPENDSRCS)
DEPENDOBJS+= ${DEPENDSRCS:${OBJS_SRCS_FILTER:ts:}:S,$,.o,}
.endif
DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
DEPENDFILES+= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
.if defined(_SKIP_DEPEND)
# Don't bother statting any .meta files for .depend*
${DEPENDOBJS}: .NOMETA
@ -190,7 +190,7 @@ ${DEPENDFILE}: .NOMETA
# Unset these to avoid looping/statting on them later.
.undef DEPENDSRCS
.undef DEPENDOBJS
.undef DEPENDFILES_OBJS
.undef DEPENDFILES
.endif # defined(_SKIP_DEPEND)
DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
DEPEND_CFLAGS+= -MT${.TARGET}
@ -201,7 +201,7 @@ DEPEND_CFLAGS+= -MT${.TARGET}
DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:${DEPEND_FILTER}:M${.TARGET:${DEPEND_FILTER}}}" != ""
CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
.endif
.for __depend_obj in ${DEPENDFILES_OBJS}
.for __depend_obj in ${DEPENDFILES}
.if ${MAKE_VERSION} < 20160220
.sinclude "${.OBJDIR}/${__depend_obj}"
.else
@ -273,7 +273,7 @@ beforebuild: depend
depend: beforedepend ${DEPENDFILE} afterdepend
# Tell bmake not to look for generated files via .PATH
.NOPATH: ${DEPENDFILE} ${DEPENDFILES_OBJS}
.NOPATH: ${DEPENDFILE} ${DEPENDFILES}
DPSRCS+= ${SRCS}
# A .depend file will only be generated if there are commands in

View File

@ -38,6 +38,7 @@ LIBCAP_GRP?= ${LIBDESTDIR}${LIBDIR_BASE}/libcap_grp.a
LIBCAP_PWD?= ${LIBDESTDIR}${LIBDIR_BASE}/libcap_pwd.a
LIBCAP_RANDOM?= ${LIBDESTDIR}${LIBDIR_BASE}/libcap_random.a
LIBCAP_SYSCTL?= ${LIBDESTDIR}${LIBDIR_BASE}/libcap_sysctl.a
LIBCAP_SYSLOG?= ${LIBDESTDIR}${LIBDIR_BASE}/libcap_syslog.a
LIBCASPER?= ${LIBDESTDIR}${LIBDIR_BASE}/libcasper.a
LIBCOMPAT?= ${LIBDESTDIR}${LIBDIR_BASE}/libcompat.a
LIBCOMPILER_RT?=${LIBDESTDIR}${LIBDIR_BASE}/libcompiler_rt.a

View File

@ -78,6 +78,7 @@ _LIBRARIES= \
cap_pwd \
cap_random \
cap_sysctl \
cap_syslog \
com_err \
compiler_rt \
crypt \
@ -237,6 +238,7 @@ _DP_cap_grp= nv
_DP_cap_pwd= nv
_DP_cap_random= nv
_DP_cap_sysctl= nv
_DP_cap_syslog= nv
_DP_pjdlog= util
_DP_opie= md
_DP_usb= pthread
@ -534,6 +536,7 @@ LIBCAP_GRPDIR= ${OBJTOP}/lib/libcasper/services/cap_grp
LIBCAP_PWDDIR= ${OBJTOP}/lib/libcasper/services/cap_pwd
LIBCAP_RANDOMDIR= ${OBJTOP}/lib/libcasper/services/cap_random
LIBCAP_SYSCTLDIR= ${OBJTOP}/lib/libcasper/services/cap_sysctl
LIBCAP_SYSLOGDIR= ${OBJTOP}/lib/libcasper/services/cap_syslog
LIBBSDXMLDIR= ${OBJTOP}/lib/libexpat
LIBKVMDIR= ${OBJTOP}/lib/libkvm
LIBPTHREADDIR= ${OBJTOP}/lib/libthr

View File

@ -119,6 +119,7 @@ __DEFAULT_YES_OPTIONS = \
LIB32 \
LIBPTHREAD \
LIBTHR \
LOADER_GELI \
LOCALES \
LOCATE \
LPR \
@ -180,6 +181,7 @@ __DEFAULT_NO_OPTIONS = \
GNU_GREP_COMPAT \
HESIOD \
LIBSOFT \
LOADER_FIREWIRE \
LOADER_FORCE_LE \
NAND \
OFED \

View File

@ -26,7 +26,7 @@ _default_makeobjdir= $${.CURDIR:S,^$${SRCTOP},$${OBJTOP},}
.include <bsd.mkopt.mk>
.if ${.MAKE.LEVEL} == 0 || empty(OBJROOT)
.if ${MK_UNIFIED_OBJDIR} == "no"
.if ${MK_UNIFIED_OBJDIR} == "no" && ${MK_DIRDEPS_BUILD} == "no"
# Fall back to historical behavior.
# We always want to set a default MAKEOBJDIRPREFIX...
MAKEOBJDIRPREFIX?= ${_default_makeobjdirprefix}
@ -70,22 +70,32 @@ OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T}
.export OBJROOT SRCTOP
.endif
.if ${MK_DIRDEPS_BUILD} == "no"
.if empty(OBJTOP)
# SRCTOP == OBJROOT only happens with clever MAKEOBJDIRPREFIX=/. Don't
# append TARGET.TARGET_ARCH for that case since the user wants to build
# in the source tree.
.if ${MK_UNIFIED_OBJDIR} == "yes" && ${SRCTOP} != ${OBJROOT:tA}
OBJTOP:= ${OBJROOT}${TARGET:D${TARGET}.${TARGET_ARCH}:U${MACHINE}.${MACHINE_ARCH}}
.if defined(TARGET) && defined(TARGET_ARCH)
OBJTOP:= ${OBJROOT}${TARGET}.${TARGET_ARCH}
.elif defined(TARGET) && ${.CURDIR} == ${SRCTOP}
# Not enough information, just use basic OBJDIR. This can happen with some
# 'make universe' targets or if TARGET is not being used as expected.
OBJTOP:= ${OBJROOT:H}
.else
OBJTOP:= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}
.endif
.else
# TARGET.TARGET_ARCH handled in OBJROOT already.
OBJTOP:= ${OBJROOT:H}
.endif # ${MK_UNIFIED_OBJDIR} == "yes"
.endif # empty(OBJTOP)
# Fixup OBJROOT/OBJTOP if using MAKEOBJDIRPREFIX but leave it alone
# for DIRDEPS_BUILD which really wants to know the absolute top at
# all times. This intenionally comes after adding TARGET.TARGET_ARCH
# so that is truncated away for nested objdirs. This logic also
# will not trigger if the OBJROOT block above unsets MAKEOBJDIRPREFIX.
.if !empty(MAKEOBJDIRPREFIX) && ${MK_DIRDEPS_BUILD} == "no"
# Fixup OBJROOT/OBJTOP if using MAKEOBJDIRPREFIX.
# This intenionally comes after adding TARGET.TARGET_ARCH so that is truncated
# away for nested objdirs. This logic also will not trigger if the OBJROOT
# block above unsets MAKEOBJDIRPREFIX.
.if !empty(MAKEOBJDIRPREFIX)
OBJTOP:= ${MAKEOBJDIRPREFIX}${SRCTOP}
OBJROOT:= ${OBJTOP}/
.endif
@ -100,7 +110,12 @@ OBJROOT:= ${OBJTOP}/
# __objdir is the expected .OBJDIR we want to use and that auto.obj.mk will
# try to create.
.if !empty(MAKEOBJDIRPREFIX)
.if ${.CURDIR:M${MAKEOBJDIRPREFIX}/*} != ""
# we are already in obj tree!
__objdir= ${.CURDIR}
.else
__objdir:= ${MAKEOBJDIRPREFIX}${.CURDIR}
.endif
.elif !empty(MAKEOBJDIR)
__objdir:= ${MAKEOBJDIR}
.endif
@ -196,3 +211,5 @@ OBJROOT= ${SRCTOP}/
.OBJDIR: ${.CURDIR}
.endif
.endif # defined(NO_OBJ)
.endif # ${MK_DIRDEPS_BUILD} == "no"

View File

@ -118,7 +118,7 @@ NO_META_IGNORE_HOST_HEADERS= 1
# 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
# is not expected.
.if !make(showconfig) && !make(print-dir)
.if !make(showconfig) && !make(print-dir) && empty(.MAKEFLAGS:M-[nN])
.sinclude <auto.obj.mk>
.endif
.endif # ${MK_AUTO_OBJ} == "yes"
@ -243,7 +243,7 @@ LFLAGS ?=
# compiler driver flags (e.g. -mabi=*) that conflict with flags to LD.
LD ?= ld
LDFLAGS ?=
_LDFLAGS = ${LDFLAGS:S/-Wl,//g:N-mabi=*}
_LDFLAGS = ${LDFLAGS:S/-Wl,//g:N-mabi=*:N-fuse-ld=*}
LINT ?= lint
LINTFLAGS ?= -cghapbx

View File

@ -1,7 +1,9 @@
# $FreeBSD$
SUBDIR+= libsa32
.if ${MK_ZFS} != "no"
SUBDIR+= zfs zfs32
.endif
.if ${MK_FORTH} != "no"
SUBDIR+= ficl32
.endif

View File

@ -1,9 +1,10 @@
# $FreeBSD$
SUBDIR+= libsa32
.if ${LOADER_GELI_SUPPORT:Uyes} == "yes"
SUBDIR+= geli
.endif
.if ${MK_ZFS} != "no"
SUBDIR+= zfs
.endif
SUBDIR+= efi

View File

@ -1,4 +1,6 @@
# $FreeBSD$
SUBDIR+= ofw
.if ${MK_ZFS} != "no"
SUBDIR+= zfs
.endif

View File

@ -9,11 +9,10 @@ LOADER_NFS_SUPPORT?= yes
LOADER_TFTP_SUPPORT?= no
LOADER_GZIP_SUPPORT?= no
LOADER_BZIP2_SUPPORT?= no
LOADER_FDT_SUPPORT= ${MK_FDT}
.include <bsd.init.mk>
FILES= ubldr ubldr.bin
FILES+= ubldr ubldr.bin
NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH}
INSTALLFLAGS= -b
@ -29,11 +28,10 @@ SRCS= start.S conf.c self_reloc.c vers.c
CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized
.endif
HELP_FILES+= help.uboot ${BOOTSRC}/fdt/help.fdt
# Always add MI sources
.include "${BOOTSRC}/loader.mk"
CFLAGS+= -I.
CLEANFILES+= loader.help
CFLAGS+= -ffreestanding -msoft-float
@ -50,10 +48,6 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
loader.help: help.common help.uboot ${BOOTSRC}/fdt/help.fdt
cat ${.ALLSRC} | \
awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}
ldscript.abs:
echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET}
@ -73,15 +67,4 @@ ubldr.bin: ubldr.pie
CLEANFILES+= ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin
.if !defined(LOADER_ONLY)
.PATH: ${BOOTSRC}/forth
.include "${BOOTSRC}/forth/Makefile.inc"
# Install loader.rc.
FILES+= loader.rc
# Put sample menu.rc on disk but don't enable it by default.
FILES+= menu.rc
FILESNAME_menu.rc= menu.rc.sample
.endif
.include <bsd.prog.mk>

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