Re: CVS commit: src/sys/external/bsd/compiler_rt/dist/lib
On Tue, Feb 18, 2014 at 03:54:34PM -0500, Christos Zoulas wrote: Module Name: src Committed By: christos Date: Tue Feb 18 20:54:34 UTC 2014 Modified Files: src/sys/external/bsd/compiler_rt/dist/lib: int_util.h Log Message: prefer __func__ instead of __FUNCTION__ Can we please avoid cosmetic local changes? Joerg
Re: CVS commit: src/sys/external/bsd/compiler_rt/dist/lib
On Tue, Feb 18, 2014 at 03:53:44PM -0500, Christos Zoulas wrote: Module Name: src Committed By: christos Date: Tue Feb 18 20:53:44 UTC 2014 Modified Files: src/sys/external/bsd/compiler_rt/dist/lib: int_util.c Log Message: - include sys/cdefs.h for compiler definitions - add a lint comment Please revert this, it doesn't add value and it makes it harder to deal with prestine upstream. More importantly, please bring up such changes upstream first. Joerg
CVS commit: src/common/lib/libc
Module Name:src Committed By: martin Date: Tue Feb 18 10:16:55 UTC 2014 Modified Files: src/common/lib/libc/arch/i386/atomic: Makefile.inc atomic.S Added Files: src/common/lib/libc/atomic: atomic_cas_64_cas.c atomic_nand_64_cas.c atomic_sub_64_cas.c atomic_xor_64_cas.c Log Message: Provide most missing __sync_*64 primitives for i386 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/i386/atomic/Makefile.inc cvs rdiff -u -r1.19 -r1.20 src/common/lib/libc/arch/i386/atomic/atomic.S cvs rdiff -u -r0 -r1.1 src/common/lib/libc/atomic/atomic_cas_64_cas.c \ src/common/lib/libc/atomic/atomic_nand_64_cas.c \ src/common/lib/libc/atomic/atomic_sub_64_cas.c \ src/common/lib/libc/atomic/atomic_xor_64_cas.c 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/i386/atomic/Makefile.inc diff -u src/common/lib/libc/arch/i386/atomic/Makefile.inc:1.7 src/common/lib/libc/arch/i386/atomic/Makefile.inc:1.8 --- src/common/lib/libc/arch/i386/atomic/Makefile.inc:1.7 Sun Jan 4 17:54:29 2009 +++ src/common/lib/libc/arch/i386/atomic/Makefile.inc Tue Feb 18 10:16:55 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.7 2009/01/04 17:54:29 pooka Exp $ +# $NetBSD: Makefile.inc,v 1.8 2014/02/18 10:16:55 martin Exp $ .if defined(LIB) (${LIB} == kern || ${LIB} == c || ${LIB} == pthread \ || ${LIB} == rump) @@ -6,7 +6,9 @@ SRCS+= atomic_add_64_cas.c atomic_add_64_nv_cas.c atomic_and_64_cas.c \ atomic_and_64_nv_cas.c atomic_dec_64_cas.c atomic_dec_64_nv_cas.c \ atomic_inc_64_cas.c atomic_inc_64_nv_cas.c atomic_or_64_cas.c \ - atomic_or_64_nv_cas.c atomic_swap_64_cas.c atomic.S + atomic_or_64_nv_cas.c atomic_swap_64_cas.c atomic.S \ + atomic_nand_64_cas.c atomic_xor_64_cas.c atomic_sub_64_cas.c \ + atomic_cas_64_cas.c .endif Index: src/common/lib/libc/arch/i386/atomic/atomic.S diff -u src/common/lib/libc/arch/i386/atomic/atomic.S:1.19 src/common/lib/libc/arch/i386/atomic/atomic.S:1.20 --- src/common/lib/libc/arch/i386/atomic/atomic.S:1.19 Wed Jan 12 23:12:10 2011 +++ src/common/lib/libc/arch/i386/atomic/atomic.S Tue Feb 18 10:16:55 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.S,v 1.19 2011/01/12 23:12:10 joerg Exp $ */ +/* $NetBSD: atomic.S,v 1.20 2014/02/18 10:16:55 martin Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -321,6 +321,7 @@ ALIAS(atomic_cas_ptr_ni,_atomic_cas_32_n ALIAS(atomic_cas_64,_atomic_cas_64) ALIAS(atomic_cas_64_ni,_atomic_cas_64) +ALIAS(__sync_val_compare_and_swap_8,_atomic_cas_64) ALIAS(membar_consumer,_membar_consumer) ALIAS(membar_producer,_membar_producer) Added files: Index: src/common/lib/libc/atomic/atomic_cas_64_cas.c diff -u /dev/null src/common/lib/libc/atomic/atomic_cas_64_cas.c:1.1 --- /dev/null Tue Feb 18 10:16:55 2014 +++ src/common/lib/libc/atomic/atomic_cas_64_cas.c Tue Feb 18 10:16:55 2014 @@ -0,0 +1,47 @@ +/* $NetBSD: atomic_cas_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $ */ + +/*- + * Copyright (c) 2014 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * 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 stdbool.h +#include sys/atomic.h + +#ifdef __HAVE_ATOMIC64_OPS + +bool bool_compare_and_swap_8(volatile uint64_t *, uint64_t, uint64_t, ...) +asm(__sync_bool_compare_and_swap_8); + +bool +bool_compare_and_swap_8(volatile uint64_t *addr, uint64_t oldval, + uint64_t newval, ...) +{ + return atomic_cas_64(addr, oldval, newval) == oldval; +} + +#endif Index:
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Tue Feb 18 10:27:46 UTC 2014 Modified Files: src/tests/lib/libc/sync: all_sync_ops_linkable.c Log Message: For now excempt i386 from __sync_lock_test_and_set_8 and point to PR lib/48601. Probably more architectures to follow. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sync/all_sync_ops_linkable.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/all_sync_ops_linkable.c diff -u src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.2 src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.3 --- src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.2 Mon Feb 17 21:38:04 2014 +++ src/tests/lib/libc/sync/all_sync_ops_linkable.c Tue Feb 18 10:27:46 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: all_sync_ops_linkable.c,v 1.2 2014/02/17 21:38:04 joerg Exp $ */ +/* $NetBSD: all_sync_ops_linkable.c,v 1.3 2014/02/18 10:27:46 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -124,8 +124,17 @@ main(int argc, char **argv) __sync_lock_test_and_set_2(u16, 5); __sync_lock_test_and_set_4(u32, 5); #ifdef __HAVE_ATOMIC64_OPS + + /* + * See PR lib/48601: + * some architectures do not implement this, allow them to build + * anyway. + */ +#if !defined(__i386__) __sync_lock_test_and_set_8(u64, 5); #endif + +#endif #ifndef __clang__ __sync_nand_and_fetch(u8, 5); __sync_nand_and_fetch_1(u8, 5);
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: martin Date: Tue Feb 18 12:23:07 UTC 2014 Modified Files: src/common/lib/libc/atomic: atomic_cas_64_cas.c Log Message: Do not include stdbool.h in the kernel To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_cas_64_cas.c 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/atomic/atomic_cas_64_cas.c diff -u src/common/lib/libc/atomic/atomic_cas_64_cas.c:1.1 src/common/lib/libc/atomic/atomic_cas_64_cas.c:1.2 --- src/common/lib/libc/atomic/atomic_cas_64_cas.c:1.1 Tue Feb 18 10:16:55 2014 +++ src/common/lib/libc/atomic/atomic_cas_64_cas.c Tue Feb 18 12:23:07 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_cas_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $ */ +/* $NetBSD: atomic_cas_64_cas.c,v 1.2 2014/02/18 12:23:07 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -29,7 +29,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#if !defined(_KERNEL) !defined(_STANDALONE) #include stdbool.h +#endif #include sys/atomic.h #ifdef __HAVE_ATOMIC64_OPS
CVS commit: src/sys/arch/powerpc/oea
Module Name:src Committed By: macallan Date: Tue Feb 18 12:27:15 UTC 2014 Modified Files: src/sys/arch/powerpc/oea: ofw_autoconf.c Log Message: when looking for SCSI disks in canonicalize_bootpath() also match 'disk@' since that's what at least some Adaptec firmware uses To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/oea/ofw_autoconf.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/powerpc/oea/ofw_autoconf.c diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.19 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20 --- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.19 Sun May 12 13:23:08 2013 +++ src/sys/arch/powerpc/oea/ofw_autoconf.c Tue Feb 18 12:27:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ofw_autoconf.c,v 1.19 2013/05/12 13:23:08 macallan Exp $ */ +/* $NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 TooLs GmbH. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.19 2013/05/12 13:23:08 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $); #ifdef ofppc #include gtpci.h @@ -168,12 +168,15 @@ canonicalize_bootpath(void) /* * OF_1.x (at least) always returns addr == 0 for * SCSI disks (i.e. /bandit@.../.../sd@0,0). + * also check for .../disk@ which some Adaptec firmware uses */ lastp = strrchr(cbootpath, '/'); if (lastp != NULL) { lastp++; - if (strncmp(lastp, sd@, 3) == 0 - strncmp(last, sd@, 3) == 0) + if ((strncmp(lastp, sd@, 3) == 0 + strncmp(last, sd@, 3) == 0) || + (strncmp(lastp, disk@, 5) == 0 + strncmp(last, disk@, 5) == 0)) strcpy(lastp, last); } else { lastp = cbootpath;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: macallan Date: Tue Feb 18 12:32:13 UTC 2014 Modified Files: src/sys/dev/pci: ahc_pci.c Log Message: if MMIO is allowed and available, prefer it over PIO now my ADPT,2930CU works again To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/ahc_pci.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/ahc_pci.c diff -u src/sys/dev/pci/ahc_pci.c:1.68 src/sys/dev/pci/ahc_pci.c:1.69 --- src/sys/dev/pci/ahc_pci.c:1.68 Thu Nov 26 15:17:08 2009 +++ src/sys/dev/pci/ahc_pci.c Tue Feb 18 12:32:12 2014 @@ -39,7 +39,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: ahc_pci.c,v 1.68 2009/11/26 15:17:08 njoly Exp $ + * $Id: ahc_pci.c,v 1.69 2014/02/18 12:32:12 macallan Exp $ * * //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#57 $ * @@ -50,7 +50,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ahc_pci.c,v 1.68 2009/11/26 15:17:08 njoly Exp $); +__KERNEL_RCSID(0, $NetBSD: ahc_pci.c,v 1.69 2014/02/18 12:32:12 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -833,20 +833,22 @@ ahc_pci_attach(device_t parent, device_t ioh_valid = (pci_mapreg_map(pa, AHC_PCI_IOADDR, PCI_MAPREG_TYPE_IO, 0, iot, ioh, NULL, NULL) == 0); + #if 0 printf(%s: bus info: memt 0x%lx, memh 0x%lx, iot 0x%lx, ioh 0x%lx\n, ahc_name(ahc), (u_long)memt, (u_long)memh, (u_long)iot, (u_long)ioh); #endif - if (ioh_valid) { - st = iot; - sh = ioh; #ifdef AHC_ALLOW_MEMIO - } else if (memh_valid) { + if (memh_valid) { st = memt; sh = memh; + } else #endif + if (ioh_valid) { + st = iot; + sh = ioh; } else { printf(: unable to map registers\n); return;
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: martin Date: Tue Feb 18 13:21:04 UTC 2014 Modified Files: src/common/lib/libc/atomic: atomic_nand_64_cas.c atomic_sub_64_cas.c atomic_xor_64_cas.c Log Message: Make the _and_fetch_8 primitives return the new value they calculated and set - not whatever is found in memory later. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_nand_64_cas.c \ src/common/lib/libc/atomic/atomic_sub_64_cas.c \ src/common/lib/libc/atomic/atomic_xor_64_cas.c 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/atomic/atomic_nand_64_cas.c diff -u src/common/lib/libc/atomic/atomic_nand_64_cas.c:1.1 src/common/lib/libc/atomic/atomic_nand_64_cas.c:1.2 --- src/common/lib/libc/atomic/atomic_nand_64_cas.c:1.1 Tue Feb 18 10:16:55 2014 +++ src/common/lib/libc/atomic/atomic_nand_64_cas.c Tue Feb 18 13:21:04 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_nand_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $ */ +/* $NetBSD: atomic_nand_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ nand_and_fetch_8(volatile uint64_t *addr old = *addr; new = ~(old val); } while (atomic_cas_64(addr, old, new) != old); - return *addr; + return new; } #endif Index: src/common/lib/libc/atomic/atomic_sub_64_cas.c diff -u src/common/lib/libc/atomic/atomic_sub_64_cas.c:1.1 src/common/lib/libc/atomic/atomic_sub_64_cas.c:1.2 --- src/common/lib/libc/atomic/atomic_sub_64_cas.c:1.1 Tue Feb 18 10:16:55 2014 +++ src/common/lib/libc/atomic/atomic_sub_64_cas.c Tue Feb 18 13:21:04 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_sub_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $ */ +/* $NetBSD: atomic_sub_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ sub_and_fetch_8(volatile uint64_t *addr, old = *addr; new = old - val; } while (atomic_cas_64(addr, old, new) != old); - return *addr; + return new; } #endif Index: src/common/lib/libc/atomic/atomic_xor_64_cas.c diff -u src/common/lib/libc/atomic/atomic_xor_64_cas.c:1.1 src/common/lib/libc/atomic/atomic_xor_64_cas.c:1.2 --- src/common/lib/libc/atomic/atomic_xor_64_cas.c:1.1 Tue Feb 18 10:16:55 2014 +++ src/common/lib/libc/atomic/atomic_xor_64_cas.c Tue Feb 18 13:21:04 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_xor_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $ */ +/* $NetBSD: atomic_xor_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ xor_and_fetch_8(volatile uint64_t *addr, old = *addr; new = old ^ val; } while (atomic_cas_64(addr, old, new) != old); - return *addr; + return new; } #endif
CVS commit: src/common/lib/libc/arch/m68k/atomic
Module Name:src Committed By: martin Date: Tue Feb 18 16:19:28 UTC 2014 Modified Files: src/common/lib/libc/arch/m68k/atomic: atomic_add.S atomic_cas.S atomic_swap.S Log Message: Add a few __sync_* and atomic functions. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/m68k/atomic/atomic_add.S \ src/common/lib/libc/arch/m68k/atomic/atomic_swap.S cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/m68k/atomic/atomic_cas.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/m68k/atomic/atomic_add.S diff -u src/common/lib/libc/arch/m68k/atomic/atomic_add.S:1.6 src/common/lib/libc/arch/m68k/atomic/atomic_add.S:1.7 --- src/common/lib/libc/arch/m68k/atomic/atomic_add.S:1.6 Tue Jul 16 23:24:18 2013 +++ src/common/lib/libc/arch/m68k/atomic/atomic_add.S Tue Feb 18 16:19:28 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_add.S,v 1.6 2013/07/16 23:24:18 matt Exp $ */ +/* $NetBSD: atomic_add.S,v 1.7 2014/02/18 16:19:28 martin Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -66,3 +66,28 @@ ATOMIC_OP_ALIAS(atomic_add_long_nv,_atom STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) +STRONG_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv) + +ENTRY(_atomic_add_16_nv) + movl 4(%sp), %a0 +1: movw (%a0), %d0 + movw %d0, %d1 + addw 8(%sp), %d0 + casw %d1, %d0, (%a0) + bne 1b + rts +END(_atomic_add_16_nv) + +STRONG_ALIAS(__sync_add_and_fetch_2,_atomic_add_16_nv) + +ENTRY(_atomic_add_8_nv) + movl 4(%sp), %a0 +1: movb (%a0), %d0 + movb %d0, %d1 + addb 8(%sp), %d0 + casb %d1, %d0, (%a0) + bne 1b + rts +END(_atomic_add_8_nv) + +STRONG_ALIAS(__sync_add_and_fetch_1,_atomic_add_8_nv) Index: src/common/lib/libc/arch/m68k/atomic/atomic_swap.S diff -u src/common/lib/libc/arch/m68k/atomic/atomic_swap.S:1.6 src/common/lib/libc/arch/m68k/atomic/atomic_swap.S:1.7 --- src/common/lib/libc/arch/m68k/atomic/atomic_swap.S:1.6 Tue Jul 16 23:24:18 2013 +++ src/common/lib/libc/arch/m68k/atomic/atomic_swap.S Tue Feb 18 16:19:28 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap.S,v 1.6 2013/07/16 23:24:18 matt Exp $ */ +/* $NetBSD: atomic_swap.S,v 1.7 2014/02/18 16:19:28 martin Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -50,3 +50,29 @@ ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomi STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_32) STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) +STRONG_ALIAS(__sync_lock_test_and_set_4,_atomic_swap_32) + + +ENTRY(_atomic_swap_16) + movl 4(%sp), %a0 +1: movw (%a0), %d0 + movw 8(%sp), %d1 + casw %d0, %d1, (%a0) + bne 1b + /* %d0 now contains the old value */ + rts +END(_atomic_swap_16) +ATOMIC_OP_ALIAS(atomic_swap_16,_atomic_swap_16) +STRONG_ALIAS(__sync_lock_test_and_set_2,_atomic_swap_16) + +ENTRY(_atomic_swap_8) + movl 4(%sp), %a0 +1: movb (%a0), %d0 + movb 8(%sp), %d1 + casb %d0, %d1, (%a0) + bne 1b + /* %d0 now contains the old value */ + rts +END(_atomic_swap_8) +ATOMIC_OP_ALIAS(atomic_swap_8,_atomic_swap_8) +STRONG_ALIAS(__sync_lock_test_and_set_1,_atomic_swap_8) Index: src/common/lib/libc/arch/m68k/atomic/atomic_cas.S diff -u src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.7 src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.8 --- src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.7 Tue Jul 16 23:24:18 2013 +++ src/common/lib/libc/arch/m68k/atomic/atomic_cas.S Tue Feb 18 16:19:28 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_cas.S,v 1.7 2013/07/16 23:24:18 matt Exp $ */ +/* $NetBSD: atomic_cas.S,v 1.8 2014/02/18 16:19:28 martin Exp $ */ /*- * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. @@ -50,6 +50,7 @@ ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) +STRONG_ALIAS(__sync_val_compare_and_swap_4,_atomic_cas_32) ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32) @@ -59,3 +60,71 @@ ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_ato STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32) ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32) STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32) + +ENTRY(__sync_bool_compare_and_swap_4) + movl 4(%sp), %a0 + movl 8(%sp), %d3 + movl %d3, %d2 + movl 12(%sp), %d1 + casl %d3, %d1, (%a0) + /* %d3 now contains the old value */ + clrl %d0 /* assume it did not work */ + cmpl %d3, %d2 + bne 1f + movl #1, %d0 /* return success */ +1: rts +END(__sync_bool_compare_and_swap_4) + +ENTRY(_atomic_cas_16) + movl 4(%sp), %a0 + movw 8(%sp), %d0 + movw 10(%sp), %d1 + casw %d0, %d1, (%a0) + /* %d0 now contains the old value */ + rts +END(_atomic_cas_16) + +ATOMIC_OP_ALIAS(atomic_cas_16,_atomic_cas_16)
CVS commit: src/sys/arch
Module Name:src Committed By: dsl Date: Tue Feb 18 18:39:11 UTC 2014 Modified Files: src/sys/arch/x86/include: cpu_extended_state.h Added Files: src/sys/arch/amd64/include: fpu.h Log Message: It seems that firefox includes machine/fpu.h on amd64. Add the file back so that the firwfox source doesn't have to depend on the version of netbsd it is being compiled for. (The i386 version doesn't play the same games in its SIGFPE handler.) To generate a diff of this commit: cvs rdiff -u -r0 -r1.14 src/sys/arch/amd64/include/fpu.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/include/cpu_extended_state.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/x86/include/cpu_extended_state.h diff -u src/sys/arch/x86/include/cpu_extended_state.h:1.7 src/sys/arch/x86/include/cpu_extended_state.h:1.8 --- src/sys/arch/x86/include/cpu_extended_state.h:1.7 Sat Feb 15 10:11:15 2014 +++ src/sys/arch/x86/include/cpu_extended_state.h Tue Feb 18 18:39:10 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_extended_state.h,v 1.7 2014/02/15 10:11:15 dsl Exp $ */ +/* $NetBSD: cpu_extended_state.h,v 1.8 2014/02/18 18:39:10 dsl Exp $ */ #ifndef _X86_CPU_EXTENDED_STATE_H_ #define _X86_CPU_EXTENDED_STATE_H_ @@ -115,11 +115,6 @@ struct fxsave { } __aligned(16); __CTASSERT_NOLINT(sizeof (struct fxsave) == 512); -#ifndef _KERNEL -/* Backwards compatibility for firefox (looks at fx_xmm) */ -#define fxsave64 fxsave -#endif - /* The end of the fsave buffer can be used by the operating system */ struct fxsave_os { uint8_t fxo_fxsave[512 - 48]; Added files: Index: src/sys/arch/amd64/include/fpu.h diff -u /dev/null src/sys/arch/amd64/include/fpu.h:1.14 --- /dev/null Tue Feb 18 18:39:11 2014 +++ src/sys/arch/amd64/include/fpu.h Tue Feb 18 18:39:11 2014 @@ -0,0 +1,14 @@ +#ifndef _AMD64_FPU_H_ +#define _AMD64_FPU_H_ + +/* + * This file is only present for backwards compatibility with + * a few user programs, particularly firefox. + */ + +#ifndef _KERNEL +#define fxsave64 fxsave +#include x86/cpu_extended_state.h +#endif + +#endif
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: christos Date: Tue Feb 18 20:43:36 UTC 2014 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: __real__ and __imag__ produce lvalues To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.73 src/usr.bin/xlint/lint1/tree.c:1.74 --- src/usr.bin/xlint/lint1/tree.c:1.73 Fri Apr 19 14:51:14 2013 +++ src/usr.bin/xlint/lint1/tree.c Tue Feb 18 15:43:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.73 2013/04/19 18:51:14 christos Exp $ */ +/* $NetBSD: tree.c,v 1.74 2014/02/18 20:43:36 christos Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: tree.c,v 1.73 2013/04/19 18:51:14 christos Exp $); +__RCSID($NetBSD: tree.c,v 1.74 2014/02/18 20:43:36 christos Exp $); #endif #include stdlib.h @@ -2332,6 +2332,7 @@ bldri(op_t op, tnode_t *ln) return NULL; } ntn = mktnode(op, cn-tn_type, ln, cn); + ntn-tn_lvalue = 1; return (ntn); }
CVS commit: src/sys/external/bsd/compiler_rt/dist/lib
Module Name:src Committed By: christos Date: Tue Feb 18 20:53:44 UTC 2014 Modified Files: src/sys/external/bsd/compiler_rt/dist/lib: int_util.c Log Message: - include sys/cdefs.h for compiler definitions - add a lint comment To generate a diff of this commit: cvs rdiff -u -r1.1.1.2 -r1.2 \ src/sys/external/bsd/compiler_rt/dist/lib/int_util.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/external/bsd/compiler_rt/dist/lib/int_util.c diff -u src/sys/external/bsd/compiler_rt/dist/lib/int_util.c:1.1.1.2 src/sys/external/bsd/compiler_rt/dist/lib/int_util.c:1.2 --- src/sys/external/bsd/compiler_rt/dist/lib/int_util.c:1.1.1.2 Wed Jan 15 16:06:10 2014 +++ src/sys/external/bsd/compiler_rt/dist/lib/int_util.c Tue Feb 18 15:53:44 2014 @@ -7,7 +7,7 @@ * * ===--=== */ - +#include sys/cdefs.h #include int_util.h #include int_lib.h @@ -54,6 +54,7 @@ void compilerrt_abort_impl(const char *f __attribute__((weak)) __attribute__((visibility(hidden))) #endif +/*ARGSUSED*/ void compilerrt_abort_impl(const char *file, int line, const char *function) { abort(); }
CVS commit: src/sys/external/bsd/compiler_rt/dist/lib
Module Name:src Committed By: christos Date: Tue Feb 18 20:54:34 UTC 2014 Modified Files: src/sys/external/bsd/compiler_rt/dist/lib: int_util.h Log Message: prefer __func__ instead of __FUNCTION__ To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/compiler_rt/dist/lib/int_util.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/external/bsd/compiler_rt/dist/lib/int_util.h diff -u src/sys/external/bsd/compiler_rt/dist/lib/int_util.h:1.1.1.1 src/sys/external/bsd/compiler_rt/dist/lib/int_util.h:1.2 --- src/sys/external/bsd/compiler_rt/dist/lib/int_util.h:1.1.1.1 Thu Jul 4 18:09:52 2013 +++ src/sys/external/bsd/compiler_rt/dist/lib/int_util.h Tue Feb 18 15:54:34 2014 @@ -20,8 +20,7 @@ #define INT_UTIL_H /** \brief Trigger a program abort (or panic for kernel code). */ -#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \ - __FUNCTION__) +#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, __func__) void compilerrt_abort_impl(const char *file, int line, const char *function) __attribute__((noreturn));
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: christos Date: Tue Feb 18 22:01:37 UTC 2014 Modified Files: src/usr.bin/xlint/lint1: cgram.y err.c scan.l tree.c Log Message: add __extension__ and typeof To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.53 -r1.54 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.74 -r1.75 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.57 src/usr.bin/xlint/lint1/cgram.y:1.58 --- src/usr.bin/xlint/lint1/cgram.y:1.57 Tue Feb 4 03:08:59 2014 +++ src/usr.bin/xlint/lint1/cgram.y Tue Feb 18 17:01:36 2014 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.57 2014/02/04 08:08:59 njoly Exp $ */ +/* $NetBSD: cgram.y,v 1.58 2014/02/18 22:01:36 christos Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: cgram.y,v 1.57 2014/02/04 08:08:59 njoly Exp $); +__RCSID($NetBSD: cgram.y,v 1.58 2014/02/18 22:01:36 christos Exp $); #endif #include stdlib.h @@ -130,6 +130,8 @@ static inline void RESTORE(const char *f %token y_op T_UNOP %token y_op T_INCDEC %token T_SIZEOF +%token T_TYPEOF +%token T_EXTENSION %token T_ALIGNOF %token y_op T_MULT %token y_op T_DIVOP @@ -553,6 +555,9 @@ notype_typespec: T_TYPE { $$ = gettyp($1); } + | T_TYPEOF T_LPARN term T_RPARN { + $$ = $3-tn_type; + } | struct_spec { popdecl(); $$ = $1; @@ -1732,6 +1737,9 @@ term: | T_IMAG T_LPARN term T_RPARN { $$ = build(IMAG, $3, NULL); } + | T_EXTENSION T_LPARN term T_RPARN { + $$ = $3; + } | T_SIZEOF term %prec T_SIZEOF { if (($$ = $2 == NULL ? NULL : bldszof($2-tn_type)) != NULL) chkmisc($2, 0, 0, 0, 0, 0, 1); Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.46 src/usr.bin/xlint/lint1/err.c:1.47 --- src/usr.bin/xlint/lint1/err.c:1.46 Fri Apr 19 13:43:05 2013 +++ src/usr.bin/xlint/lint1/err.c Tue Feb 18 17:01:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.46 2013/04/19 17:43:05 christos Exp $ */ +/* $NetBSD: err.c,v 1.47 2014/02/18 22:01:36 christos Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: err.c,v 1.46 2013/04/19 17:43:05 christos Exp $); +__RCSID($NetBSD: err.c,v 1.47 2014/02/18 22:01:36 christos Exp $); #endif #include sys/types.h @@ -208,7 +208,7 @@ const char *msgs[] = { cannot take size/alignment of void, /* 146 */ invalid cast expression, /* 147 */ improper cast of void expression, /* 148 */ - illegal function, /* 149 */ + illegal function (type %s), /* 149 */ argument mismatch: %d arg%s passed, %d expected, /* 150 */ void expressions may not be arguments, arg #%d, /* 151 */ argument cannot have unknown size, arg #%d, /* 152 */ Index: src/usr.bin/xlint/lint1/scan.l diff -u src/usr.bin/xlint/lint1/scan.l:1.53 src/usr.bin/xlint/lint1/scan.l:1.54 --- src/usr.bin/xlint/lint1/scan.l:1.53 Fri Oct 18 16:46:09 2013 +++ src/usr.bin/xlint/lint1/scan.l Tue Feb 18 17:01:36 2014 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: scan.l,v 1.53 2013/10/18 20:46:09 christos Exp $ */ +/* $NetBSD: scan.l,v 1.54 2014/02/18 22:01:36 christos Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: scan.l,v 1.53 2013/10/18 20:46:09 christos Exp $); +__RCSID($NetBSD: scan.l,v 1.54 2014/02/18 22:01:36 christos Exp $); #endif #include stdlib.h @@ -230,6 +230,7 @@ static struct kwtab { { double, T_TYPE, 0, DOUBLE, 0, 0, 0, 0 }, { else, T_ELSE, 0, 0, 0, 0, 0, 0 }, { enum, T_ENUM, 0, 0, 0, 0, 0, 0 }, + { __extension__, T_EXTENSION, 0, 0, 0, 0, 0, 1 }, { extern, T_SCLASS, EXTERN, 0, 0, 0, 0, 0 }, { float, T_TYPE, 0, FLOAT, 0, 0, 0, 0 }, { for, T_FOR, 0, 0, 0, 0, 0, 0 }, @@ -256,6 +257,9 @@ static struct kwtab { { struct, T_SOU, 0, STRUCT, 0, 0, 0, 0 }, { switch, T_SWITCH, 0, 0, 0, 0, 0, 0 }, { typedef, T_SCLASS, TYPEDEF, 0, 0, 0, 0, 0 }, + { typeof, T_TYPEOF, 0, 0, 0, 0, 0, 1 }, + { __typeof, T_TYPEOF, 0, 0, 0, 0, 0, 1 }, + { __typeof__, T_TYPEOF, 0, 0, 0, 0, 0, 1 }, { union, T_SOU, 0, UNION, 0, 0, 0, 0 }, { unsigned, T_TYPE, 0, UNSIGN, 0, 0, 0, 0 }, { void, T_TYPE, 0, VOID, 0, 0, 0, 0 }, Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.74 src/usr.bin/xlint/lint1/tree.c:1.75 --- src/usr.bin/xlint/lint1/tree.c:1.74 Tue Feb 18 15:43:36 2014 +++ src/usr.bin/xlint/lint1/tree.c Tue Feb 18 17:01:36 2014 @@ -1,4 +1,4 @@ -/*
CVS commit: src/distrib/sets/lists/comp
Module Name:src Committed By: dsl Date: Tue Feb 18 22:03:52 UTC 2014 Modified Files: src/distrib/sets/lists/comp: md.amd64 Log Message: Unobsolete fpu.h To generate a diff of this commit: cvs rdiff -u -r1.215 -r1.216 src/distrib/sets/lists/comp/md.amd64 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/md.amd64 diff -u src/distrib/sets/lists/comp/md.amd64:1.215 src/distrib/sets/lists/comp/md.amd64:1.216 --- src/distrib/sets/lists/comp/md.amd64:1.215 Thu Feb 13 17:42:24 2014 +++ src/distrib/sets/lists/comp/md.amd64 Tue Feb 18 22:03:52 2014 @@ -1,4 +1,4 @@ -# $NetBSD: md.amd64,v 1.215 2014/02/13 17:42:24 dsl Exp $ +# $NetBSD: md.amd64,v 1.216 2014/02/18 22:03:52 dsl Exp $ ./usr/include/amd64comp-c-include ./usr/include/amd64/ansi.h comp-c-include @@ -19,7 +19,7 @@ ./usr/include/amd64/endian_machdep.h comp-c-include ./usr/include/amd64/fenv.h comp-c-include ./usr/include/amd64/float.h comp-c-include -./usr/include/amd64/fpu.h comp-c-include obsolete +./usr/include/amd64/fpu.h comp-c-include ./usr/include/amd64/frame.h comp-c-include ./usr/include/amd64/frame_regs.h comp-c-include ./usr/include/amd64/gdt.h comp-c-include
CVS commit: src/sys/arch/amd64/include
Module Name:src Committed By: dsl Date: Tue Feb 18 22:05:56 UTC 2014 Modified Files: src/sys/arch/amd64/include: Makefile Log Message: Copy fpu.h to release To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/Makefile 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/amd64/include/Makefile diff -u src/sys/arch/amd64/include/Makefile:1.16 src/sys/arch/amd64/include/Makefile:1.17 --- src/sys/arch/amd64/include/Makefile:1.16 Tue Feb 11 20:17:16 2014 +++ src/sys/arch/amd64/include/Makefile Tue Feb 18 22:05:56 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.16 2014/02/11 20:17:16 dsl Exp $ +# $NetBSD: Makefile,v 1.17 2014/02/18 22:05:56 dsl Exp $ INCSDIR= /usr/include/amd64 @@ -7,7 +7,7 @@ INCS= ansi.h aout_machdep.h asm.h \ cdefs.h cpu.h \ disklabel.h \ elf_machdep.h endian.h endian_machdep.h \ - float.h frame.h frame_regs.h \ + float.h fpu.h frame.h frame_regs.h \ gdt.h \ ieee.h ieeefp.h fenv.h \ int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
CVS commit: src/usr.sbin/npf/npfctl
Module Name:src Committed By: rmind Date: Wed Feb 19 01:43:17 UTC 2014 Modified Files: src/usr.sbin/npf/npfctl: npf_show.c Log Message: npfctl_print_nat: fix the byte-order of the port. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/npf/npfctl/npf_show.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.sbin/npf/npfctl/npf_show.c diff -u src/usr.sbin/npf/npfctl/npf_show.c:1.11 src/usr.sbin/npf/npfctl/npf_show.c:1.12 --- src/usr.sbin/npf/npfctl/npf_show.c:1.11 Wed Feb 12 01:42:50 2014 +++ src/usr.sbin/npf/npfctl/npf_show.c Wed Feb 19 01:43:16 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: npf_show.c,v 1.11 2014/02/12 01:42:50 rmind Exp $ */ +/* $NetBSD: npf_show.c,v 1.12 2014/02/19 01:43:16 rmind Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: npf_show.c,v 1.11 2014/02/12 01:42:50 rmind Exp $); +__RCSID($NetBSD: npf_show.c,v 1.12 2014/02/19 01:43:16 rmind Exp $); #include sys/socket.h #include netinet/in.h @@ -390,7 +390,7 @@ npfctl_print_nat(npf_conf_info_t *ctx, n seg = npfctl_print_addrmask(alen, addr, NPF_NO_NETMASK); if (port) { char *p; - easprintf(p, %s port %u, seg, port); + easprintf(p, %s port %u, seg, ntohs(port)); free(seg), seg = p; } seg1 = seg2 = any;
CVS commit: src/sys/net/npf
Module Name:src Committed By: rmind Date: Wed Feb 19 03:51:31 UTC 2014 Modified Files: src/sys/net/npf: npf_alg_icmp.c npf_impl.h npf_inet.c npf_nat.c Log Message: NPF: fix the recent breakage of the traceroute ALG. Also, simplify and refactor a little bit. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/net/npf/npf_alg_icmp.c cvs rdiff -u -r1.48 -r1.49 src/sys/net/npf/npf_impl.h cvs rdiff -u -r1.29 -r1.30 src/sys/net/npf/npf_inet.c cvs rdiff -u -r1.25 -r1.26 src/sys/net/npf/npf_nat.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/net/npf/npf_alg_icmp.c diff -u src/sys/net/npf/npf_alg_icmp.c:1.19 src/sys/net/npf/npf_alg_icmp.c:1.20 --- src/sys/net/npf/npf_alg_icmp.c:1.19 Sun Feb 16 22:10:40 2014 +++ src/sys/net/npf/npf_alg_icmp.c Wed Feb 19 03:51:31 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: npf_alg_icmp.c,v 1.19 2014/02/16 22:10:40 rmind Exp $ */ +/* $NetBSD: npf_alg_icmp.c,v 1.20 2014/02/19 03:51:31 rmind Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: npf_alg_icmp.c,v 1.19 2014/02/16 22:10:40 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: npf_alg_icmp.c,v 1.20 2014/02/19 03:51:31 rmind Exp $); #include sys/param.h #include sys/module.h @@ -305,6 +305,7 @@ npfa_icmp_session(npf_cache_t *npc, nbuf static bool npfa_icmp_nat(npf_cache_t *npc, nbuf_t *nbuf, npf_nat_t *nt, bool forw) { + const u_int which = NPF_SRC; npf_cache_t enpc; if (forw || !npf_iscached(npc, NPC_ICMP)) @@ -315,6 +316,9 @@ npfa_icmp_nat(npf_cache_t *npc, nbuf_t * KASSERT(npf_iscached(enpc, NPC_IP46)); KASSERT(npf_iscached(enpc, NPC_LAYER4)); + /* + * ICMP: fetch the current checksum we are going to fixup. + */ struct icmp *ic = npc-npc_l4.icmp; uint16_t cksum = ic-icmp_cksum; @@ -322,12 +326,9 @@ npfa_icmp_nat(npf_cache_t *npc, nbuf_t * offsetof(struct icmp6_hdr, icmp6_cksum)); /* - * Retrieve the original address and port, then calculate ICMP - * checksum for these changes in the embedded packet. While data - * is not rewritten in the cache, save IP and TCP/UDP checksums. - * - * XXX: Assumes NPF_NATOUT (source address/port). Currently, - * npfa_icmp_match() matches only for the PFIL_OUT traffic. + * Fetch the IP and port in the _embedded_ packet. Also, fetch + * the IPv4 and TCP/UDP checksums before they are rewritten. + * Calculate the part of the ICMP checksum fixup. */ const int proto = enpc.npc_proto; uint16_t ipcksum = 0, l4cksum = 0; @@ -340,7 +341,7 @@ npfa_icmp_nat(npf_cache_t *npc, nbuf_t * const struct ip *eip = enpc.npc_ip.v4; ipcksum = eip-ip_sum; } - cksum = npf_addr_cksum(cksum, enpc.npc_alen, enpc.npc_ips[NPF_SRC], addr); + cksum = npf_addr_cksum(cksum, enpc.npc_alen, enpc.npc_ips[which], addr); switch (proto) { case IPPROTO_TCP: { @@ -363,17 +364,23 @@ npfa_icmp_nat(npf_cache_t *npc, nbuf_t * } /* - * Rewrite the source IP address and port of the embedded IP header, - * which represents the original packet. This updates the checksums - * in the embedded packet. + * Translate the embedded packet. The following changes will + * be performed by npf_napt_rwr(): + * + * 1) Rewrite the IP address and, if not ICMP, port. + * 2) Rewrite the TCP/UDP checksum (if not ICMP). + * 3) Rewrite the IPv4 checksum for (1) and (2). + * + * XXX: Assumes NPF_NATOUT (source address/port). Currently, + * npfa_icmp_match() matches only for the PFIL_OUT traffic. */ - if (npf_nat_translate(enpc, nbuf, nt, forw)) { + if (npf_napt_rwr(enpc, which, addr, port)) { return false; } /* - * Finish calculation of the ICMP checksum: include the checksum - * change in the embedded packet. + * Finally, finish the ICMP checksum fixup: include the checksum + * changes in the embedded packet. */ if (npf_iscached(enpc, NPC_IP4)) { const struct ip *eip = enpc.npc_ip.v4; Index: src/sys/net/npf/npf_impl.h diff -u src/sys/net/npf/npf_impl.h:1.48 src/sys/net/npf/npf_impl.h:1.49 --- src/sys/net/npf/npf_impl.h:1.48 Sun Feb 16 22:10:40 2014 +++ src/sys/net/npf/npf_impl.h Wed Feb 19 03:51:31 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: npf_impl.h,v 1.48 2014/02/16 22:10:40 rmind Exp $ */ +/* $NetBSD: npf_impl.h,v 1.49 2014/02/19 03:51:31 rmind Exp $ */ /*- * Copyright (c) 2009-2014 The NetBSD Foundation, Inc. @@ -200,6 +200,8 @@ bool npf_rwrip(const npf_cache_t *, u_i bool npf_rwrport(const npf_cache_t *, u_int, const in_port_t); bool npf_rwrcksum(const npf_cache_t *, u_int, const npf_addr_t *, const in_port_t); +int npf_napt_rwr(const npf_cache_t *, u_int, const npf_addr_t *, + const in_addr_t); int npf_npt66_rwr(const npf_cache_t *, u_int, const npf_addr_t *, npf_netmask_t, uint16_t); @@ -341,7 +343,6 @@ bool npf_nat_sharepm(npf_natpolicy_t *, void npf_nat_freealg(npf_natpolicy_t *, npf_alg_t *); int
CVS commit: src/doc
Module Name:src Committed By: wiz Date: Wed Feb 19 07:39:52 UTC 2014 Modified Files: src/doc: 3RDPARTY Log Message: grep-2.17 out. To generate a diff of this commit: cvs rdiff -u -r1.1093 -r1.1094 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1093 src/doc/3RDPARTY:1.1094 --- src/doc/3RDPARTY:1.1093 Mon Feb 17 21:29:29 2014 +++ src/doc/3RDPARTY Wed Feb 19 07:39:52 2014 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1093 2014/02/17 21:29:29 wiz Exp $ +# $NetBSD: 3RDPARTY,v 1.1094 2014/02/19 07:39:52 wiz Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -446,7 +446,7 @@ Notes: Package: grep Version: 2.5.1 -Current Vers: 2.16 +Current Vers: 2.17 Maintainer: FSF Archive Site: ftp://ftp.gnu.org/gnu/grep/ Home Page: http://www.gnu.org/software/grep/
CVS commit: src/common/lib/libc
Module Name:src Committed By: martin Date: Tue Feb 18 10:16:55 UTC 2014 Modified Files: src/common/lib/libc/arch/i386/atomic: Makefile.inc atomic.S Added Files: src/common/lib/libc/atomic: atomic_cas_64_cas.c atomic_nand_64_cas.c atomic_sub_64_cas.c atomic_xor_64_cas.c Log Message: Provide most missing __sync_*64 primitives for i386 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/i386/atomic/Makefile.inc cvs rdiff -u -r1.19 -r1.20 src/common/lib/libc/arch/i386/atomic/atomic.S cvs rdiff -u -r0 -r1.1 src/common/lib/libc/atomic/atomic_cas_64_cas.c \ src/common/lib/libc/atomic/atomic_nand_64_cas.c \ src/common/lib/libc/atomic/atomic_sub_64_cas.c \ src/common/lib/libc/atomic/atomic_xor_64_cas.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Tue Feb 18 10:27:46 UTC 2014 Modified Files: src/tests/lib/libc/sync: all_sync_ops_linkable.c Log Message: For now excempt i386 from __sync_lock_test_and_set_8 and point to PR lib/48601. Probably more architectures to follow. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sync/all_sync_ops_linkable.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: martin Date: Tue Feb 18 12:23:07 UTC 2014 Modified Files: src/common/lib/libc/atomic: atomic_cas_64_cas.c Log Message: Do not include stdbool.h in the kernel To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_cas_64_cas.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/oea
Module Name:src Committed By: macallan Date: Tue Feb 18 12:27:15 UTC 2014 Modified Files: src/sys/arch/powerpc/oea: ofw_autoconf.c Log Message: when looking for SCSI disks in canonicalize_bootpath() also match 'disk@' since that's what at least some Adaptec firmware uses To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/oea/ofw_autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: macallan Date: Tue Feb 18 12:32:13 UTC 2014 Modified Files: src/sys/dev/pci: ahc_pci.c Log Message: if MMIO is allowed and available, prefer it over PIO now my ADPT,2930CU works again To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/ahc_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: martin Date: Tue Feb 18 13:21:04 UTC 2014 Modified Files: src/common/lib/libc/atomic: atomic_nand_64_cas.c atomic_sub_64_cas.c atomic_xor_64_cas.c Log Message: Make the _and_fetch_8 primitives return the new value they calculated and set - not whatever is found in memory later. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_nand_64_cas.c \ src/common/lib/libc/atomic/atomic_sub_64_cas.c \ src/common/lib/libc/atomic/atomic_xor_64_cas.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/m68k/atomic
Module Name:src Committed By: martin Date: Tue Feb 18 16:19:28 UTC 2014 Modified Files: src/common/lib/libc/arch/m68k/atomic: atomic_add.S atomic_cas.S atomic_swap.S Log Message: Add a few __sync_* and atomic functions. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/m68k/atomic/atomic_add.S \ src/common/lib/libc/arch/m68k/atomic/atomic_swap.S cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/m68k/atomic/atomic_cas.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: dsl Date: Tue Feb 18 18:39:11 UTC 2014 Modified Files: src/sys/arch/x86/include: cpu_extended_state.h Added Files: src/sys/arch/amd64/include: fpu.h Log Message: It seems that firefox includes machine/fpu.h on amd64. Add the file back so that the firwfox source doesn't have to depend on the version of netbsd it is being compiled for. (The i386 version doesn't play the same games in its SIGFPE handler.) To generate a diff of this commit: cvs rdiff -u -r0 -r1.14 src/sys/arch/amd64/include/fpu.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/include/cpu_extended_state.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: christos Date: Tue Feb 18 20:43:36 UTC 2014 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: __real__ and __imag__ produce lvalues To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/compiler_rt/dist/lib
Module Name:src Committed By: christos Date: Tue Feb 18 20:54:34 UTC 2014 Modified Files: src/sys/external/bsd/compiler_rt/dist/lib: int_util.h Log Message: prefer __func__ instead of __FUNCTION__ To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/compiler_rt/dist/lib/int_util.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: christos Date: Tue Feb 18 22:01:37 UTC 2014 Modified Files: src/usr.bin/xlint/lint1: cgram.y err.c scan.l tree.c Log Message: add __extension__ and typeof To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.53 -r1.54 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.74 -r1.75 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/sets/lists/comp
Module Name:src Committed By: dsl Date: Tue Feb 18 22:03:52 UTC 2014 Modified Files: src/distrib/sets/lists/comp: md.amd64 Log Message: Unobsolete fpu.h To generate a diff of this commit: cvs rdiff -u -r1.215 -r1.216 src/distrib/sets/lists/comp/md.amd64 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amd64/include
Module Name:src Committed By: dsl Date: Tue Feb 18 22:05:56 UTC 2014 Modified Files: src/sys/arch/amd64/include: Makefile Log Message: Copy fpu.h to release To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/npf/npfctl
Module Name:src Committed By: rmind Date: Wed Feb 19 01:43:17 UTC 2014 Modified Files: src/usr.sbin/npf/npfctl: npf_show.c Log Message: npfctl_print_nat: fix the byte-order of the port. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/npf/npfctl/npf_show.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net/npf
Module Name:src Committed By: rmind Date: Wed Feb 19 03:51:31 UTC 2014 Modified Files: src/sys/net/npf: npf_alg_icmp.c npf_impl.h npf_inet.c npf_nat.c Log Message: NPF: fix the recent breakage of the traceroute ALG. Also, simplify and refactor a little bit. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/net/npf/npf_alg_icmp.c cvs rdiff -u -r1.48 -r1.49 src/sys/net/npf/npf_impl.h cvs rdiff -u -r1.29 -r1.30 src/sys/net/npf/npf_inet.c cvs rdiff -u -r1.25 -r1.26 src/sys/net/npf/npf_nat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: wiz Date: Wed Feb 19 07:39:52 UTC 2014 Modified Files: src/doc: 3RDPARTY Log Message: grep-2.17 out. To generate a diff of this commit: cvs rdiff -u -r1.1093 -r1.1094 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.