CVS commit: xsrc/external/mit/xorg-server/dist/hw/sun
Module Name:xsrc Committed By: tsutsui Date: Thu Aug 13 05:12:35 UTC 2020 Modified Files: xsrc/external/mit/xorg-server/dist/hw/sun: sunIo.c sunKbd.c sunMouse.c Log Message: Avoid dumb DevicePtr casts. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c cvs rdiff -u -r1.1 -r1.2 xsrc/external/mit/xorg-server/dist/hw/sun/sunMouse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c:1.4 xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c:1.5 --- xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c:1.4 Tue Aug 11 06:49:09 2020 +++ xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c Thu Aug 13 05:12:35 2020 @@ -170,9 +170,10 @@ AbortDDX(enum ExitCode error) #else (void) OsSignal (SIGIO, SIG_IGN); #endif -devPtr = (DevicePtr)sunKeyboardDevice; -if (devPtr) +if (sunKeyboardDevice) { +devPtr = >public; (void) sunChangeKbdTranslation (((sunKbdPrivPtr)(devPtr->devicePrivate))->fd, FALSE); +} #if defined(SVR4) || defined(CSRG_BASED) sunNonBlockConsoleOff (); #else Index: xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c:1.6 xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c:1.7 --- xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c:1.6 Sat Aug 1 13:15:57 2020 +++ xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c Thu Aug 13 05:12:35 2020 @@ -613,7 +613,7 @@ sunInitKbdNames(XkbRMLVOSet *rmlvo, sunK int sunKbdProc(DeviceIntPtr device, int what) { -DevicePtr pKeyboard = (DevicePtr) device; +DevicePtr pKeyboard = >public; sunKbdPrivPtr pPriv; KeybdCtrl* ctrl = >kbdfeed->ctrl; XkbRMLVOSet rmlvo; @@ -623,7 +623,7 @@ sunKbdProc(DeviceIntPtr device, int what switch (what) { case DEVICE_INIT: - if (pKeyboard != (DevicePtr)sunKeyboardDevice) { + if (pKeyboard != >public) { ErrorF ("Cannot open non-system keyboard\n"); return (!Success); } Index: xsrc/external/mit/xorg-server/dist/hw/sun/sunMouse.c diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sunMouse.c:1.1 xsrc/external/mit/xorg-server/dist/hw/sun/sunMouse.c:1.2 --- xsrc/external/mit/xorg-server/dist/hw/sun/sunMouse.c:1.1 Wed Jul 22 20:38:29 2020 +++ xsrc/external/mit/xorg-server/dist/hw/sun/sunMouse.c Thu Aug 13 05:12:35 2020 @@ -123,7 +123,7 @@ sunMouseCtrl(DeviceIntPtr device, PtrCtr int sunMouseProc(DeviceIntPtr device, int what) { -DevicePtr pMouse = (DevicePtr) device; +DevicePtr pMouse = >public; int format; static int oformat; BYTE map[4]; @@ -132,7 +132,7 @@ sunMouseProc(DeviceIntPtr device, int wh switch (what) { case DEVICE_INIT: - if (pMouse != (DevicePtr)sunPointerDevice) { + if (pMouse != >public) { ErrorF ("Cannot open non-system mouse"); return !Success; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Aug 13 04:25:09 UTC 2020 Modified Files: src/usr.bin/make: buf.h Log Message: make(1): convert Buf_AddByte to inline function This lets the compiler decide whether to actually inline the code (which it does). It also provides better type safety and avoids a few underscores and parentheses in the code. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/buf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/buf.h diff -u src/usr.bin/make/buf.h:1.24 src/usr.bin/make/buf.h:1.25 --- src/usr.bin/make/buf.h:1.24 Thu Aug 13 04:12:13 2020 +++ src/usr.bin/make/buf.h Thu Aug 13 04:25:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.24 2020/08/13 04:12:13 rillig Exp $ */ +/* $NetBSD: buf.h,v 1.25 2020/08/13 04:25:09 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -93,22 +93,27 @@ typedef struct Buffer { #define __predict_false(x) (x) #endif -/* Buf_AddByte adds a single byte to a buffer. */ -#define Buf_AddByte(bp, byte) do { \ - size_t _count = ++(bp)->count; \ - char *_ptr; \ - if (__predict_false(_count >= (bp)->size)) \ - Buf_Expand_1(bp); \ - _ptr = (bp)->buffer + _count; \ - _ptr[-1] = (byte); \ - _ptr[0] = 0; \ -} while (0) - -#define BUF_ERROR 256 +void Buf_Expand_1(Buffer *); -#define Buf_Size(bp) ((bp)->count) +/* Buf_AddByte adds a single byte to a buffer. */ +static inline void +Buf_AddByte(Buffer *bp, char byte) +{ +size_t count = ++bp->count; +char *ptr; +if (__predict_false(count >= bp->size)) + Buf_Expand_1(bp); +ptr = bp->buffer + count; +ptr[-1] = byte; +ptr[0] = 0; +} + +static inline size_t +Buf_Size(const Buffer *bp) +{ +return bp->count; +} -void Buf_Expand_1(Buffer *); void Buf_AddBytes(Buffer *, const char *, size_t); void Buf_AddBytesBetween(Buffer *, const char *, const char *); void Buf_AddStr(Buffer *, const char *);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Aug 13 04:12:13 UTC 2020 Modified Files: src/usr.bin/make: buf.c buf.h var.c Log Message: make(1): remove type alias Byte = char This alias was only actually used in very few places, and changing it to unsigned char or any other type would not be possible without generating lots of compile-time errors. Therefore there was no abstraction, only unnecessary complexity. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/buf.c cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/buf.h cvs rdiff -u -r1.448 -r1.449 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/buf.c diff -u src/usr.bin/make/buf.c:1.34 src/usr.bin/make/buf.c:1.35 --- src/usr.bin/make/buf.c:1.34 Sun Aug 9 19:51:02 2020 +++ src/usr.bin/make/buf.c Thu Aug 13 04:12:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.34 2020/08/09 19:51:02 rillig Exp $ */ +/* $NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: buf.c,v 1.34 2020/08/09 19:51:02 rillig Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: buf.c,v 1.34 2020/08/09 19:51:02 rillig Exp $"); +__RCSID("$NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -104,10 +104,10 @@ Buf_Expand_1(Buffer *bp) /* Add the given bytes to the buffer. */ void -Buf_AddBytes(Buffer *bp, const Byte *bytesPtr, size_t numBytes) +Buf_AddBytes(Buffer *bp, const char *bytesPtr, size_t numBytes) { size_t count = bp->count; -Byte *ptr; +char *ptr; if (__predict_false(count + numBytes >= bp->size)) { bp->size += max(bp->size, numBytes + 16); @@ -159,7 +159,7 @@ Buf_AddInt(Buffer *bp, int n) * * Returns the pointer to the data and optionally the length of the * data in the buffer. */ -Byte * +char * Buf_GetAll(Buffer *bp, size_t *numBytesPtr) { if (numBytesPtr != NULL) @@ -192,10 +192,10 @@ Buf_Init(Buffer *bp, size_t size) /* Reset the buffer. * If freeData is TRUE, the data from the buffer is freed as well. * Otherwise it is kept and returned. */ -Byte * +char * Buf_Destroy(Buffer *buf, Boolean freeData) { -Byte *data = buf->buffer; +char *data = buf->buffer; if (freeData) { free(data); data = NULL; @@ -216,13 +216,13 @@ Buf_Destroy(Buffer *buf, Boolean freeDat * * If the buffer size is much greater than its content, * a new buffer will be allocated and the old one freed. */ -Byte * +char * Buf_DestroyCompact(Buffer *buf) { #if BUF_COMPACT_LIMIT > 0 if (buf->size - buf->count >= BUF_COMPACT_LIMIT) { /* We trust realloc to be smart */ - Byte *data = bmake_realloc(buf->buffer, buf->count + 1); + char *data = bmake_realloc(buf->buffer, buf->count + 1); data[buf->count] = 0; Buf_Destroy(buf, FALSE); return data; Index: src/usr.bin/make/buf.h diff -u src/usr.bin/make/buf.h:1.23 src/usr.bin/make/buf.h:1.24 --- src/usr.bin/make/buf.h:1.23 Sat Aug 8 18:54:04 2020 +++ src/usr.bin/make/buf.h Thu Aug 13 04:12:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.23 2020/08/08 18:54:04 rillig Exp $ */ +/* $NetBSD: buf.h,v 1.24 2020/08/13 04:12:13 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -74,7 +74,7 @@ /*- * buf.h -- - * Header for users of the buf library. + * Automatically growing null-terminated buffer of characters. */ #ifndef MAKE_BUF_H @@ -82,12 +82,10 @@ #include -typedef char Byte; - typedef struct Buffer { size_t size; /* Current size of the buffer */ size_t count; /* Number of bytes in buffer */ -Byte *buffer; /* The buffer itself (zero terminated) */ +char *buffer; /* The buffer itself (zero terminated) */ } Buffer; /* If we aren't on NetBSD, __predict_false() might not be defined. */ @@ -98,7 +96,7 @@ typedef struct Buffer { /* Buf_AddByte adds a single byte to a buffer. */ #define Buf_AddByte(bp, byte) do { \ size_t _count = ++(bp)->count; \ - Byte *_ptr; \ + char *_ptr; \ if (__predict_false(_count >= (bp)->size)) \ Buf_Expand_1(bp); \ _ptr = (bp)->buffer + _count; \ @@ -111,14 +109,14 @@ typedef struct Buffer { #define Buf_Size(bp) ((bp)->count) void Buf_Expand_1(Buffer *); -void Buf_AddBytes(Buffer *, const Byte *, size_t); -void Buf_AddBytesBetween(Buffer *, const Byte *, const Byte *); +void Buf_AddBytes(Buffer *, const char *, size_t); +void Buf_AddBytesBetween(Buffer *, const char *, const char *); void Buf_AddStr(Buffer *, const char *); void Buf_AddInt(Buffer *, int); -Byte *Buf_GetAll(Buffer *, size_t *); +char
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Aug 13 03:54:57 UTC 2020 Modified Files: src/usr.bin/make: hash.h job.h lst.h make.h metachar.h strlist.h Log Message: make(1): follow naming conventions for multiple-inclusion guards This avoids undefined behavior. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/hash.h cvs rdiff -u -r1.43 -r1.44 src/usr.bin/make/job.h cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/lst.h cvs rdiff -u -r1.115 -r1.116 src/usr.bin/make/make.h cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/metachar.h cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/strlist.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/hash.h diff -u src/usr.bin/make/hash.h:1.17 src/usr.bin/make/hash.h:1.18 --- src/usr.bin/make/hash.h:1.17 Thu Aug 6 17:22:15 2020 +++ src/usr.bin/make/hash.h Thu Aug 13 03:54:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.17 2020/08/06 17:22:15 rillig Exp $ */ +/* $NetBSD: hash.h,v 1.18 2020/08/13 03:54:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -78,8 +78,8 @@ * which maintains hash tables. */ -#ifndef _HASH_H -#define _HASH_H +#ifndef MAKE_HASH_H +#define MAKE_HASH_H /* * The following defines one entry in the hash table. @@ -143,4 +143,4 @@ Hash_Entry *Hash_EnumNext(Hash_Search *) void Hash_ForEach(Hash_Table *, void (*)(void *, void *), void *); void Hash_DebugStats(Hash_Table *, const char *); -#endif /* _HASH_H */ +#endif /* MAKE_HASH_H */ Index: src/usr.bin/make/job.h diff -u src/usr.bin/make/job.h:1.43 src/usr.bin/make/job.h:1.44 --- src/usr.bin/make/job.h:1.43 Fri Jul 3 08:13:23 2020 +++ src/usr.bin/make/job.h Thu Aug 13 03:54:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.h,v 1.43 2020/07/03 08:13:23 rillig Exp $ */ +/* $NetBSD: job.h,v 1.44 2020/08/13 03:54:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -77,8 +77,8 @@ * job.h -- * Definitions pertaining to the running of jobs in parallel mode. */ -#ifndef _JOB_H_ -#define _JOB_H_ +#ifndef MAKE_JOB_H +#define MAKE_JOB_H #define TMPPAT "makeXX" /* relative to tmpdir */ @@ -271,4 +271,4 @@ void Job_ServerStart(int, int, int); void Job_SetPrefix(void); Boolean Job_RunTarget(const char *, const char *); -#endif /* _JOB_H_ */ +#endif /* MAKE_JOB_H */ Index: src/usr.bin/make/lst.h diff -u src/usr.bin/make/lst.h:1.20 src/usr.bin/make/lst.h:1.21 --- src/usr.bin/make/lst.h:1.20 Sun Sep 7 20:55:34 2014 +++ src/usr.bin/make/lst.h Thu Aug 13 03:54:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.h,v 1.20 2014/09/07 20:55:34 joerg Exp $ */ +/* $NetBSD: lst.h,v 1.21 2020/08/13 03:54:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -77,8 +77,8 @@ * lst.h -- * Header for using the list library */ -#ifndef _LST_H_ -#define _LST_H_ +#ifndef MAKE_LST_H +#define MAKE_LST_H #include #include @@ -186,4 +186,4 @@ ReturnStatus Lst_EnQueue(Lst, void *); /* Remove an element from head of queue */ void *Lst_DeQueue(Lst); -#endif /* _LST_H_ */ +#endif /* MAKE_LST_H */ Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.115 src/usr.bin/make/make.h:1.116 --- src/usr.bin/make/make.h:1.115 Tue Aug 11 18:44:52 2020 +++ src/usr.bin/make/make.h Thu Aug 13 03:54:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.115 2020/08/11 18:44:52 rillig Exp $ */ +/* $NetBSD: make.h,v 1.116 2020/08/13 03:54:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -77,8 +77,8 @@ * The global definitions for pmake */ -#ifndef _MAKE_H_ -#define _MAKE_H_ +#ifndef MAKE_MAKE_H +#define MAKE_MAKE_H #include #include @@ -524,4 +524,4 @@ int cached_stat(const char *, void *); #define KILLPG(pid, sig) killpg((pid), (sig)) #endif -#endif /* _MAKE_H_ */ +#endif /* MAKE_MAKE_H */ Index: src/usr.bin/make/metachar.h diff -u src/usr.bin/make/metachar.h:1.4 src/usr.bin/make/metachar.h:1.5 --- src/usr.bin/make/metachar.h:1.4 Sun Jun 21 20:26:02 2015 +++ src/usr.bin/make/metachar.h Thu Aug 13 03:54:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: metachar.h,v 1.4 2015/06/21 20:26:02 christos Exp $ */ +/* $NetBSD: metachar.h,v 1.5 2020/08/13 03:54:57 rillig Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -28,8 +28,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _METACHAR_H -#define _METACHAR_H +#ifndef MAKE_METACHAR_H +#define MAKE_METACHAR_H #include @@ -58,4 +58,4 @@ needshell(const char *cmd, int white) return *cmd != '\0'; } -#endif /* _METACHAR_H */ +#endif /* MAKE_METACHAR_H */ Index: src/usr.bin/make/strlist.h diff -u src/usr.bin/make/strlist.h:1.3 src/usr.bin/make/strlist.h:1.4 --- src/usr.bin/make/strlist.h:1.3 Fri Jan 16 21:15:34 2009 +++
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Aug 13 03:33:56 UTC 2020 Modified Files: src/usr.bin/make: dir.c Log Message: make(1): clean up debug logging in dir.c In C90, the variadic macro argument __VA_ARGS__ is not known, therefore fall back to the forms listing the number of actual printf arguments. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/usr.bin/make/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.91 src/usr.bin/make/dir.c:1.92 --- src/usr.bin/make/dir.c:1.91 Thu Aug 13 03:07:49 2020 +++ src/usr.bin/make/dir.c Thu Aug 13 03:33:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.91 2020/08/13 03:07:49 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.92 2020/08/13 03:33:56 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.91 2020/08/13 03:07:49 rillig Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.92 2020/08/13 03:33:56 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.91 2020/08/13 03:07:49 rillig Exp $"); +__RCSID("$NetBSD: dir.c,v 1.92 2020/08/13 03:33:56 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -147,6 +147,17 @@ __RCSID("$NetBSD: dir.c,v 1.91 2020/08/1 #include "dir.h" #include "job.h" + +#define DIR_DEBUG0(fmt) \ +if (!DEBUG(DIR)) (void) 0; else fprintf(debug_file, fmt) + +#define DIR_DEBUG1(fmt, arg1) \ +if (!DEBUG(DIR)) (void) 0; else fprintf(debug_file, fmt, arg1) + +#define DIR_DEBUG2(fmt, arg1, arg2) \ +if (!DEBUG(DIR)) (void) 0; else fprintf(debug_file, fmt, arg1, arg2) + + /* * A search path consists of a Lst of Path structures. A Path structure * has in it the name of the directory and a hash table of all the files @@ -296,10 +307,8 @@ cached_stats(Hash_Table *htp, const char st->st_mode = cst->mode; st->st_mtime = (flags & CST_LSTAT) ? cst->lmtime : cst->mtime; if (st->st_mtime) { - if (DEBUG(DIR)) { - fprintf(debug_file, "Using cached time %s for %s\n", - Targ_FmtTime(st->st_mtime), pathname); - } + DIR_DEBUG2("Using cached time %s for %s\n", + Targ_FmtTime(st->st_mtime), pathname); return 0; } } @@ -324,10 +333,8 @@ cached_stats(Hash_Table *htp, const char cst->mtime = st->st_mtime; } cst->mode = st->st_mode; -if (DEBUG(DIR)) { - fprintf(debug_file, " Caching %s for %s\n", - Targ_FmtTime(st->st_mtime), pathname); -} +DIR_DEBUG2(" Caching %s for %s\n", + Targ_FmtTime(st->st_mtime), pathname); return 0; } @@ -814,20 +821,8 @@ DirExpandInt(const char *word, Lst path, } } -/*- - *--- - * DirPrintWord -- - * Print a word in the list of expansions. Callback for Dir_Expand - * when DEBUG(DIR), via Lst_ForEach. - * - * Results: - * === 0 - * - * Side Effects: - * The passed word is printed, followed by a space. - * - *--- - */ +/* Print a word in the list of expansions. + * Callback for Dir_Expand when DEBUG(DIR), via Lst_ForEach. */ static int DirPrintWord(void *word, void *dummy MAKE_ATTR_UNUSED) { @@ -862,9 +857,7 @@ Dir_Expand(const char *word, Lst path, L { const char *cp; -if (DEBUG(DIR)) { - fprintf(debug_file, "Expanding \"%s\"... ", word); -} +DIR_DEBUG1("Expanding \"%s\"... ", word); cp = strchr(word, '{'); if (cp) { @@ -891,13 +884,12 @@ Dir_Expand(const char *word, Lst path, L /* * Back up to the start of the component */ - char *dirpath; - while (cp > word && *cp != '/') { cp--; } if (cp != word) { char sc; + char *dirpath; /* * If the glob isn't in the first component, try and find * all the components up to the one with a wildcard. @@ -971,17 +963,13 @@ DirLookup(Path *p, const char *name MAKE { char *file; /* the current filename to check */ -if (DEBUG(DIR)) { - fprintf(debug_file, " %s ...\n", p->name); -} +DIR_DEBUG1(" %s ...\n", p->name); if (Hash_FindEntry(>files, cp) == NULL) return NULL; file = str_concat3(p->name, "/", cp); -if (DEBUG(DIR)) { - fprintf(debug_file, " returning %s\n", file); -} +DIR_DEBUG1(" returning %s\n", file); p->hits += 1; hits += 1; return file; @@ -1017,9 +1005,7 @@ DirLookupSubdir(Path *p, const char *nam file = bmake_strdup(name); } -if (DEBUG(DIR)) { - fprintf(debug_file, "checking %s ...\n", file); -} +DIR_DEBUG1("checking %s ...\n", file); if (cached_stat(file, ) == 0) { nearmisses += 1; @@ -1050,9 +1036,7 @@ DirLookupAbs(Path *p, const char *name,
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Aug 13 03:07:49 UTC 2020 Modified Files: src/usr.bin/make: dir.c Log Message: make(1): avoid negated conditions in DirExpandCurly To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/usr.bin/make/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.90 src/usr.bin/make/dir.c:1.91 --- src/usr.bin/make/dir.c:1.90 Thu Aug 13 03:00:44 2020 +++ src/usr.bin/make/dir.c Thu Aug 13 03:07:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.91 2020/08/13 03:07:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.91 2020/08/13 03:07:49 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $"); +__RCSID("$NetBSD: dir.c,v 1.91 2020/08/13 03:07:49 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -651,11 +651,15 @@ DirMatchFiles(const char *pattern, Path return 0; } +/* Find the next closing brace in the string, taking nested braces into + * account. */ static const char * closing_brace(const char *p) { int nest = 0; -while (*p != '\0' && !(*p == '}' && nest == 0)) { +while (*p != '\0') { +if (*p == '}' && nest == 0) + break; if (*p == '{') nest++; if (*p == '}') @@ -665,11 +669,15 @@ closing_brace(const char *p) return p; } +/* Find the next closing brace or comma in the string, taking nested braces + * into account. */ static const char * separator_comma(const char *p) { int nest = 0; -while (*p != '\0' && !((*p == '}' || *p == ',') && nest == 0)) { +while (*p != '\0') { +if ((*p == '}' || *p == ',') && nest == 0) + break; if (*p == '{') nest++; if (*p == '}')
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Aug 13 03:00:44 UTC 2020 Modified Files: src/usr.bin/make: dir.c Log Message: make(1): clean up DirExpandCurly Now that nested curly braces work as expected and are covered by unit tests, the debug log is no longer necessary. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/usr.bin/make/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.89 src/usr.bin/make/dir.c:1.90 --- src/usr.bin/make/dir.c:1.89 Thu Aug 13 02:53:15 2020 +++ src/usr.bin/make/dir.c Thu Aug 13 03:00:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.89 2020/08/13 02:53:15 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.89 2020/08/13 02:53:15 rillig Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.89 2020/08/13 02:53:15 rillig Exp $"); +__RCSID("$NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -732,22 +732,13 @@ concat3(const char *a, size_t a_len, con static void DirExpandCurly(const char *word, const char *brace, Lst path, Lst expansions) { -/* Split the word into prefix '{' middle '}' suffix. */ - -const char *middle = brace + 1; -const char *middle_end = closing_brace(middle); -size_t middle_len = (size_t)(middle_end - middle); -const char *prefix; -size_t prefix_len; -const char *suffix; -size_t suffix_len; -const char *piece; +const char *prefix, *middle, *piece, *middle_end, *suffix; +size_t prefix_len, suffix_len; -if (DEBUG(DIR)) { - fprintf(debug_file, "%s: word=\"%s\" middle=\"%.*s\"\n", - __func__, word, (int)middle_len, middle); -} +/* Split the word into prefix '{' middle '}' suffix. */ +middle = brace + 1; +middle_end = closing_brace(middle); if (*middle_end == '\0') { Error("Unterminated {} clause \"%s\"", middle); return; @@ -768,12 +759,6 @@ DirExpandCurly(const char *word, const c char *file = concat3(prefix, prefix_len, piece, piece_len, suffix, suffix_len); - if (DEBUG(DIR)) { - fprintf(debug_file, "%s: \"%.*s\" + \"%.*s\" + \"%s\" = \"%s\"\n", - __func__, (int)prefix_len, prefix, (int)piece_len, piece, - suffix, file); - } - if (contains_wildcard(file)) { Dir_Expand(file, path, expansions); free(file);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Aug 13 02:53:15 UTC 2020 Modified Files: src/usr.bin/make: dir.c Log Message: make(1): use enum instead of #define for cached_stats To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/usr.bin/make/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.88 src/usr.bin/make/dir.c:1.89 --- src/usr.bin/make/dir.c:1.88 Wed Aug 12 03:05:57 2020 +++ src/usr.bin/make/dir.c Thu Aug 13 02:53:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.88 2020/08/12 03:05:57 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.89 2020/08/13 02:53:15 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.88 2020/08/12 03:05:57 rillig Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.89 2020/08/13 02:53:15 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.88 2020/08/12 03:05:57 rillig Exp $"); +__RCSID("$NetBSD: dir.c,v 1.89 2020/08/13 02:53:15 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -259,7 +259,7 @@ static char *DirLookupAbs(Path *, const /* - * We use stat(2) a lot, cache the results + * We use stat(2) a lot, cache the results. * mtime and mode are all we care about. */ struct cache_st { @@ -269,11 +269,16 @@ struct cache_st { }; /* minimize changes below */ -#define CST_LSTAT 1 -#define CST_UPDATE 2 +typedef enum { +CST_LSTAT = 0x01, /* call lstat(2) instead of stat(2) */ +CST_UPDATE = 0x02 /* ignore existing cached entry */ +} CachedStatsFlags; +/* Returns 0 and the result of stat(2) or lstat(2) in *st, or -1 on error. + * Only st->st_mode and st->st_mtime are filled. */ static int -cached_stats(Hash_Table *htp, const char *pathname, struct stat *st, int flags) +cached_stats(Hash_Table *htp, const char *pathname, struct stat *st, + CachedStatsFlags flags) { Hash_Entry *entry; struct cache_st *cst; @@ -284,7 +289,7 @@ cached_stats(Hash_Table *htp, const char entry = Hash_FindEntry(htp, pathname); -if (entry && (flags & CST_UPDATE) == 0) { +if (entry && !(flags & CST_UPDATE)) { cst = entry->clientPtr; memset(st, 0, sizeof(*st)); @@ -313,7 +318,7 @@ cached_stats(Hash_Table *htp, const char memset(entry->clientPtr, 0, sizeof(*cst)); } cst = entry->clientPtr; -if ((flags & CST_LSTAT)) { +if (flags & CST_LSTAT) { cst->lmtime = st->st_mtime; } else { cst->mtime = st->st_mtime;
CVS commit: src/tools/gcc
Module Name:src Committed By: mrg Date: Thu Aug 13 01:52:37 UTC 2020 Modified Files: src/tools/gcc: mknative-gcc mknative-gcc.old Log Message: set _OUTDIRBASE depending on $0, and then set _OUTDIR based on this. now you can copy mknative-gcc to mknative-gcc.old without edit. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/tools/gcc/mknative-gcc cvs rdiff -u -r1.7 -r1.8 src/tools/gcc/mknative-gcc.old Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/gcc/mknative-gcc diff -u src/tools/gcc/mknative-gcc:1.104 src/tools/gcc/mknative-gcc:1.105 --- src/tools/gcc/mknative-gcc:1.104 Wed Aug 12 08:53:20 2020 +++ src/tools/gcc/mknative-gcc Thu Aug 13 01:52:37 2020 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mknative-gcc,v 1.104 2020/08/12 08:53:20 mrg Exp $ +# $NetBSD: mknative-gcc,v 1.105 2020/08/13 01:52:37 mrg Exp $ # # Shell script for generating all the constants needed for a native # platform build of gcc. @@ -24,8 +24,15 @@ fi . $_TOP/tools/gcc/mknative.common -_OUTDIR="$_TOP/external/gpl3/gcc" -_OUTDIRBASE="external/gpl3/gcc" +case $0 in + *mknative-gcc.old) + _OUTDIRBASE="external/gpl3/gcc.old" + ;; + *) + _OUTDIRBASE="external/gpl3/gcc" + ;; +esac +_OUTDIR="$_TOP/$_OUTDIRBASE" sanitise_includes () { sed \ Index: src/tools/gcc/mknative-gcc.old diff -u src/tools/gcc/mknative-gcc.old:1.7 src/tools/gcc/mknative-gcc.old:1.8 --- src/tools/gcc/mknative-gcc.old:1.7 Wed Aug 12 08:53:20 2020 +++ src/tools/gcc/mknative-gcc.old Thu Aug 13 01:52:37 2020 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mknative-gcc.old,v 1.7 2020/08/12 08:53:20 mrg Exp $ +# $NetBSD: mknative-gcc.old,v 1.8 2020/08/13 01:52:37 mrg Exp $ # # Shell script for generating all the constants needed for a native # platform build of gcc. @@ -24,8 +24,15 @@ fi . $_TOP/tools/gcc/mknative.common -_OUTDIR="$_TOP/external/gpl3/gcc" -_OUTDIRBASE="external/gpl3/gcc" +case $0 in + *mknative-gcc.old) + _OUTDIRBASE="external/gpl3/gcc.old" + ;; + *) + _OUTDIRBASE="external/gpl3/gcc" + ;; +esac +_OUTDIR="$_TOP/$_OUTDIRBASE" sanitise_includes () { sed \
CVS commit: src/usr.bin/tsort
Module Name:src Committed By: christos Date: Wed Aug 12 23:23:04 UTC 2020 Modified Files: src/usr.bin/tsort: Makefile tsort.1 tsort.c Log Message: - document -d - add -r (reverse) - const, size_t, emalloc, EXIT_FOO To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/tsort/Makefile cvs rdiff -u -r1.10 -r1.11 src/usr.bin/tsort/tsort.1 cvs rdiff -u -r1.23 -r1.24 src/usr.bin/tsort/tsort.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tsort/Makefile diff -u src/usr.bin/tsort/Makefile:1.7 src/usr.bin/tsort/Makefile:1.8 --- src/usr.bin/tsort/Makefile:1.7 Tue Apr 14 18:15:27 2009 +++ src/usr.bin/tsort/Makefile Wed Aug 12 19:23:04 2020 @@ -1,6 +1,9 @@ -# $NetBSD: Makefile,v 1.7 2009/04/14 22:15:27 lukem Exp $ +# $NetBSD: Makefile,v 1.8 2020/08/12 23:23:04 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 6/9/93 +WARNS= 6 PROG= tsort +LDADD+= -lutil +DPADD+= ${LIBUTIL} .include Index: src/usr.bin/tsort/tsort.1 diff -u src/usr.bin/tsort/tsort.1:1.10 src/usr.bin/tsort/tsort.1:1.11 --- src/usr.bin/tsort/tsort.1:1.10 Thu Aug 7 07:16:50 2003 +++ src/usr.bin/tsort/tsort.1 Wed Aug 12 19:23:04 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: tsort.1,v 1.10 2003/08/07 11:16:50 agc Exp $ +.\" $NetBSD: tsort.1,v 1.11 2020/08/12 23:23:04 christos Exp $ .\" .\" Copyright (c) 1990, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)tsort.1 8.3 (Berkeley) 4/1/94 .\" -.Dd April 1, 1994 +.Dd August 12, 2020 .Dt TSORT 1 .Os .Sh NAME @@ -40,8 +40,10 @@ .Nd topological sort of a directed graph .Sh SYNOPSIS .Nm +.Op Fl d .Op Fl l .Op Fl q +.Op Fl r .Op Ar file .Sh DESCRIPTION .Nm @@ -65,6 +67,8 @@ Cycles are reported on standard error. .Pp The options are as follows: .Bl -tag -width Ds +.It Fl d +Print debugging information. .It Fl l Search for and display the longest cycle. Can take a very long time. @@ -73,6 +77,8 @@ Do not display informational messages ab This is primarily intended for building libraries, where optimal ordering is not critical, and cycles occur often. +.It Fl r +Reverse the sort. .El .Sh SEE ALSO .Xr ar 1 Index: src/usr.bin/tsort/tsort.c diff -u src/usr.bin/tsort/tsort.c:1.23 src/usr.bin/tsort/tsort.c:1.24 --- src/usr.bin/tsort/tsort.c:1.23 Tue Sep 6 14:34:37 2011 +++ src/usr.bin/tsort/tsort.c Wed Aug 12 19:23:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tsort.c,v 1.23 2011/09/06 18:34:37 joerg Exp $ */ +/* $NetBSD: tsort.c,v 1.24 2020/08/12 23:23:04 christos Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)tsort.c 8.3 (Berkeley) 5/4/95"; #endif -__RCSID("$NetBSD: tsort.c,v 1.23 2011/09/06 18:34:37 joerg Exp $"); +__RCSID("$NetBSD: tsort.c,v 1.24 2020/08/12 23:23:04 christos Exp $"); #endif /* not lint */ #include @@ -56,6 +56,7 @@ __RCSID("$NetBSD: tsort.c,v 1.23 2011/09 #include #include #include +#include /* * Topological sort. Input is a list of pairs of strings separated by @@ -85,27 +86,26 @@ struct node_str { NODE **n_prevp; /* pointer to previous node's n_next */ NODE *n_next; /* next node in graph */ NODE **n_arcs; /* array of arcs to other nodes */ - int n_narcs; /* number of arcs in n_arcs[] */ - int n_arcsize; /* size of n_arcs[] array */ - int n_refcnt; /* # of arcs pointing to this node */ + size_t n_narcs; /* number of arcs in n_arcs[] */ + size_t n_arcsize; /* size of n_arcs[] array */ + size_t n_refcnt; /* # of arcs pointing to this node */ int n_flags; /* NF_* */ char n_name[1]; /* name of this node */ }; typedef struct _buf { char *b_buf; - int b_bsize; + size_t b_bsize; } BUF; static DB *db; static NODE *graph, **cycle_buf, **longest_cycle; -static int debug, longest, quiet; +static int debug, longest, quiet, reverse; -static void add_arc(char *, char *); +static void add_arc(const char *, const char *); static void clear_cycle(void); -static int find_cycle(NODE *, NODE *, int, int); -static NODE *get_node(char *); -static void *grow_buf(void *, int); +static size_t find_cycle(NODE *, NODE *, size_t, size_t); +static NODE *get_node(const char *); static void remove_node(NODE *); static void tsort(void); __dead static void usage(void); @@ -114,15 +114,15 @@ int main(int argc, char *argv[]) { BUF *b; - int c, n; + int c, n, ch; FILE *fp; - int bsize, ch, nused; + size_t bsize, nused; BUF bufs[2]; setprogname(argv[0]); fp = NULL; - while ((ch = getopt(argc, argv, "dlq")) != -1) + while ((ch = getopt(argc, argv, "dlqr")) != -1) switch (ch) { case 'd': debug = 1; @@ -133,6 +133,9 @@ main(int argc, char *argv[]) case 'q': quiet = 1; break; + case 'r': + reverse = 1; + break; case '?': default: usage(); @@ -146,14 +149,14 @@ main(int argc, char *argv[])
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Aug 12 19:36:15 UTC 2020 Modified Files: src/usr.bin/make: arch.c Log Message: make(1): remove unnecessary UNCONST from arch.c Somewhere in the refactorings of the last month, the parameter types of the Arch functions had their constness fixed, therefore the UNCONST is no longer necessary. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/usr.bin/make/arch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/arch.c diff -u src/usr.bin/make/arch.c:1.82 src/usr.bin/make/arch.c:1.83 --- src/usr.bin/make/arch.c:1.82 Tue Aug 11 18:41:46 2020 +++ src/usr.bin/make/arch.c Wed Aug 12 19:36:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.82 2020/08/11 18:41:46 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.83 2020/08/12 19:36:14 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.82 2020/08/11 18:41:46 rillig Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.83 2020/08/12 19:36:14 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.82 2020/08/11 18:41:46 rillig Exp $"); +__RCSID("$NetBSD: arch.c,v 1.83 2020/08/12 19:36:14 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1050,7 +1050,7 @@ Arch_TouchLib(GNode *gn) struct ar_hdr arh; /* Header describing table of contents */ struct utimbuf times; /* Times for utime() call */ -arch = ArchFindMember(gn->path, UNCONST(RANLIBMAG), , "r+"); +arch = ArchFindMember(gn->path, RANLIBMAG, , "r+"); snprintf(arh.ar_date, sizeof(arh.ar_date), "%-12ld", (long) now); if (arch != NULL) { @@ -1264,7 +1264,7 @@ Arch_LibOODate(GNode *gn) struct ar_hdr *arhPtr;/* Header for __.SYMDEF */ int modTimeTOC; /* The table-of-contents's mod time */ - arhPtr = ArchStatMember(gn->path, UNCONST(RANLIBMAG), FALSE); + arhPtr = ArchStatMember(gn->path, RANLIBMAG, FALSE); if (arhPtr != NULL) { modTimeTOC = (int)strtol(arhPtr->ar_date, NULL, 10);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Aug 12 19:21:05 UTC 2020 Modified Files: src/usr.bin/make: Makefile Log Message: make(1): enable -Wcast-qual for var.c again When it became disabled 9 years ago, there were 15 instances of UNCONST in the code. These have been removed in the latest cleanup sessions. Tested with GCC 5 from NetBSD 8 and GCC 10 from pkgsrc. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/usr.bin/make/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/Makefile diff -u src/usr.bin/make/Makefile:1.87 src/usr.bin/make/Makefile:1.88 --- src/usr.bin/make/Makefile:1.87 Wed Aug 12 18:48:36 2020 +++ src/usr.bin/make/Makefile Wed Aug 12 19:21:05 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.87 2020/08/12 18:48:36 rillig Exp $ +# $NetBSD: Makefile,v 1.88 2020/08/12 19:21:05 rillig Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make @@ -127,7 +127,6 @@ ${SRCS:M*.c:.c=.o}: ${HDRS} .include CPPFLAGS+= -DMAKE_NATIVE -COPTS.var.c+= -Wno-cast-qual COPTS.job.c+= -Wno-format-nonliteral COPTS.parse.c+= -Wno-format-nonliteral COPTS.var.c+= -Wno-format-nonliteral
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Aug 12 19:14:38 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): prepare var.c for WARNS=6 I'm unhappy with the (unsigned) casts for the enum constants, but there is no way around that since the base type of enums is int by definition, and there is no way in C90 to explicitly specify the base type of an enum type. The (size_t) casts on the pointer differences are another pain point, but for these as well, C90 does not have a ready-made solution. A possible workaround would be an inline function ptr_diff that returns size_t instead of ptrdiff_t, but that would make the code look even more bloated than with the casts. The remaining casts to (char), (int) and (time_t) look so suspicious that it's easy enough to stumble upon them, as soon as someone finds the time to fix these properly by adding a function ParseInt or ParseSeconds. To generate a diff of this commit: cvs rdiff -u -r1.447 -r1.448 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.447 src/usr.bin/make/var.c:1.448 --- src/usr.bin/make/var.c:1.447 Wed Aug 12 18:53:59 2020 +++ src/usr.bin/make/var.c Wed Aug 12 19:14:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.447 2020/08/12 18:53:59 rillig Exp $ */ +/* $NetBSD: var.c,v 1.448 2020/08/12 19:14:38 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.447 2020/08/12 18:53:59 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.448 2020/08/12 19:14:38 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.447 2020/08/12 18:53:59 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.448 2020/08/12 19:14:38 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -557,7 +557,7 @@ Var_Export1(const char *name, VarExportF free(expr); } else { if (parent) - v->flags &= ~VAR_REEXPORT; /* once will do */ + v->flags &= ~(unsigned)VAR_REEXPORT; /* once will do */ if (parent || !(v->flags & VAR_EXPORTED)) setenv(name, val, 1); } @@ -746,7 +746,7 @@ Var_UnExport(const char *str) if (!unexport_env && (v->flags & VAR_EXPORTED) && !(v->flags & VAR_REEXPORT)) unsetenv(v->name); - v->flags &= ~(VAR_EXPORTED | VAR_REEXPORT); + v->flags &= ~(unsigned)(VAR_EXPORTED | VAR_REEXPORT); /* * If we are unexporting a list, @@ -952,7 +952,7 @@ Var_Append(const char *name, const char * it in the environment, but then we should provide a way to * export other variables...) */ - v->flags &= ~VAR_FROM_ENV; + v->flags &= ~(unsigned)VAR_FROM_ENV; h = Hash_CreateEntry(>context, name, NULL); Hash_SetValue(h, v); } @@ -1212,7 +1212,7 @@ Str_SYSVMatch(const char *word, const ch if (memcmp(p, w_tail, p_len) != 0) return NULL; -*match_len = w_tail - w; +*match_len = (size_t)(w_tail - w); return w; } @@ -1324,8 +1324,8 @@ ModifyWord_Subst(const char *word, SepBu SepBuf_AddBytesBetween(buf, word, match); SepBuf_AddBytes(buf, args->rhs, args->rhsLen); args->pflags |= VARP_SUB_MATCHED; - wordLen -= (match - word) + args->lhsLen; - word += (match - word) + args->lhsLen; + wordLen -= (size_t)(match - word) + args->lhsLen; + word += (size_t)(match - word) + args->lhsLen; if (wordLen == 0 || !(args->pflags & VARP_SUB_GLOBAL)) break; } @@ -1338,7 +1338,7 @@ nosub: static void VarREError(int reerr, regex_t *pat, const char *str) { -int errlen = regerror(reerr, pat, 0, 0); +size_t errlen = regerror(reerr, pat, 0, 0); char *errbuf = bmake_malloc(errlen); regerror(reerr, pat, errbuf, errlen); Error("%s: %s", str, errbuf); @@ -1347,7 +1347,7 @@ VarREError(int reerr, regex_t *pat, cons typedef struct { regex_t re; -int nsub; +size_t nsub; char *replace; VarPatternFlags pflags; } ModifyWord_SubstRegexArgs; @@ -1373,7 +1373,7 @@ tryagain: switch (xrv) { case 0: args->pflags |= VARP_SUB_MATCHED; - SepBuf_AddBytes(buf, wp, m[0].rm_so); + SepBuf_AddBytes(buf, wp, (size_t)m[0].rm_so); for (rp = args->replace; *rp; rp++) { if (*rp == '\\' && (rp[1] == '&' || rp[1] == '\\')) { @@ -1393,13 +1393,13 @@ tryagain: } { /* \0 to \9 backreference */ - int n = rp[1] - '0'; + size_t n = (size_t)(rp[1] - '0'); rp++; if (n >= args->nsub) { - Error("No subexpression \\%d", n); + Error("No subexpression \\%zu", n); } else if (m[n].rm_so == -1 && m[n].rm_eo == -1) { - Error("No match for subexpression \\%d", n); + Error("No match for subexpression \\%zu", n); } else { SepBuf_AddBytesBetween(buf, wp + m[n].rm_so, wp +
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Aug 12 18:53:59 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): replace redundant NULL tests with assertions To generate a diff of this commit: cvs rdiff -u -r1.446 -r1.447 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.446 src/usr.bin/make/var.c:1.447 --- src/usr.bin/make/var.c:1.446 Mon Aug 10 20:07:14 2020 +++ src/usr.bin/make/var.c Wed Aug 12 18:53:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.446 2020/08/10 20:07:14 rillig Exp $ */ +/* $NetBSD: var.c,v 1.447 2020/08/12 18:53:59 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.446 2020/08/10 20:07:14 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.447 2020/08/12 18:53:59 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.446 2020/08/10 20:07:14 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.447 2020/08/12 18:53:59 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -3026,17 +3026,19 @@ ApplyModifiers( * we are not interested. */ int c; - if (rval != NULL && *rval && + assert(rval != NULL); + if (rval[0] != '\0' && (c = p[rlen]) != '\0' && c != ':' && c != st.endc) { free(freeIt); goto apply_mods; } - VAR_DEBUG("Indirect modifier \"%s\" from \"%.*s\"\n", rval, rlen, p); + VAR_DEBUG("Indirect modifier \"%s\" from \"%.*s\"\n", + rval, rlen, p); p += rlen; - if (rval != NULL && *rval) { + if (rval[0] != '\0') { const char *rval_pp = rval; st.val = ApplyModifiers(_pp, st.val, '\0', '\0', v, ctxt, eflags, freePtr); @@ -3549,11 +3551,12 @@ Var_Parse(const char * const str, GNode if (strchr(nstr, '$') != NULL && (eflags & VARE_WANTRES) != 0) { nstr = Var_Subst(nstr, ctxt, eflags); *freePtr = nstr; + assert(nstr != NULL); } v->flags &= ~VAR_IN_USE; -if (nstr != NULL && (haveModifier || extramodifiers != NULL)) { +if (haveModifier || extramodifiers != NULL) { void *extraFree; extraFree = NULL;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Aug 12 18:48:36 UTC 2020 Modified Files: src/usr.bin/make: Makefile Log Message: make(1): allow optional compilation with GCC 10, use gcov from GCC To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/usr.bin/make/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/Makefile diff -u src/usr.bin/make/Makefile:1.86 src/usr.bin/make/Makefile:1.87 --- src/usr.bin/make/Makefile:1.86 Mon Aug 10 18:40:24 2020 +++ src/usr.bin/make/Makefile Wed Aug 12 18:48:36 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.86 2020/08/10 18:40:24 rillig Exp $ +# $NetBSD: Makefile,v 1.87 2020/08/12 18:48:36 rillig Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make @@ -44,7 +44,8 @@ HDRS+= trace.h # Whether to generate a coverage report after running the tests. USE_COVERAGE?= no # works only with gcc; clang9 fails to link .if ${USE_COVERAGE} == "yes" -COPTS+= --coverage -O0 -ggdb +GCOV?= gcov +COPTS+= --coverage -O2 -ggdb LDADD+= --coverage .endif CLEANFILES+= *.gcda *.gcno *.gcov @@ -56,6 +57,18 @@ COPTS+= -fsanitize=undefined LDADD+= -fsanitize=undefined .endif +# Whether to compile with GCC 10 from pkgsrc, during development. +USE_GCC10?= no +.if ${USE_GCC10} == "yes" +# CC is set further down in this file +COPTS+= -Wno-attributes # for abs and labs +COPTS.arch.c+= -Wno-error=format-truncation +COPTS.dir.c+= -Wno-error=format-truncation +COPTS.main.c+= -Wno-error=format-truncation +COPTS.meta.c+= -Wno-error=format-truncation +COPTS.parse.c+= -Wno-error=format-truncation +.endif + # Whether to compile with GCC 9 from pkgsrc, during development. USE_GCC9?= no .if ${USE_GCC9} == "yes" @@ -68,6 +81,17 @@ COPTS.meta.c+= -Wno-error=format-truncat COPTS.parse.c+= -Wno-error=format-truncation .endif +# Whether to compile with GCC 8 from pkgsrc, during development. +USE_GCC8?= no +.if ${USE_GCC8} == "yes" +# CC is set further down in this file +COPTS+= -Wno-attributes # for abs and labs +COPTS.arch.c+= -Wno-error=format-truncation +COPTS.dir.c+= -Wno-error=format-truncation +COPTS.main.c+= -Wno-error=format-truncation +COPTS.meta.c+= -Wno-error=format-truncation +.endif + USE_META?= yes .if ${USE_META:tl} != "no" @@ -108,8 +132,22 @@ COPTS.job.c+= -Wno-format-nonliteral COPTS.parse.c+= -Wno-format-nonliteral COPTS.var.c+= -Wno-format-nonliteral +.if ${USE_GCC10} == "yes" +GCC9BASE?= /usr/pkg/gcc10 +CC= ${GCC10BASE}/bin/gcc +GCOV= ${GCC10BASE}/bin/gcov +.endif + .if ${USE_GCC9} == "yes" -CC= /usr/pkg/gcc9/bin/gcc +GCC9BASE?= /usr/pkg/gcc9 +CC= ${GCC9BASE}/bin/gcc +GCOV= ${GCC9BASE}/bin/gcov +.endif + +.if ${USE_GCC8} == "yes" +GCC8BASE?= /usr/pkg/gcc8 +CC= ${GCC8BASE}/bin/gcc +GCOV= ${GCC8BASE}/bin/gcov .endif .if defined(TOOLDIR) @@ -132,7 +170,7 @@ test: .MAKE cd ${.CURDIR}/unit-tests \ && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET} .if ${USE_COVERAGE} == yes - gcov ${GCOV_OPTS} ${SRCS} + ${GCOV} ${GCOV_OPTS} ${SRCS} sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov .endif
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Aug 12 18:47:22 UTC 2020 Modified Files: src/usr.bin/make: make_malloc.c Log Message: make(1): remove unnecessary test from bmake_strndup The passed memory is never NULL. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/make_malloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make_malloc.c diff -u src/usr.bin/make/make_malloc.c:1.13 src/usr.bin/make/make_malloc.c:1.14 --- src/usr.bin/make/make_malloc.c:1.13 Wed Aug 12 03:27:29 2020 +++ src/usr.bin/make/make_malloc.c Wed Aug 12 18:47:21 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make_malloc.c,v 1.13 2020/08/12 03:27:29 rillig Exp $ */ +/* $NetBSD: make_malloc.c,v 1.14 2020/08/12 18:47:21 rillig Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ #ifdef MAKE_NATIVE #include -__RCSID("$NetBSD: make_malloc.c,v 1.13 2020/08/12 03:27:29 rillig Exp $"); +__RCSID("$NetBSD: make_malloc.c,v 1.14 2020/08/12 18:47:21 rillig Exp $"); #endif #include @@ -92,9 +92,6 @@ bmake_strndup(const char *str, size_t ma size_t len; char *p; - if (str == NULL) - return NULL; - for (len = 0; len < max_len; len++) if (str[len] == '\0') break;
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: skrll Date: Wed Aug 12 18:30:46 UTC 2020 Modified Files: src/sys/arch/arm/arm32: pmap.c Log Message: Whack-a-mole To generate a diff of this commit: cvs rdiff -u -r1.420 -r1.421 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.420 src/sys/arch/arm/arm32/pmap.c:1.421 --- src/sys/arch/arm/arm32/pmap.c:1.420 Tue Aug 11 07:03:33 2020 +++ src/sys/arch/arm/arm32/pmap.c Wed Aug 12 18:30:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.420 2020/08/11 07:03:33 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.421 2020/08/12 18:30:46 skrll Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -192,7 +192,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.420 2020/08/11 07:03:33 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.421 2020/08/12 18:30:46 skrll Exp $"); #include #include @@ -5178,7 +5178,7 @@ pmap_remove_all(pmap_t pm) { UVMHIST_FUNC(__func__); - UVMHIST_CALLARGS(maphist, "(pm=%#jx)", (uintptr_t)pmap, 0, 0, 0); + UVMHIST_CALLARGS(maphist, "(pm=%#jx)", (uintptr_t)pm, 0, 0, 0); KASSERT(pm != pmap_kernel());
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: skrll Date: Wed Aug 12 13:36:36 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c src/sys/arch/aarch64/include: pmap.h Log Message: Part IV of ad's performance improvements for aarch64 - Implement pmap_growkernel(), and update kernel pmap's stats with atomics. - Then, pmap_kenter_pa() and pmap_kremove() no longer need to allocate memory nor take pm_lock, because they only modify L3 PTEs. - Then, pm_lock and pp_lock can be adaptive mutexes at IPL_NONE which are cheaper than spin mutexes. - Take the pmap's lock in pmap_extract() if not the kernel's pmap, otherwise pmap_extract() might see inconsistent state. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/arch/aarch64/aarch64/pmap.c cvs rdiff -u -r1.41 -r1.42 src/sys/arch/aarch64/include/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.85 src/sys/arch/aarch64/aarch64/pmap.c:1.86 --- src/sys/arch/aarch64/aarch64/pmap.c:1.85 Sun Aug 9 09:11:41 2020 +++ src/sys/arch/aarch64/aarch64/pmap.c Wed Aug 12 13:36:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.85 2020/08/09 09:11:41 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.86 2020/08/12 13:36:36 skrll Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.85 2020/08/09 09:11:41 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.86 2020/08/12 13:36:36 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" @@ -195,6 +195,8 @@ static pt_entry_t _pmap_pte_adjust_cache static void _pmap_remove(struct pmap *, vaddr_t, vaddr_t, bool, struct pv_entry **); static int _pmap_enter(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int, bool); +static int _pmap_get_pdp(struct pmap *, vaddr_t, bool, int, paddr_t *, +struct vm_page **, bool *); static struct pmap kernel_pmap __cacheline_aligned; @@ -215,27 +217,27 @@ static inline void pmap_pv_lock(struct pmap_page *pp) { - mutex_spin_enter(>pp_pvlock); + mutex_enter(>pp_pvlock); } static inline void pmap_pv_unlock(struct pmap_page *pp) { - mutex_spin_exit(>pp_pvlock); + mutex_exit(>pp_pvlock); } static inline void pm_lock(struct pmap *pm) { - mutex_spin_enter(>pm_lock); + mutex_enter(>pm_lock); } static inline void pm_unlock(struct pmap *pm) { - mutex_spin_exit(>pm_lock); + mutex_exit(>pm_lock); } static bool @@ -249,13 +251,13 @@ pm_reverse_lock(struct pmap *pm, struct if (pm != pmap_kernel()) pmap_reference(pm); - mutex_spin_exit(>pp_pvlock); - mutex_spin_enter(>pm_lock); + mutex_exit(>pp_pvlock); + mutex_enter(>pm_lock); /* nothing, just wait for lock */ - mutex_spin_exit(>pm_lock); + mutex_exit(>pm_lock); if (pm != pmap_kernel()) pmap_destroy(pm); - mutex_spin_enter(>pp_pvlock); + mutex_enter(>pp_pvlock); return false; } @@ -471,26 +473,34 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v kpm->pm_l0table_pa = l0pa; kpm->pm_activated = true; LIST_INIT(>pm_vmlist); - mutex_init(>pm_lock, MUTEX_DEFAULT, IPL_VM); + mutex_init(>pm_lock, MUTEX_DEFAULT, IPL_NONE); CTASSERT(sizeof(kpm->pm_stats.wired_count) == sizeof(long)); CTASSERT(sizeof(kpm->pm_stats.resident_count) == sizeof(long)); -#define PMSTAT_INC_WIRED_COUNT(pm) do { \ - KASSERT(mutex_owned(&(pm)->pm_lock)); \ - (pm)->pm_stats.wired_count++; \ -} while (/* CONSTCOND */ 0); -#define PMSTAT_DEC_WIRED_COUNT(pm) do{ \ - KASSERT(mutex_owned(&(pm)->pm_lock)); \ - (pm)->pm_stats.wired_count--; \ -} while (/* CONSTCOND */ 0); -#define PMSTAT_INC_RESIDENT_COUNT(pm) do { \ - KASSERT(mutex_owned(&(pm)->pm_lock)); \ - (pm)->pm_stats.resident_count++; \ -} while (/* CONSTCOND */ 0); -#define PMSTAT_DEC_RESIDENT_COUNT(pm) do { \ - KASSERT(mutex_owned(&(pm)->pm_lock)); \ - (pm)->pm_stats.resident_count--; \ -} while (/* CONSTCOND */ 0); +} + +static inline void +_pmap_adj_wired_count(struct pmap *pm, int adj) +{ + + if (pm == pmap_kernel()) { + atomic_add_long(>pm_stats.wired_count, adj); + } else { + KASSERT(mutex_owned(>pm_lock)); + pm->pm_stats.wired_count += adj; + } +} + +static inline void +_pmap_adj_resident_count(struct pmap *pm, int adj) +{ + + if (pm == pmap_kernel()) { + atomic_add_long(>pm_stats.resident_count, adj); + } else { + KASSERT(mutex_owned(>pm_lock)); + pm->pm_stats.resident_count += adj; + } } inline static int @@ -709,18 +719,34 @@ _pmap_free_pdp_all(struct pmap *pm) vaddr_t pmap_growkernel(vaddr_t maxkvaddr) { + struct pmap *pm = pmap_kernel(); + struct vm_page *pg; + bool l3only = true; + int error; + vaddr_t va; + paddr_t pa; + UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist); UVMHIST_LOG(pmaphist, "maxkvaddr=%llx, pmap_maxkvaddr=%llx", maxkvaddr, pmap_maxkvaddr, 0, 0); + mutex_enter(>pm_lock); + for (va = pmap_maxkvaddr & L2_FRAME; va <= maxkvaddr;
CVS commit: src/sys/arch
Module Name:src Committed By: skrll Date: Wed Aug 12 13:28:46 UTC 2020 Modified Files: src/sys/arch/aarch64/conf: files.aarch64 src/sys/arch/aarch64/include: mutex.h src/sys/arch/evbarm/include: mutex.h Added Files: src/sys/arch/aarch64/aarch64: lock_stubs.S Log Message: Part III of ad's performance improvements for aarch64 - Assembly language stubs for mutex_enter() and mutex_exit(). To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/aarch64/aarch64/lock_stubs.S cvs rdiff -u -r1.26 -r1.27 src/sys/arch/aarch64/conf/files.aarch64 cvs rdiff -u -r1.1 -r1.2 src/sys/arch/aarch64/include/mutex.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/include/mutex.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/conf/files.aarch64 diff -u src/sys/arch/aarch64/conf/files.aarch64:1.26 src/sys/arch/aarch64/conf/files.aarch64:1.27 --- src/sys/arch/aarch64/conf/files.aarch64:1.26 Sat Jul 25 22:51:57 2020 +++ src/sys/arch/aarch64/conf/files.aarch64 Wed Aug 12 13:28:46 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.aarch64,v 1.26 2020/07/25 22:51:57 riastradh Exp $ +# $NetBSD: files.aarch64,v 1.27 2020/08/12 13:28:46 skrll Exp $ defflag opt_cpuoptions.h AARCH64_ALIGNMENT_CHECK defflag opt_cpuoptions.h AARCH64_EL0_STACK_ALIGNMENT_CHECK @@ -100,6 +100,7 @@ file arch/aarch64/aarch64/exec_machdep.c file arch/aarch64/aarch64/fusu.S file arch/aarch64/aarch64/idle_machdep.S file arch/aarch64/aarch64/kobj_machdep.c modular +file arch/aarch64/aarch64/lock_stubs.S file arch/aarch64/aarch64/process_machdep.c file arch/aarch64/aarch64/procfs_machdep.c procfs file arch/aarch64/aarch64/sig_machdep.c Index: src/sys/arch/aarch64/include/mutex.h diff -u src/sys/arch/aarch64/include/mutex.h:1.1 src/sys/arch/aarch64/include/mutex.h:1.2 --- src/sys/arch/aarch64/include/mutex.h:1.1 Sun Aug 10 05:47:38 2014 +++ src/sys/arch/aarch64/include/mutex.h Wed Aug 12 13:28:46 2020 @@ -1,3 +1,5 @@ -/* $NetBSD: mutex.h,v 1.1 2014/08/10 05:47:38 matt Exp $ */ +/* $NetBSD: mutex.h,v 1.2 2020/08/12 13:28:46 skrll Exp $ */ #include + +#define __HAVE_MUTEX_STUBS 1 Index: src/sys/arch/evbarm/include/mutex.h diff -u src/sys/arch/evbarm/include/mutex.h:1.2 src/sys/arch/evbarm/include/mutex.h:1.3 --- src/sys/arch/evbarm/include/mutex.h:1.2 Fri Feb 9 21:55:03 2007 +++ src/sys/arch/evbarm/include/mutex.h Wed Aug 12 13:28:46 2020 @@ -1,3 +1,7 @@ -/* $NetBSD: mutex.h,v 1.2 2007/02/09 21:55:03 ad Exp $ */ +/* $NetBSD: mutex.h,v 1.3 2020/08/12 13:28:46 skrll Exp $ */ +#ifdef __aarch64__ +#include +#else #include +#endif Added files: Index: src/sys/arch/aarch64/aarch64/lock_stubs.S diff -u /dev/null src/sys/arch/aarch64/aarch64/lock_stubs.S:1.1 --- /dev/null Wed Aug 12 13:28:46 2020 +++ src/sys/arch/aarch64/aarch64/lock_stubs.S Wed Aug 12 13:28:46 2020 @@ -0,0 +1,81 @@ +/* $NetBSD: lock_stubs.S,v 1.1 2020/08/12 13:28:46 skrll Exp $ */ + +/*- + * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas of 3am Software Foundry, and by Andrew Doran. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "opt_lockdebug.h" + +#include + +#include "assym.h" + +RCSID("$NetBSD: lock_stubs.S,v 1.1 2020/08/12 13:28:46 skrll Exp $") + +#ifndef LOCKDEBUG +/* + * mutex_enter(): the compare-and-set must be atomic with respect to + * interrupts and with respect to other CPUs. + */ +ENTRY(mutex_enter) + mrs x1, tpidr_el1 /* x1 = curlwp */ +1: + ldxr x2, [x0] /* load old value */ + cbnz x2, 3f /* equals
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: skrll Date: Wed Aug 12 13:19:35 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: copyinout.S cpu_machdep.c cpuswitch.S db_machdep.c fusu.S genassym.cf idle_machdep.S locore.S vectors.S src/sys/arch/aarch64/include: cpu.h proc.h Log Message: Part II of ad's aarch64 performance improvements (cpu_switch.S bugs are all mine) - Use tpidr_el1 to hold curlwp and not curcpu, because curlwp is accessed much more often by MI code. It also makes curlwp preemption safe and allows aarch64_curlwp() to be a const function (curcpu must be volatile). - Make ASTs operate per-LWP rather than per-CPU, otherwise sometimes LWPs can see spurious ASTs (which doesn't cause a problem, it just means some time may be wasted). - Use plain stores to set/clear ASTs. Make sure ASTs are always set on the same CPU as the target LWP, and delivered via IPI if posted from a remote CPU so that they are resolved quickly. - Add some cache line padding to struct cpu_info, to match x86. - Add a memory barrier in a couple of places where ci_curlwp is set. This is needed whenever an LWP that is resuming on the CPU could hold an adaptive mutex. The barrier needs to drain the CPU's store buffer, so that the update to ci_curlwp becomes globally visible before the LWP can resume and call mutex_exit(). By my reading of the ARM docs it looks like the instruction I used will do the right thing, but I'm not 100% sure. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/aarch64/aarch64/copyinout.S cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/cpu_machdep.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/aarch64/cpuswitch.S cvs rdiff -u -r1.25 -r1.26 src/sys/arch/aarch64/aarch64/db_machdep.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/fusu.S cvs rdiff -u -r1.29 -r1.30 src/sys/arch/aarch64/aarch64/genassym.cf cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/idle_machdep.S cvs rdiff -u -r1.69 -r1.70 src/sys/arch/aarch64/aarch64/locore.S cvs rdiff -u -r1.17 -r1.18 src/sys/arch/aarch64/aarch64/vectors.S cvs rdiff -u -r1.25 -r1.26 src/sys/arch/aarch64/include/cpu.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/aarch64/include/proc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/copyinout.S diff -u src/sys/arch/aarch64/aarch64/copyinout.S:1.14 src/sys/arch/aarch64/aarch64/copyinout.S:1.15 --- src/sys/arch/aarch64/aarch64/copyinout.S:1.14 Thu Aug 6 06:49:55 2020 +++ src/sys/arch/aarch64/aarch64/copyinout.S Wed Aug 12 13:19:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinout.S,v 1.14 2020/08/06 06:49:55 ryo Exp $ */ +/* $NetBSD: copyinout.S,v 1.15 2020/08/12 13:19:35 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include #include "assym.h" -RCSID("$NetBSD: copyinout.S,v 1.14 2020/08/06 06:49:55 ryo Exp $"); +RCSID("$NetBSD: copyinout.S,v 1.15 2020/08/12 13:19:35 skrll Exp $"); #ifdef ARMV81_PAN #define PAN_ENABLE \ @@ -80,8 +80,7 @@ RCSID("$NetBSD: copyinout.S,v 1.14 2020/ .macro exit_cpu_onfault /* curlwp->l_md.md_onfault = NULL */ - mrs x0, tpidr_el1 /* curcpu */ - ldr x0, [x0, #CI_CURLWP] /* x0 = curlwp */ + mrs x0, tpidr_el1 /* x0 = curlwp */ str xzr, [x0, #L_MD_ONFAULT] /* lwp->l_md_onfault = NULL */ 9: PAN_ENABLE/* enable PAN */ Index: src/sys/arch/aarch64/aarch64/cpu_machdep.c diff -u src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.10 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.11 --- src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.10 Thu May 21 05:41:40 2020 +++ src/sys/arch/aarch64/aarch64/cpu_machdep.c Wed Aug 12 13:19:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_machdep.c,v 1.10 2020/05/21 05:41:40 ryo Exp $ */ +/* $NetBSD: cpu_machdep.c,v 1.11 2020/08/12 13:19:35 skrll Exp $ */ /*- * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.10 2020/05/21 05:41:40 ryo Exp $"); +__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.11 2020/08/12 13:19:35 skrll Exp $"); #include "opt_multiprocessor.h" @@ -261,7 +261,7 @@ cpu_need_resched(struct cpu_info *ci, st intr_ipi_send(ci->ci_kcpuset, IPI_AST); #endif } else { - setsoftast(ci); /* force call to ast() */ + l->l_md.md_astpending = 1; } } @@ -272,7 +272,22 @@ cpu_need_proftick(struct lwp *l) KASSERT(l->l_cpu == curcpu()); l->l_pflag |= LP_OWEUPC; - setsoftast(l->l_cpu); + l->l_md.md_astpending = 1; +} + +void +cpu_signotify(struct lwp *l) +{ + + KASSERT(kpreempt_disabled()); + + if (l->l_cpu != curcpu()) { +#ifdef MULTIPROCESSOR + intr_ipi_send(l->l_cpu->ci_kcpuset, IPI_AST); +#endif + } else { + l->l_md.md_astpending = 1; + } } #ifdef __HAVE_PREEMPTION Index: src/sys/arch/aarch64/aarch64/cpuswitch.S diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.24
CVS commit: src/common/lib/libc/arch/aarch64/atomic
Module Name:src Committed By: skrll Date: Wed Aug 12 12:59:57 UTC 2020 Modified Files: src/common/lib/libc/arch/aarch64/atomic: atomic_cas_16.S atomic_cas_32.S atomic_cas_64.S atomic_cas_8.S atomic_dec_32.S atomic_dec_64.S atomic_inc_32.S atomic_inc_64.S atomic_nand_16.S atomic_nand_32.S atomic_nand_64.S atomic_nand_8.S atomic_swap_16.S atomic_swap_32.S atomic_swap_64.S atomic_swap_8.S Log Message: Part I of ad@'s performance improvements for aarch64 - Remove memory barriers from the atomic ops. I don't understand why those are there. Is it some architectural thing, or for a CPU bug, or just over-caution maybe? They're not needed for correctness. - Have unlikely conditional branches go forwards to help the static branch predictor. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_dec_32.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_dec_64.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_inc_32.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_inc_64.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_swap_16.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_swap_32.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_swap_64.S \ src/common/lib/libc/arch/aarch64/atomic/atomic_swap_8.S cvs rdiff -u -r1.3 -r1.4 \ src/common/lib/libc/arch/aarch64/atomic/atomic_cas_64.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S:1.1 src/common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S:1.2 --- src/common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S:1.1 Sun Aug 10 05:47:35 2014 +++ src/common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S Wed Aug 12 12:59:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_cas_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ +/* $NetBSD: atomic_cas_16.S,v 1.2 2020/08/12 12:59:57 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -37,9 +37,9 @@ ENTRY_NP(_atomic_cas_16) cmp w0, w1 /* compare? */ b.ne 2f stxrh w3, w2, [x4] /* store new value */ - cbnz w3, 1b /* succeed? nope, try again. */ - dmb st /* data memory barrier */ + cbnz w3, 3f /* succeed? nope, try again. */ 2: ret/* return. */ +3: b 1b END(_atomic_cas_16) ATOMIC_OP_ALIAS(atomic_cas_16,_atomic_cas_16) Index: src/common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S:1.1 src/common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S:1.2 --- src/common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S:1.1 Sun Aug 10 05:47:35 2014 +++ src/common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S Wed Aug 12 12:59:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_cas_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ +/* $NetBSD: atomic_cas_32.S,v 1.2 2020/08/12 12:59:57 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -37,9 +37,9 @@ ENTRY_NP(_atomic_cas_32) cmp w0, w1 /* compare? */ b.ne 2f /* return if different */ stxr w3, w2, [x4] /* store new value */ - cbnz w3, 1b /* succeed? nope, try again. */ - dmb st + cbnz w3, 3f /* succeed? nope, try again. */ 2: ret/* return. */ +3: b 1b END(_atomic_cas_32) ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) Index: src/common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S:1.1 src/common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S:1.2 --- src/common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S:1.1 Sun Aug 10 05:47:35 2014 +++ src/common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S Wed Aug 12 12:59:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_cas_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ +/* $NetBSD: atomic_cas_8.S,v 1.2 2020/08/12 12:59:57 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -37,9 +37,9 @@ ENTRY_NP(_atomic_cas_8) cmp w0, w1 /* compare? */ b.ne 2f stxrb w3, w2, [x4] /* store new value */ - cbnz w3, 1b /* succeed? nope, try again. */ - dmb st /* data memory barrier */ + cbnz w3, 3f /* succeed? nope, try again. */ 2: ret/* return. */ +3: b 1b END(_atomic_cas_8) ATOMIC_OP_ALIAS(atomic_cas_8,_atomic_cas_8) Index: src/common/lib/libc/arch/aarch64/atomic/atomic_dec_32.S diff -u
CVS commit: src/sys/arch/arm/nvidia
Module Name:src Committed By: jmcneill Date: Wed Aug 12 10:21:00 UTC 2020 Modified Files: src/sys/arch/arm/nvidia: tegra124_car.c Log Message: Add CEC clock To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/nvidia/tegra124_car.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/nvidia/tegra124_car.c diff -u src/sys/arch/arm/nvidia/tegra124_car.c:1.20 src/sys/arch/arm/nvidia/tegra124_car.c:1.21 --- src/sys/arch/arm/nvidia/tegra124_car.c:1.20 Thu Apr 30 03:40:52 2020 +++ src/sys/arch/arm/nvidia/tegra124_car.c Wed Aug 12 10:21:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra124_car.c,v 1.20 2020/04/30 03:40:52 riastradh Exp $ */ +/* $NetBSD: tegra124_car.c,v 1.21 2020/08/12 10:21:00 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra124_car.c,v 1.20 2020/04/30 03:40:52 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra124_car.c,v 1.21 2020/08/12 10:21:00 jmcneill Exp $"); #include #include @@ -151,6 +151,7 @@ static struct tegra124_car_clock_id { { 127, "se" }, { 128, "hda2hdmi" }, { 129, "sata_cold" }, + { 136, "cec" }, { 144, "cilab" }, { 145, "cilcd" }, { 146, "cile" }, @@ -631,6 +632,7 @@ static struct tegra_clk tegra124_car_clo CLK_GATE_V("hda2codec_2x", "div_hda2codec_2x", CAR_DEV_V_HDA2CODEC_2X), CLK_GATE_V("hda", "div_hda", CAR_DEV_V_HDA), CLK_GATE_W("hda2hdmi", "clk_m", CAR_DEV_W_HDA2HDMICODEC), + CLK_GATE_W("cec", "clk_m", CAR_DEV_W_CEC), CLK_GATE_H("fuse", "clk_m", CAR_DEV_H_FUSE), CLK_GATE_U("soc_therm", "div_soc_therm", CAR_DEV_U_SOC_THERM), CLK_GATE_V("mselect", "div_mselect", CAR_DEV_V_MSELECT),
CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: msaitoh Date: Wed Aug 12 09:13:46 UTC 2020 Modified Files: src/sys/dev/pci/ixgbe: if_bypass.c Log Message: Fix checking return value of atomic_cas_uint(). This change fixes a bug that extra delay() is called only once even if atomic_cas_uint() isn't failed or delay() isn't called when atomic_cas_uint() failed. The reason of this bug was that I simply converted FreeBSD' atomic_cmpset_int() to atomic_cas_uint(). The return value's semantics is different. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/ixgbe/if_bypass.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/if_bypass.c diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.5 src/sys/dev/pci/ixgbe/if_bypass.c:1.6 --- src/sys/dev/pci/ixgbe/if_bypass.c:1.5 Mon Dec 16 02:50:54 2019 +++ src/sys/dev/pci/ixgbe/if_bypass.c Wed Aug 12 09:13:46 2020 @@ -45,9 +45,9 @@ static void ixgbe_bypass_mutex_enter(struct adapter *adapter) { - while (atomic_cas_uint(>bypass.low, 0, 1) == 0) + while (atomic_cas_uint(>bypass.low, 0, 1) != 0) usec_delay(3000); - while (atomic_cas_uint(>bypass.high, 0, 1) == 0) + while (atomic_cas_uint(>bypass.high, 0, 1) != 0) usec_delay(3000); return; } /* ixgbe_bypass_mutex_enter */ @@ -58,9 +58,9 @@ ixgbe_bypass_mutex_enter(struct adapter static void ixgbe_bypass_mutex_clear(struct adapter *adapter) { - while (atomic_cas_uint(>bypass.high, 1, 0) == 0) + while (atomic_cas_uint(>bypass.high, 1, 0) != 1) usec_delay(6000); - while (atomic_cas_uint(>bypass.low, 1, 0) == 0) + while (atomic_cas_uint(>bypass.low, 1, 0) != 1) usec_delay(6000); return; } /* ixgbe_bypass_mutex_clear */ @@ -73,7 +73,7 @@ ixgbe_bypass_mutex_clear(struct adapter static void ixgbe_bypass_wd_mutex_enter(struct adapter *adapter) { - while (atomic_cas_uint(>bypass.high, 0, 1) == 0) + while (atomic_cas_uint(>bypass.high, 0, 1) != 0) usec_delay(3000); return; } /* ixgbe_bypass_wd_mutex_enter */ @@ -84,7 +84,7 @@ ixgbe_bypass_wd_mutex_enter(struct adapt static void ixgbe_bypass_wd_mutex_clear(struct adapter *adapter) { - while (atomic_cas_uint(>bypass.high, 1, 0) == 0) + while (atomic_cas_uint(>bypass.high, 1, 0) != 1) usec_delay(6000); return; } /* ixgbe_bypass_wd_mutex_clear */ @@ -585,7 +585,7 @@ ixgbe_bp_log(SYSCTLFN_ARGS) return (error); /* Keep the log display single-threaded */ - while (atomic_cas_uint(>bypass.log, 0, 1) == 0) + while (atomic_cas_uint(>bypass.log, 0, 1) != 0) usec_delay(3000); ixgbe_bypass_mutex_enter(adapter); @@ -713,14 +713,14 @@ ixgbe_bp_log(SYSCTLFN_ARGS) status = 0; /* reset */ /* Another log command can now run */ - while (atomic_cas_uint(>bypass.log, 1, 0) == 0) + while (atomic_cas_uint(>bypass.log, 1, 0) != 1) usec_delay(3000); return (error); unlock_err: ixgbe_bypass_mutex_clear(adapter); status = 0; /* reset */ - while (atomic_cas_uint(>bypass.log, 1, 0) == 0) + while (atomic_cas_uint(>bypass.log, 1, 0) != 1) usec_delay(3000); return (EINVAL); } /* ixgbe_bp_log */
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: skrll Date: Wed Aug 12 08:57:03 UTC 2020 Modified Files: src/sys/arch/mips/mips: genassym.cf Log Message: No need for MIPS_EBASE_CPUNUM now that asm.h supports __BITS To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/arch/mips/mips/genassym.cf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/mips/genassym.cf diff -u src/sys/arch/mips/mips/genassym.cf:1.70 src/sys/arch/mips/mips/genassym.cf:1.71 --- src/sys/arch/mips/mips/genassym.cf:1.70 Mon Jul 20 03:22:39 2020 +++ src/sys/arch/mips/mips/genassym.cf Wed Aug 12 08:57:03 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.70 2020/07/20 03:22:39 simonb Exp $ +# $NetBSD: genassym.cf,v 1.71 2020/08/12 08:57:03 skrll Exp $ # # Copyright (c) 1992, 1993 # The Regents of the University of California. All rights reserved. @@ -185,8 +185,6 @@ define V_MIPS3_PG_ASID ilog2(__LOWEST_S define S_MIPS3_PG_ASID ilog2(MIPS3_PG_ASID+1) endif -define MIPS_EBASE_CPUNUM MIPS_EBASE_CPUNUM - define TF_SIZ sizeof(struct trapframe) define TF_REG_ZERO offsetof(struct trapframe, tf_regs[_R_ZERO]) define TF_REG_AST offsetof(struct trapframe, tf_regs[_R_AST])
CVS commit: src/sys/arch/mips/include
Module Name:src Committed By: skrll Date: Wed Aug 12 08:56:37 UTC 2020 Modified Files: src/sys/arch/mips/include: asm.h Log Message: Provide assmebler versions of BITS(3) macros. These are only good for 32 bit masks To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/arch/mips/include/asm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/include/asm.h diff -u src/sys/arch/mips/include/asm.h:1.60 src/sys/arch/mips/include/asm.h:1.61 --- src/sys/arch/mips/include/asm.h:1.60 Mon Aug 10 14:37:38 2020 +++ src/sys/arch/mips/include/asm.h Wed Aug 12 08:56:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.60 2020/08/10 14:37:38 skrll Exp $ */ +/* $NetBSD: asm.h,v 1.61 2020/08/12 08:56:37 skrll Exp $ */ /* * Copyright (c) 1992, 1993 @@ -57,6 +57,13 @@ #include /* for API selection */ #include +#define __BIT(n) (1 << (n)) +#define __BITS(hi,lo) ((~((~0)<<((hi)+1)))&((~0)<<(lo))) + +#define __LOWEST_SET_BIT(__mask) __mask) - 1) & (__mask)) ^ (__mask)) +#define __SHIFTOUT(__x, __mask) (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask)) +#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask)) + /* * Define -pg profile entry code. * Must always be noreorder, must never use a macro instruction
CVS commit: src/tools/gcc
Module Name:src Committed By: mrg Date: Wed Aug 12 08:53:20 UTC 2020 Modified Files: src/tools/gcc: mknative-gcc mknative-gcc.old Log Message: mknative-gcc is for GCC 8.4. mknative-gcc.old is supposed to be for GCC 7, but is the GCC 6 version. update it and mark it for GCC 7.5. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/tools/gcc/mknative-gcc cvs rdiff -u -r1.6 -r1.7 src/tools/gcc/mknative-gcc.old Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/gcc/mknative-gcc diff -u src/tools/gcc/mknative-gcc:1.103 src/tools/gcc/mknative-gcc:1.104 --- src/tools/gcc/mknative-gcc:1.103 Thu Oct 24 03:19:14 2019 +++ src/tools/gcc/mknative-gcc Wed Aug 12 08:53:20 2020 @@ -1,10 +1,10 @@ #!/bin/sh -# $NetBSD: mknative-gcc,v 1.103 2019/10/24 03:19:14 christos Exp $ +# $NetBSD: mknative-gcc,v 1.104 2020/08/12 08:53:20 mrg Exp $ # # Shell script for generating all the constants needed for a native # platform build of gcc. # -# This version is for GCC 6.4 +# This version is for GCC 8.4 # initialise Index: src/tools/gcc/mknative-gcc.old diff -u src/tools/gcc/mknative-gcc.old:1.6 src/tools/gcc/mknative-gcc.old:1.7 --- src/tools/gcc/mknative-gcc.old:1.6 Wed Sep 5 01:20:20 2018 +++ src/tools/gcc/mknative-gcc.old Wed Aug 12 08:53:20 2020 @@ -1,10 +1,10 @@ #!/bin/sh -# $NetBSD: mknative-gcc.old,v 1.6 2018/09/05 01:20:20 mrg Exp $ +# $NetBSD: mknative-gcc.old,v 1.7 2020/08/12 08:53:20 mrg Exp $ # # Shell script for generating all the constants needed for a native # platform build of gcc. # -# This version is for GCC 6.4 +# This version is for GCC 7.5 # initialise @@ -24,8 +24,8 @@ fi . $_TOP/tools/gcc/mknative.common -_OUTDIR="$_TOP/external/gpl3/gcc.old" -_OUTDIRBASE="external/gpl3/gcc.old" +_OUTDIR="$_TOP/external/gpl3/gcc" +_OUTDIRBASE="external/gpl3/gcc" sanitise_includes () { sed \ @@ -82,10 +82,18 @@ get_libgcc () { SHLIB_MAPFILES SHLIB_NM_FLAGS getvars gcc/Makefile \ NOEXCEPTION_FLAGS EXTRA_HEADERS - getlinks config.status libgcc } | sanitise_includes \ | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk + cd $_TMPDIR/$_PLATFORM/libgcc + { + getvars $_PLATFORM/libgcc/Makefile \ + enable_execute_stack \ + unwind_header md_unwind_header \ + sfp_machine_header thread_header + } | sanitise_includes \ + | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/gthr-defs.mk + if [ "${MACHINE_ARCH}" = "m68000" ] then ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk @@ -152,6 +160,11 @@ get_libgomp () { _subdir="$1" mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH + + getvars $_PLATFORM/libgomp/Makefile \ + libgomp_la_SOURCES \ + | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk + write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ <$_TMPDIR/$_PLATFORM/libgomp/config.h write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp_f.h \ @@ -169,9 +182,9 @@ get_libbacktrace () { mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ - <$_TMPDIR/$_subdir/config.h + <$_TMPDIR/$_PLATFORM/$_subdir/config.h write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/backtrace-supported.h \ - <$_TMPDIR/$_subdir/backtrace-supported.h + <$_TMPDIR/$_PLATFORM/$_subdir/backtrace-supported.h } # lib/libobjc # @@ -189,7 +202,6 @@ get_libobjc () { getvars $_PLATFORM/libobjc/Makefile \ ALL_CFLAGS INCLUDES OBJC_SOURCE_FILES C_SOURCE_FILES OBJC_H \ | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" - getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc } | sanitise_includes \ | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk @@ -205,7 +217,7 @@ get_libstdcxx_v3 () { mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH - _build_headers="c++config.h cxxabi_tweaks.h gthr-posix.h gthr-single.h gthr.h" + _build_headers="c++config.h cxxabi_tweaks.h" _headers1="c_base_headers_extra_install" _headers1="$_headers1 tr1_headers tr2_headers decimal_headers c_compatibility_headers_install" _headers1="$_headers1 debug_headers parallel_headers" @@ -221,10 +233,15 @@ get_libstdcxx_v3 () { write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \ <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h + write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/symver-config.h \ + <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h { getvars $_PLATFORM/libstdc++-v3/Makefile \ port_specific_symbol_files + getvars $_PLATFORM/libstdc++-v3/src/Makefile \ + cxx11_sources \ + cxx98_sources # libsupc++ getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ @@ -247,6 +264,9 @@ get_libstdcxx_v3 () { GLIBCXX_ABI_FLAGS libc__98convenience_la_SOURCES | \ sed -e 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/' \ -e 's/codecvt.cc/c98-codecvt.cc/' + getvars
CVS commit: src/sys/arch/mips
Module Name:src Committed By: skrll Date: Wed Aug 12 07:37:39 UTC 2020 Modified Files: src/sys/arch/mips/mips: db_interface.c src/sys/arch/mips/rmi: rmixl_cpu.c Log Message: Don't include mips/asm.h from a C file To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/arch/mips/mips/db_interface.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/rmi/rmixl_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/mips/db_interface.c diff -u src/sys/arch/mips/mips/db_interface.c:1.87 src/sys/arch/mips/mips/db_interface.c:1.88 --- src/sys/arch/mips/mips/db_interface.c:1.87 Sat Aug 1 09:29:18 2020 +++ src/sys/arch/mips/mips/db_interface.c Wed Aug 12 07:37:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.87 2020/08/01 09:29:18 skrll Exp $ */ +/* $NetBSD: db_interface.c,v 1.88 2020/08/12 07:37:39 skrll Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.87 2020/08/01 09:29:18 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.88 2020/08/12 07:37:39 skrll Exp $"); #include "opt_multiprocessor.h" #include "opt_cputype.h" /* which mips CPUs do we support? */ @@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface #include -#include #include #include #include Index: src/sys/arch/mips/rmi/rmixl_cpu.c diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.11 src/sys/arch/mips/rmi/rmixl_cpu.c:1.12 --- src/sys/arch/mips/rmi/rmixl_cpu.c:1.11 Tue Dec 3 05:07:48 2019 +++ src/sys/arch/mips/rmi/rmixl_cpu.c Wed Aug 12 07:37:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rmixl_cpu.c,v 1.11 2019/12/03 05:07:48 riastradh Exp $ */ +/* $NetBSD: rmixl_cpu.c,v 1.12 2020/08/12 07:37:39 skrll Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -38,7 +38,7 @@ #include "locators.h" #include -__KERNEL_RCSID(0, "$NetBSD: rmixl_cpu.c,v 1.11 2019/12/03 05:07:48 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rmixl_cpu.c,v 1.12 2020/08/12 07:37:39 skrll Exp $"); #include "opt_multiprocessor.h" #include "opt_ddb.h" @@ -54,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: rmixl_cpu.c, #include #include #include -#include #include #include #include
CVS commit: src
Module Name:src Committed By: mrg Date: Wed Aug 12 06:48:50 UTC 2020 Modified Files: src: UPDATING Log Message: 20200811: GCC updates may require cleaning the objdir. To generate a diff of this commit: cvs rdiff -u -r1.310 -r1.311 src/UPDATING Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/UPDATING diff -u src/UPDATING:1.310 src/UPDATING:1.311 --- src/UPDATING:1.310 Mon Jun 15 21:52:03 2020 +++ src/UPDATING Wed Aug 12 06:48:50 2020 @@ -1,4 +1,4 @@ -$NetBSD: UPDATING,v 1.310 2020/06/15 21:52:03 christos Exp $ +$NetBSD: UPDATING,v 1.311 2020/08/12 06:48:50 mrg Exp $ This file (UPDATING) is intended to be a brief reference to recent changes that might cause problems in the build process, and a guide for @@ -19,6 +19,9 @@ See also: BUILDING, build.sh, Makefile. Recent changes: ^^^ +20200811: + GCC updates may require cleaning the objdir. + 20200614: blacklist* has been renamed to blocklist*. postinstall(8) should handle the migration
CVS commit: src/external/gpl3/gcc/dist/gcc
Module Name:src Committed By: mrg Date: Wed Aug 12 06:42:53 UTC 2020 Removed Files: src/external/gpl3/gcc/dist/gcc: gengtype-lex.c Log Message: delete this file; it needs to be newer than the .l file or else sys.mk will attempt to write it to the source tree, which may be r/o and fail. XXX may cause updates builds to fail because a file listed in .depend won't exist anymore. To generate a diff of this commit: cvs rdiff -u -r1.12 -r0 src/external/gpl3/gcc/dist/gcc/gengtype-lex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.