Date: Mon, 12 May 2014 17:44:23 +0000 (UTC) From: Mark Murray <markm@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r265921 - in projects/random_number_generator: gnu/lib/libstdc++ gnu/lib/libsupc++ include share/man/man4 sys/arm/arm sys/conf sys/dev/ofw sys/dev/usb/controller sys/kern sys/modules/us... Message-ID: <201405121744.s4CHiNV5065068@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markm Date: Mon May 12 17:44:23 2014 New Revision: 265921 URL: http://svnweb.freebsd.org/changeset/base/265921 Log: MFC - tracking commit. Merging r265873 through r265920. Added: projects/random_number_generator/sys/dev/usb/controller/saf1761_dci.c - copied unchanged from r265920, head/sys/dev/usb/controller/saf1761_dci.c projects/random_number_generator/sys/dev/usb/controller/saf1761_dci.h - copied unchanged from r265920, head/sys/dev/usb/controller/saf1761_dci.h projects/random_number_generator/sys/dev/usb/controller/saf1761_dci_fdt.c - copied unchanged from r265920, head/sys/dev/usb/controller/saf1761_dci_fdt.c projects/random_number_generator/sys/dev/usb/controller/saf1761_dci_reg.h - copied unchanged from r265920, head/sys/dev/usb/controller/saf1761_dci_reg.h projects/random_number_generator/sys/modules/usb/saf1761/ - copied from r265920, head/sys/modules/usb/saf1761/ Modified: projects/random_number_generator/gnu/lib/libstdc++/Makefile projects/random_number_generator/gnu/lib/libsupc++/Makefile projects/random_number_generator/include/dirent.h projects/random_number_generator/include/grp.h projects/random_number_generator/include/setjmp.h projects/random_number_generator/include/signal.h projects/random_number_generator/include/stdio.h projects/random_number_generator/include/string.h projects/random_number_generator/include/termios.h projects/random_number_generator/include/unistd.h projects/random_number_generator/include/wchar.h projects/random_number_generator/share/man/man4/lm75.4 projects/random_number_generator/sys/arm/arm/machdep.c projects/random_number_generator/sys/conf/kern.opts.mk projects/random_number_generator/sys/dev/ofw/ofwbus.c projects/random_number_generator/sys/kern/kern_cpu.c projects/random_number_generator/sys/kern/uipc_syscalls.c projects/random_number_generator/sys/netinet/udp_usrreq.c projects/random_number_generator/sys/powerpc/powerpc/intr_machdep.c projects/random_number_generator/sys/powerpc/powerpc/mp_machdep.c projects/random_number_generator/sys/powerpc/ps3/ps3bus.c projects/random_number_generator/sys/powerpc/ps3/ps3pic.c projects/random_number_generator/sys/sys/stat.h projects/random_number_generator/sys/vm/vm_fault.c projects/random_number_generator/sys/vm/vm_map.c projects/random_number_generator/usr.bin/printf/printf.c projects/random_number_generator/usr.bin/stat/stat.1 projects/random_number_generator/usr.bin/stat/stat.c projects/random_number_generator/usr.bin/units/units.c Directory Properties: projects/random_number_generator/ (props changed) projects/random_number_generator/gnu/lib/ (props changed) projects/random_number_generator/include/ (props changed) projects/random_number_generator/share/man/man4/ (props changed) projects/random_number_generator/sys/ (props changed) projects/random_number_generator/sys/conf/ (props changed) Modified: projects/random_number_generator/gnu/lib/libstdc++/Makefile ============================================================================== --- projects/random_number_generator/gnu/lib/libstdc++/Makefile Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/gnu/lib/libstdc++/Makefile Mon May 12 17:44:23 2014 (r265921) @@ -632,9 +632,9 @@ ${VERSION_MAP}: ${SRCDIR}/config/abi/pre CLEANFILES+= ${VERSION_MAP} +CXXFLAGS.clang+= -stdlib=libstdc++ + .include <bsd.lib.mk> # Filter out libc++-specific flags, and -std= flags above c++98 or gnu++98. CXXFLAGS:= ${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]} - -CXXFLAGS.clang+= -stdlib=libstdc++ Modified: projects/random_number_generator/gnu/lib/libsupc++/Makefile ============================================================================== --- projects/random_number_generator/gnu/lib/libsupc++/Makefile Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/gnu/lib/libsupc++/Makefile Mon May 12 17:44:23 2014 (r265921) @@ -51,10 +51,9 @@ CLEANFILES+= unwind.h VERSION_MAP= ${.CURDIR}/Version.map +CXXFLAGS.clang+= -stdlib=libstdc++ .include <bsd.lib.mk> # Filter out libc++-specific flags, and -std= flags above c++98 or gnu++98. CXXFLAGS:= ${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]} - -CXXFLAGS.clang+= -stdlib=libstdc++ Modified: projects/random_number_generator/include/dirent.h ============================================================================== --- projects/random_number_generator/include/dirent.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/include/dirent.h Mon May 12 17:44:23 2014 (r265921) @@ -40,7 +40,7 @@ #include <sys/cdefs.h> #include <sys/dirent.h> -#if __BSD_VISIBLE || __XSI_VISIBLE +#if __XSI_VISIBLE /* * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer * to the specification. Modified: projects/random_number_generator/include/grp.h ============================================================================== --- projects/random_number_generator/include/grp.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/include/grp.h Mon May 12 17:44:23 2014 (r265921) @@ -61,7 +61,7 @@ struct group { }; __BEGIN_DECLS -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE void endgrent(void); struct group *getgrent(void); #endif @@ -74,11 +74,11 @@ int pwcache_groupdb(int (*)(int), void struct group * (*)(const char *), struct group * (*)(gid_t)); #endif -#if __BSD_VISIBLE || __XSI_VISIBLE +#if __XSI_VISIBLE /* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ int setgrent(void); #endif -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); int getgrnam_r(const char *, struct group *, char *, size_t, Modified: projects/random_number_generator/include/setjmp.h ============================================================================== --- projects/random_number_generator/include/setjmp.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/include/setjmp.h Mon May 12 17:44:23 2014 (r265921) @@ -44,7 +44,7 @@ #include <machine/setjmp.h> __BEGIN_DECLS -#if __BSD_VISIBLE || __XSI_VISIBLE >= 600 +#if __XSI_VISIBLE >= 600 void _longjmp(jmp_buf, int) __dead2; int _setjmp(jmp_buf) __returns_twice; #endif @@ -53,7 +53,7 @@ void longjmp(jmp_buf, int) __dead2; void longjmperror(void); #endif int setjmp(jmp_buf) __returns_twice; -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE +#if __POSIX_VISIBLE || __XSI_VISIBLE void siglongjmp(sigjmp_buf, int) __dead2; int sigsetjmp(sigjmp_buf, int) __returns_twice; #endif Modified: projects/random_number_generator/include/signal.h ============================================================================== --- projects/random_number_generator/include/signal.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/include/signal.h Mon May 12 17:44:23 2014 (r265921) @@ -108,7 +108,7 @@ int xsi_sigpause(int); int siginterrupt(int, int); #endif -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 void psignal(unsigned int, const char *); #endif Modified: projects/random_number_generator/include/stdio.h ============================================================================== --- projects/random_number_generator/include/stdio.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/include/stdio.h Mon May 12 17:44:23 2014 (r265921) @@ -47,7 +47,7 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +#if __POSIX_VISIBLE >= 200809 #ifndef _OFF_T_DECLARED #define _OFF_T_DECLARED typedef __off_t off_t; @@ -58,7 +58,7 @@ typedef __ssize_t ssize_t; #endif #endif -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #ifndef _VA_LIST_DECLARED typedef __va_list va_list; #define _VA_LIST_DECLARED @@ -290,7 +290,7 @@ int vsscanf(const char * __restrict, co /* * Functions defined in all versions of POSIX 1003.1. */ -#if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506 +#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) #define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ #endif @@ -342,7 +342,7 @@ int putw(int, FILE *); char *tempnam(const char *, const char *); #endif -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +#if __POSIX_VISIBLE >= 200809 FILE *fmemopen(void * __restrict, size_t, const char * __restrict); ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); @@ -387,7 +387,7 @@ ssize_t getline(char ** __restrict, siz int (dprintf)(int, const char * __restrict, ...); #endif -#endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 */ +#endif /* __POSIX_VISIBLE >= 200809 */ /* * Routines that are purely local. Modified: projects/random_number_generator/include/string.h ============================================================================== --- projects/random_number_generator/include/string.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/include/string.h Mon May 12 17:44:23 2014 (r265921) @@ -65,7 +65,7 @@ void *memmem(const void *, size_t, const #endif void *memmove(void *, const void *, size_t); void *memset(void *, int, size_t); -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 char *stpcpy(char * __restrict, const char * __restrict); char *stpncpy(char * __restrict, const char * __restrict, size_t); #endif @@ -99,7 +99,7 @@ void strmode(int, char *); char *strncat(char * __restrict, const char * __restrict, size_t); int strncmp(const char *, const char *, size_t) __pure; char *strncpy(char * __restrict, const char * __restrict, size_t); -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 char *strndup(const char *, size_t) __malloc_like; size_t strnlen(const char *, size_t) __pure; #endif @@ -111,7 +111,7 @@ char *strrchr(const char *, int) __pure; #if __BSD_VISIBLE char *strsep(char **, const char *); #endif -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 char *strsignal(int); #endif size_t strspn(const char *, const char *) __pure; Modified: projects/random_number_generator/include/termios.h ============================================================================== --- projects/random_number_generator/include/termios.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/include/termios.h Mon May 12 17:44:23 2014 (r265921) @@ -81,7 +81,7 @@ int tcflow(int, int); int tcflush(int, int); int tcsendbreak(int, int); -#if __POSIX_VISIBLE >= 200112 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200112 pid_t tcgetsid(int); #endif #if __BSD_VISIBLE Modified: projects/random_number_generator/include/unistd.h ============================================================================== --- projects/random_number_generator/include/unistd.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/include/unistd.h Mon May 12 17:44:23 2014 (r265921) @@ -426,7 +426,7 @@ int truncate(const char *, off_t); #endif #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 int faccessat(int, const char *, int, int); int fchownat(int, const char *, uid_t, gid_t, int); int fexecve(int, char *const [], char *const []); @@ -434,14 +434,14 @@ int linkat(int, const char *, int, const ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t); int symlinkat(const char *, int, const char *); int unlinkat(int, const char *, int); -#endif /* __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE */ +#endif /* __POSIX_VISIBLE >= 200809 */ /* * symlink() was originally in POSIX.1a, which was withdrawn after * being overtaken by events (1003.1-2001). It was in XPG4.2, and of * course has been in BSD since 4.2. */ -#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 int symlink(const char * __restrict, const char * __restrict); #endif Modified: projects/random_number_generator/include/wchar.h ============================================================================== --- projects/random_number_generator/include/wchar.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/include/wchar.h Mon May 12 17:44:23 2014 (r265921) @@ -204,7 +204,7 @@ int wcwidth(wchar_t); #define wcwidth(_c) __wcwidth(_c) #endif -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict); FILE *open_wmemstream(wchar_t **, size_t *); Modified: projects/random_number_generator/share/man/man4/lm75.4 ============================================================================== --- projects/random_number_generator/share/man/man4/lm75.4 Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/share/man/man4/lm75.4 Mon May 12 17:44:23 2014 (r265921) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 7, 2014 +.Dd May 11, 2014 .Dt LM75 4 .Os .Sh NAME @@ -69,28 +69,28 @@ dev.lm75.0.shutdown: 0 Is the read-only value of the current temperature read by the sensor. .It Va dev.lm75.%d.thyst Sets the hysteresis temperature. -Once the temperature get over the overtemperature shutdown value (tos) -it need to drop bellow the hysteresis temperature to disable the output +Once the temperature gets over the overtemperature shutdown value (tos) +it needs to drop below the hysteresis temperature to disable the output (interrupt) pin again. .It Va dev.lm75.%d.tos Sets the overtemperature shutdown value. -Once the temperature get over this value the output pin will be enabled. +Once the temperature gets over this value the output pin will be enabled. The way the output (interrupt) pin works, depends on the mode configuration. .It Va dev.lm75.%d.faults Is the number of faults that must occur consecutively to activate the interrupt (output) pin. It can be set to 1, 2, 4, and 6. .It Va dev.lm75.%d.mode -Set the operation mode for the sensor interrupt pin. +Sets the operation mode for the sensor interrupt pin. It can be set to 'comparator' (default) or 'interrupt'. .It Va dev.lm75.%d.polarity -Set the polarity of the sensor interrupt pin. +Sets the polarity of the sensor interrupt pin. It can be set to 'active-low' (default) or 'active-high'. Please note that the output pin is an open-drain output and it needs a proper pull-up resistor to work. .It Va dev.lm75.%d.shutdown -When set to '1' it shutdown the sensor. -The temperature convertion stops but the sensor remains with its i2c bus +When set to '1' it shuts down the sensor. +The temperature conversion stops but the sensor remains with its i2c bus active, i.e., it can be woken up by setting this option to '0' again. .El .Pp @@ -124,7 +124,7 @@ On a .Xr device.hints 5 based system, like .Li MIPS , -these values are configurable for the +these values are configurable for .Nm : .Bl -tag -width ".Va hint.lm75.%d.addr" .It Va hint.lm75.%d.at @@ -168,7 +168,7 @@ property indicates which i2c address the .Nm is wired at. .Nm -temperature sensors can be wired to 8 different address, allowing up to 8 +temperature sensors can be wired to 8 different addresses, allowing up to 8 sensors on the same .Xr iicbus 4 . .El @@ -187,5 +187,5 @@ driver first appeared in .An -nosplit The .Nm -driver and this manual page was written by -.An Luiz Otavio O Souza Aq loos@FreeBSD.org +driver and this manual page were written by +.An Luiz Otavio O Souza Aq loos@FreeBSD.org . Modified: projects/random_number_generator/sys/arm/arm/machdep.c ============================================================================== --- projects/random_number_generator/sys/arm/arm/machdep.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/arm/arm/machdep.c Mon May 12 17:44:23 2014 (r265921) @@ -424,24 +424,20 @@ void cpu_idle(int busy) { - CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", - busy, curcpu); + CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); + spinlock_enter(); #ifndef NO_EVENTTIMERS - if (!busy) { - critical_enter(); + if (!busy) cpu_idleclock(); - } #endif if (!sched_runnable()) cpu_sleep(0); #ifndef NO_EVENTTIMERS - if (!busy) { + if (!busy) cpu_activeclock(); - critical_exit(); - } #endif - CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", - busy, curcpu); + spinlock_exit(); + CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", busy, curcpu); } int Modified: projects/random_number_generator/sys/conf/kern.opts.mk ============================================================================== --- projects/random_number_generator/sys/conf/kern.opts.mk Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/conf/kern.opts.mk Mon May 12 17:44:23 2014 (r265921) @@ -21,4 +21,15 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ +# Kludge to allow a less painful transition. If MAKESYSPATH isn't defined, +# assume we have a standard FreeBSD src tree layout and reach over and grab +# bsd.mkopt.mk from there. If it is defined, trust it to point someplace sane +# and include bsd.mkopt.mk from there. We need the !defined case to keep ports +# kernel modules working (though arguably they should define MAKESYSPATH). We +# need the latter case to keep the Jenkins testing harness working where they +# specifically use a non-standard layout, but do define MAKESYSPATH correctly. +.if !defined(MAKESYSPATH) .include "../../share/mk/bsd.mkopt.mk" +.else +.include <bsd.mkopt.mk> +.endif Modified: projects/random_number_generator/sys/dev/ofw/ofwbus.c ============================================================================== --- projects/random_number_generator/sys/dev/ofw/ofwbus.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/dev/ofw/ofwbus.c Mon May 12 17:44:23 2014 (r265921) @@ -187,7 +187,7 @@ ofwbus_identify(driver_t *driver, device { /* Check if Open Firmware has been instantiated */ - if (OF_peer(0) == -1) + if (OF_peer(0) == 0) return; if (device_find_child(parent, "ofwbus", -1) == NULL) Copied: projects/random_number_generator/sys/dev/usb/controller/saf1761_dci.c (from r265920, head/sys/dev/usb/controller/saf1761_dci.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/random_number_generator/sys/dev/usb/controller/saf1761_dci.c Mon May 12 17:44:23 2014 (r265921, copy of r265920, head/sys/dev/usb/controller/saf1761_dci.c) @@ -0,0 +1,33 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <dev/usb/controller/saf1761_dci.h> +#include <dev/usb/controller/saf1761_dci_reg.h> Copied: projects/random_number_generator/sys/dev/usb/controller/saf1761_dci.h (from r265920, head/sys/dev/usb/controller/saf1761_dci.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/random_number_generator/sys/dev/usb/controller/saf1761_dci.h Mon May 12 17:44:23 2014 (r265921, copy of r265920, head/sys/dev/usb/controller/saf1761_dci.h) @@ -0,0 +1,36 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _SAF1761_DCI_H_ +#define _SAF1761_DCI_H_ + + +#endif /* _SAF1761_DCI_H_ */ Copied: projects/random_number_generator/sys/dev/usb/controller/saf1761_dci_fdt.c (from r265920, head/sys/dev/usb/controller/saf1761_dci_fdt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/random_number_generator/sys/dev/usb/controller/saf1761_dci_fdt.c Mon May 12 17:44:23 2014 (r265921, copy of r265920, head/sys/dev/usb/controller/saf1761_dci_fdt.c) @@ -0,0 +1,34 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <dev/usb/controller/saf1761_dci.h> +#include <dev/usb/controller/saf1761_dci_reg.h> + Copied: projects/random_number_generator/sys/dev/usb/controller/saf1761_dci_reg.h (from r265920, head/sys/dev/usb/controller/saf1761_dci_reg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/random_number_generator/sys/dev/usb/controller/saf1761_dci_reg.h Mon May 12 17:44:23 2014 (r265921, copy of r265920, head/sys/dev/usb/controller/saf1761_dci_reg.h) @@ -0,0 +1,156 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _SAF1761_DCI_REG_H_ +#define _SAF1761_DCI_REG_H_ + +/* Global registers */ + +#define SOTG_VEND_ID 0x370 +#define SOTG_PROD_ID 0x372 +#define SOTG_CTRL_SET 0x374 +#define SOTG_CTRL_CLR 0x376 +#define SOTG_CTRL_OTG_DISABLE (1 << 10) +#define SOTG_CTRL_OTG_SE0_EN (1 << 9) +#define SOTG_CTRL_BDIS_ACON_EN (1 << 8) +#define SOTG_CTRL_SW_SEL_HC_DC (1 << 7) +#define SOTG_CTRL_VBUS_CHRG (1 << 6) +#define SOTG_CTRL_VBUS_DISCHRG (1 << 5) +#define SOTG_CTRL_VBUS_DRV (1 << 4) +#define SOTG_CTRL_SEL_CP_EXT (1 << 3) +#define SOTG_CTRL_DM_PULL_DOWN (1 << 2) +#define SOTG_CTRL_DP_PULL_DOWN (1 << 1) +#define SOTG_CTRL_DP_PULL_UP (1 << 0) +#define SOTG_STATUS 0x378 +#define SOTG_STATUS_B_SE0_SRP (1 << 8) +#define SOTG_STATUS_B_SESS_END (1 << 7) +#define SOTG_STATUS_RMT_CONN (1 << 4) +#define SOTG_STATUS_ID (1 << 3) +#define SOTG_STATUS_DP_SRP (1 << 2) +#define SOTG_STATUS_A_B_SESS_VLD (1 << 1) +#define SOTG_STATUS_VBUS_VLD (1 << 0) +#define SOTG_IRQ_LATCH_SET 0x37C +#define SOTG_IRQ_LATCH_CLR 0x37E +#define SOTG_IRQ_ENABLE_SET 0x380 +#define SOTG_IRQ_ENABLE_CLR 0x382 +#define SOTG_IRQ_RISE_SET 0x384 +#define SOTG_IRQ_RISE_CLR 0x386 +#define SOTG_IRQ_OTG_TMR_TIMEOUT (1 << 9) +#define SOTG_IRQ_B_SE0_SRP (1 << 8) +#define SOTG_IRQ_B_SESS_END (1 << 7) +#define SOTG_IRQ_BDIS_ACON (1 << 6) +#define SOTG_IRQ_OTG_RESUME (1 << 5) +#define SOTG_IRQ_RMT_CONN (1 << 4) +#define SOTG_IRQ_ID (1 << 3) +#define SOTG_IRQ_DP_SRP (1 << 2) +#define SOTG_IRQ_A_B_SESS_VLD (1 << 1) +#define SOTG_IRQ_VBUS_VLD (1 << 0) +#define SOTG_TIMER_LOW_SET 0x388 +#define SOTG_TIMER_LOW_CLR 0x38A +#define SOTG_TIMER_HIGH_SET 0x38C +#define SOTG_TIMER_HIGH_CLR 0x38E +#define SOTG_TIMER_START_TMR (1U << 15) + +/* Peripheral controller specific registers */ + +#define SOTG_ADDRESS 0x200 +#define SOTG_ADDRESS_ENABLE (1 << 7) +#define SOTG_MODE 0x20C +#define SOTG_MODE_DMACLK_ON (1 << 9) +#define SOTG_MODE_VBUSSTAT (1 << 8) +#define SOTG_MODE_CLKAON (1 << 7) +#define SOTG_MODE_SNDRSU (1 << 6) +#define SOTG_MODE_GOSUSP (1 << 5) +#define SOTG_MODE_SFRESET (1 << 4) +#define SOTG_MODE_GLINTENA (1 << 3) +#define SOTG_MODE_WKUPCS (1 << 2) +#define SOTG_INTERRUPT_CFG 0x210 +#define SOTG_INTERRUPT_CFG_CDBGMOD (3 << 6) +#define SOTG_INTERRUPT_CFG_DDBGMODIN (3 << 4) +#define SOTG_INTERRUPT_CFG_DDBGMODOUT (3 << 2) +#define SOTG_INTERRUPT_CFG_INTLVL (1 << 1) +#define SOTG_INTERRUPT_CFG_INTPOL (1 << 0) +#define SOTG_DEBUG 0x212 +#define SOTG_DEBUG_SET (1 << 0) +#define SOTG_DCINTERRUPT_EN 0x214 +#define SOTG_HW_MODE_CTRL 0x300 +#define SOTG_OTG_CTRL 0x374 +#define SOTG_EP_INDEX 0x22c +#define SOTG_EP_INDEX_EP0SETUP (1 << 5) +#define SOTG_EP_INDEX_ENDP_INDEX (15 << 1) +#define SOTG_EP_INDEX_DIR_IN (1 << 0) +#define SOTG_CTRL_FUNC 0x228 +#define SOTG_CTRL_FUNC_CLBUF (1 << 4) +#define SOTG_CTRL_FUNC_VENDP (1 << 3) +#define SOTG_CTRL_FUNC_DSEN (1 << 2) +#define SOTG_CTRL_FUNC_STATUS (1 << 1) +#define SOTG_CTRL_FUNC_STALL (1 << 0) +#define SOTG_DATA_PORT 0x220 +#define SOTG_BUF_LENGTH 0x21C +#define SOTG_DCBUFFERSTATUS 0x21E +#define SOTG_EP_MAXPACKET 0x204 +#define SOTG_EP_TYPE 0x208 +#define SOTG_EP_TYPE_NOEMPPKT (1 << 4) +#define SOTG_EP_TYPE_ENABLE (1 << 3) +#define SOTG_EP_TYPE_DBLBUF (1 << 2) +#define SOTG_EP_TYPE_EP_TYPE (3 << 0) +#define SOTG_DMA_CMD 0x230 +#define SOTG_DMA_XFER_COUNT 0x234 +#define SOTG_DCDMA_CFG 0x238 +#define SOTG_DMA_HW 0x23C +#define SOTG_DMA_IRQ_REASON 0x250 +#define SOTG_DMA_IRQ_ENABLE 0x254 +#define SOTG_DMA_EP 0x258 +#define SOTG_BURST_COUNTER 0x264 +#define SOTG_DCINTERRUPT 0x218 +#define SOTG_DCINTERRUPT_IEPRX(n) (1 << (10 + (2*(n)))) +#define SOTG_DCINTERRUPT_IEPTX(n) (1 << (11 + (2*(n)))) +#define SOTG_DCINTERRUPT_IEP0SETUP (1 << 8) +#define SOTG_DCINTERRUPT_IEVBUS (1 << 7) +#define SOTG_DCINTERRUPT_IEDMA (1 << 6) +#define SOTG_DCINTERRUPT_IEHS_STA (1 << 5) +#define SOTG_DCINTERRUPT_IERESM (1 << 4) +#define SOTG_DCINTERRUPT_IESUSP (1 << 3) +#define SOTG_DCINTERRUPT_IEPSOF (1 << 2) +#define SOTG_DCINTERRUPT_IESOF (1 << 1) +#define SOTG_DCINTERRUPT_IEBRST (1 << 0) +#define SOTG_DCCHIP_ID 0x270 +#define SOTG_FRAME_NUM 0x274 +#define SOTG_FRAME_NUM_MICROSOFR 0x3800 +#define SOTG_FRAME_NUM_MICROSOFR_SHIFT 11 +#define SOTG_FRAME_NUM_SOFR 0x7FF +#define SOTG_DCSCRATCH 0x278 +#define SOTG_UNLOCK_DEVICE 0x27C +#define SOTG_UNLOCK_DEVICE_CODE 0xAA37 +#define SOTG_IRQ_PULSE_WIDTH 0x280 +#define SOTG_TEST_MODE 0x284 + +#endif /* _SAF1761_DCI_REG_H_ */ Modified: projects/random_number_generator/sys/kern/kern_cpu.c ============================================================================== --- projects/random_number_generator/sys/kern/kern_cpu.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/kern/kern_cpu.c Mon May 12 17:44:23 2014 (r265921) @@ -418,7 +418,7 @@ cf_get_method(device_t dev, struct cf_le struct cf_setting *curr_set, set; struct pcpu *pc; device_t *devs; - int count, error, i, n, numdevs; + int bdiff, count, diff, error, i, n, numdevs; uint64_t rate; sc = device_get_softc(dev); @@ -494,14 +494,15 @@ cf_get_method(device_t dev, struct cf_le } cpu_est_clockrate(pc->pc_cpuid, &rate); rate /= 1000000; + bdiff = 1 << 30; for (i = 0; i < count; i++) { - if (CPUFREQ_CMP(rate, levels[i].total_set.freq)) { + diff = abs(levels[i].total_set.freq - rate); + if (diff < bdiff) { + bdiff = diff; sc->curr_level = levels[i]; - CF_DEBUG("get estimated freq %d\n", curr_set->freq); - goto out; } } - error = ENXIO; + CF_DEBUG("get estimated freq %d\n", curr_set->freq); out: if (error == 0) Modified: projects/random_number_generator/sys/kern/uipc_syscalls.c ============================================================================== --- projects/random_number_generator/sys/kern/uipc_syscalls.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/kern/uipc_syscalls.c Mon May 12 17:44:23 2014 (r265921) @@ -414,14 +414,8 @@ accept1(td, s, uname, anamelen, flags) error = kern_accept4(td, s, &name, &namelen, flags, &fp); - /* - * return a namelen of zero for older code which might - * ignore the return value from accept. - */ - if (error != 0) { - (void) copyout(&namelen, anamelen, sizeof(*anamelen)); + if (error != 0) return (error); - } if (error == 0 && uname != NULL) { #ifdef COMPAT_OLDSOCK @@ -555,15 +549,8 @@ kern_accept4(struct thread *td, int s, s (void) fo_ioctl(nfp, FIOASYNC, &tmp, td->td_ucred, td); sa = 0; error = soaccept(so, &sa); - if (error != 0) { - /* - * return a namelen of zero for older code which might - * ignore the return value from accept. - */ - if (name) - *namelen = 0; + if (error != 0) goto noconnection; - } if (sa == NULL) { if (name) *namelen = 0; Modified: projects/random_number_generator/sys/netinet/udp_usrreq.c ============================================================================== --- projects/random_number_generator/sys/netinet/udp_usrreq.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/netinet/udp_usrreq.c Mon May 12 17:44:23 2014 (r265921) @@ -1370,13 +1370,17 @@ udp_output(struct inpcb *inp, struct mbu * Set up checksum and output datagram. */ ui->ui_sum = 0; - if (cscov_partial) { + if (pr == IPPROTO_UDPLITE) { if (inp->inp_flags & INP_ONESBCAST) faddr.s_addr = INADDR_BROADCAST; - if ((ui->ui_sum = in_cksum(m, sizeof(struct ip) + cscov)) == 0) - ui->ui_sum = 0xffff; - } else if (V_udp_cksum || pr == IPPROTO_UDPLITE) { - /* for UDP-Lite full checksum coverage is requested */ + if (cscov_partial) { + if ((ui->ui_sum = in_cksum(m, sizeof(struct ip) + cscov)) == 0) + ui->ui_sum = 0xffff; + } else { + if ((ui->ui_sum = in_cksum(m, sizeof(struct udpiphdr) + len)) == 0) + ui->ui_sum = 0xffff; + } + } else if (V_udp_cksum) { if (inp->inp_flags & INP_ONESBCAST) faddr.s_addr = INADDR_BROADCAST; ui->ui_sum = in_pseudo(ui->ui_src.s_addr, faddr.s_addr, Modified: projects/random_number_generator/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- projects/random_number_generator/sys/powerpc/powerpc/intr_machdep.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/powerpc/powerpc/intr_machdep.c Mon May 12 17:44:23 2014 (r265921) @@ -103,6 +103,7 @@ struct powerpc_intr { enum intr_trigger trig; enum intr_polarity pol; int fwcode; + int ipi; }; struct pic { @@ -203,6 +204,8 @@ intr_lookup(u_int irq) i->irq = irq; i->pic = NULL; i->vector = -1; + i->fwcode = 0; + i->ipi = 0; #ifdef SMP i->cpu = all_cpus; @@ -415,6 +418,15 @@ powerpc_enable_intr(void) printf("unable to setup IPI handler\n"); return (error); } + + /* + * Some subterfuge: disable late EOI and mark this + * as an IPI to the dispatch layer. + */ + i = intr_lookup(MAP_IRQ(piclist[n].node, + piclist[n].irqs)); + i->event->ie_post_filter = NULL; + i->ipi = 1; } } #endif @@ -568,6 +580,13 @@ powerpc_dispatch_intr(u_int vector, stru ie = i->event; KASSERT(ie != NULL, ("%s: interrupt without an event", __func__)); + /* + * IPIs are magical and need to be EOI'ed before filtering. + * This prevents races in IPI handling. + */ + if (i->ipi) + PIC_EOI(i->pic, i->intline); + if (intr_event_handle(ie, tf) != 0) { goto stray; } Modified: projects/random_number_generator/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- projects/random_number_generator/sys/powerpc/powerpc/mp_machdep.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/powerpc/powerpc/mp_machdep.c Mon May 12 17:44:23 2014 (r265921) @@ -336,6 +336,7 @@ ipi_send(struct pcpu *pc, int ipi) pc, pc->pc_cpuid, ipi); atomic_set_32(&pc->pc_ipimask, (1 << ipi)); + powerpc_sync(); PIC_IPI(root_pic, pc->pc_cpuid); CTR1(KTR_SMP, "%s: sent", __func__); Modified: projects/random_number_generator/sys/powerpc/ps3/ps3bus.c ============================================================================== --- projects/random_number_generator/sys/powerpc/ps3/ps3bus.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/powerpc/ps3/ps3bus.c Mon May 12 17:44:23 2014 (r265921) @@ -127,6 +127,7 @@ static device_method_t ps3bus_methods[] struct ps3bus_softc { struct rman sc_mem_rman; + struct rman sc_intr_rman; struct mem_region *regions; int rcount; }; @@ -328,7 +329,11 @@ ps3bus_attach(device_t self) sc = device_get_softc(self); sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "PS3Bus Memory Mapped I/O"; + sc->sc_intr_rman.rm_type = RMAN_ARRAY; + sc->sc_intr_rman.rm_descr = "PS3Bus Interrupts"; rman_init(&sc->sc_mem_rman); + rman_init(&sc->sc_intr_rman); + rman_manage_region(&sc->sc_intr_rman, 0, ~0); /* Get memory regions for DMA */ mem_regions(&sc->regions, &sc->rcount, &sc->regions, &sc->rcount); @@ -562,8 +567,13 @@ ps3bus_alloc_resource(device_t bus, devi rm = &sc->sc_mem_rman; break; case SYS_RES_IRQ: - return (resource_list_alloc(&dinfo->resources, bus, child, - type, rid, start, end, count, flags)); + rle = resource_list_find(&dinfo->resources, SYS_RES_IRQ, + *rid); + rm = &sc->sc_intr_rman; + adjstart = rle->start; + adjcount = ulmax(count, rle->count); + adjend = ulmax(rle->end, rle->start + adjcount - 1); + break; default: device_printf(bus, "unknown resource request from %s\n", device_get_nameunit(child)); Modified: projects/random_number_generator/sys/powerpc/ps3/ps3pic.c ============================================================================== --- projects/random_number_generator/sys/powerpc/ps3/ps3pic.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/powerpc/ps3/ps3pic.c Mon May 12 17:44:23 2014 (r265921) @@ -166,12 +166,13 @@ ps3pic_dispatch(device_t dev, struct tra sc = device_get_softc(dev); if (PCPU_GET(cpuid) == 0) { - bitmap = sc->bitmap_thread0[0]; + bitmap = atomic_readandclear_64(&sc->bitmap_thread0[0]); mask = sc->mask_thread0[0]; } else { - bitmap = sc->bitmap_thread1[0]; + bitmap = atomic_readandclear_64(&sc->bitmap_thread1[0]); mask = sc->mask_thread1[0]; } + powerpc_sync(); while ((irq = ffsl(bitmap & mask) - 1) != -1) { bitmap &= ~(1UL << irq); Modified: projects/random_number_generator/sys/sys/stat.h ============================================================================== --- projects/random_number_generator/sys/sys/stat.h Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/sys/stat.h Mon May 12 17:44:23 2014 (r265921) @@ -339,12 +339,12 @@ int mknod(const char *, mode_t, dev_t); #endif int stat(const char * __restrict, struct stat * __restrict); mode_t umask(mode_t); -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +#if __POSIX_VISIBLE >= 200809 int fstatat(int, const char *, struct stat *, int); int mkdirat(int, const char *, mode_t); int mkfifoat(int, const char *, mode_t); #endif -#if __BSD_VISIBLE || __XSI_VISIBLE >= 700 +#if __XSI_VISIBLE >= 700 int mknodat(int, const char *, mode_t, dev_t); #endif __END_DECLS Modified: projects/random_number_generator/sys/vm/vm_fault.c ============================================================================== --- projects/random_number_generator/sys/vm/vm_fault.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/vm/vm_fault.c Mon May 12 17:44:23 2014 (r265921) @@ -1359,6 +1359,7 @@ again: VM_OBJECT_WUNLOCK(dst_object); VM_OBJECT_RUNLOCK(object); VM_WAIT; + VM_OBJECT_WLOCK(dst_object); goto again; } } while (dst_m == NULL); Modified: projects/random_number_generator/sys/vm/vm_map.c ============================================================================== --- projects/random_number_generator/sys/vm/vm_map.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/sys/vm/vm_map.c Mon May 12 17:44:23 2014 (r265921) @@ -1978,10 +1978,17 @@ vm_map_protect(vm_map_t map, vm_offset_t else current->protection = new_prot; - if ((current->eflags & (MAP_ENTRY_COW | MAP_ENTRY_USER_WIRED)) - == (MAP_ENTRY_COW | MAP_ENTRY_USER_WIRED) && + /* + * For user wired map entries, the normal lazy evaluation of + * write access upgrades through soft page faults is + * undesirable. Instead, immediately copy any pages that are + * copy-on-write and enable write access in the physical map. + */ + if ((current->eflags & MAP_ENTRY_USER_WIRED) != 0 && (current->protection & VM_PROT_WRITE) != 0 && (old_prot & VM_PROT_WRITE) == 0) { + KASSERT(old_prot != VM_PROT_NONE, + ("vm_map_protect: inaccessible wired map entry")); vm_fault_copy_entry(map, map, current, current, NULL); } Modified: projects/random_number_generator/usr.bin/printf/printf.c ============================================================================== --- projects/random_number_generator/usr.bin/printf/printf.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/usr.bin/printf/printf.c Mon May 12 17:44:23 2014 (r265921) @@ -101,6 +101,8 @@ static void usage(void); static const char digits[] = "0123456789"; +static char end_fmt[1]; + static int myargc; static char **myargv; static char **gargv; @@ -171,11 +173,11 @@ main(int argc, char *argv[]) fmt += 2; } else { fmt = printf_doformat(fmt, &rval); - if (fmt == NULL) { + if (fmt == NULL || fmt == end_fmt) { #ifdef SHELL INTON; #endif - return (1); + return (fmt == NULL ? 1 : rval); } end = 0; } @@ -372,7 +374,7 @@ printf_doformat(char *fmt, int *rval) fputs(p, stdout); free(p); if (getout) - exit(*rval); + return (end_fmt); break; } case 'c': { Modified: projects/random_number_generator/usr.bin/stat/stat.1 ============================================================================== --- projects/random_number_generator/usr.bin/stat/stat.1 Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/usr.bin/stat/stat.1 Mon May 12 17:44:23 2014 (r265921) @@ -130,6 +130,7 @@ and use .Xr fhstat 2 instead of .Xr lstat 2 . +This requires root privileges. .It Fl L Use .Xr stat 2 Modified: projects/random_number_generator/usr.bin/stat/stat.c ============================================================================== --- projects/random_number_generator/usr.bin/stat/stat.c Mon May 12 16:10:14 2014 (r265920) +++ projects/random_number_generator/usr.bin/stat/stat.c Mon May 12 17:44:23 2014 (r265921) @@ -186,6 +186,7 @@ int format1(const struct stat *, /* stat char *, size_t, /* a place to put the output */ int, int, int, int, /* the parsed format */ int, int); +int hex2byte(const char [2]); #if HAVE_STRUCT_STAT_ST_FLAGS char *xfflagstostr(unsigned long); #endif @@ -214,7 +215,7 @@ main(int argc, char *argv[]) lsF = 0; fmtchar = '\0'; usestat = 0; - nfs_handle = 0; + nfs_handle = 0; nonl = 0; quiet = 0; linkfail = 0; @@ -327,32 +328,27 @@ main(int argc, char *argv[]) rc = fstat(STDIN_FILENO, &st); } else { int j; - char *inval; file = argv[0]; if (nfs_handle) { rc = 0; - bzero (&fhnd, sizeof fhnd); - j = MIN(2 * sizeof fhnd, strlen(file)); - if (j & 1) { + bzero(&fhnd, sizeof(fhnd)); + j = MIN(2 * sizeof(fhnd), strlen(file)); + if ((j & 1) != 0) { rc = -1; } else { while (j) { - ((char*) &fhnd)[j / 2 - 1] = - strtol(&file[j - 2], - &inval, 16); - if (inval != NULL) { - rc = -1; + rc = hex2byte(&file[j - 2]); + if (rc == -1) break; - } - argv[0][j - 2] = '\0'; + ((char*) &fhnd)[j / 2 - 1] = rc; j -= 2; } - if (!rc) - rc = fhstat(&fhnd, &st); - else - errno = EINVAL; } + if (rc == -1) + errno = EINVAL; + else + rc = fhstat(&fhnd, &st); } else if (usestat) { /* @@ -1091,3 +1087,12 @@ format1(const struct stat *st, return (snprintf(buf, blen, lfmt, data)); } + + +#define hex2nibble(c) (c <= '9' ? c - '0' : toupper(c) - 'A' + 10) +int +hex2byte(const char c[2]) { + if (!(ishexnumber(c[0]) && ishexnumber(c[1]))) + return -1; + return (hex2nibble(c[0]) << 4) + hex2nibble(c[1]); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405121744.s4CHiNV5065068>