From owner-svn-src-projects@FreeBSD.ORG Fri Jan 18 11:13:30 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C9ED1245; Fri, 18 Jan 2013 11:13:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BB84EF25; Fri, 18 Jan 2013 11:13:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0IBDUxv065618; Fri, 18 Jan 2013 11:13:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0IBDTd4065613; Fri, 18 Jan 2013 11:13:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201301181113.r0IBDTd4065613@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 18 Jan 2013 11:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r245600 - in projects/counters/sys: arm/include ia64/include mips/include powerpc/include sparc64/include X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2013 11:13:30 -0000 Author: kib Date: Fri Jan 18 11:13:29 2013 New Revision: 245600 URL: http://svnweb.freebsd.org/changeset/base/245600 Log: Copy i386 version of machine/counter.h to other architectures. For the 64bit machines with ll/sc support it might be implemented much more optimal. For now, this implementation should allow all architectures to compile. Added: projects/counters/sys/arm/include/counter.h - copied unchanged from r245598, projects/counters/sys/i386/include/counter.h projects/counters/sys/ia64/include/counter.h - copied unchanged from r245598, projects/counters/sys/i386/include/counter.h projects/counters/sys/mips/include/counter.h - copied unchanged from r245598, projects/counters/sys/i386/include/counter.h projects/counters/sys/powerpc/include/counter.h - copied unchanged from r245598, projects/counters/sys/i386/include/counter.h projects/counters/sys/sparc64/include/counter.h - copied unchanged from r245598, projects/counters/sys/i386/include/counter.h Copied: projects/counters/sys/arm/include/counter.h (from r245598, projects/counters/sys/i386/include/counter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/counters/sys/arm/include/counter.h Fri Jan 18 11:13:29 2013 (r245600, copy of r245598, projects/counters/sys/i386/include/counter.h) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MACHINE_COUNTER_H__ +#define __MACHINE_COUNTER_H__ + +#include + +static __inline void +counter_u64_inc(counter_u64_t c, uint64_t inc) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) += inc; + critical_leave(); +} + +static __inline void +counter_u64_dec(counter_u64_t c, uint64_t dec) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) -= inc; + critical_leave(); +} + +#endif /* ! __MACHINE_COUNTER_H__ */ Copied: projects/counters/sys/ia64/include/counter.h (from r245598, projects/counters/sys/i386/include/counter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/counters/sys/ia64/include/counter.h Fri Jan 18 11:13:29 2013 (r245600, copy of r245598, projects/counters/sys/i386/include/counter.h) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MACHINE_COUNTER_H__ +#define __MACHINE_COUNTER_H__ + +#include + +static __inline void +counter_u64_inc(counter_u64_t c, uint64_t inc) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) += inc; + critical_leave(); +} + +static __inline void +counter_u64_dec(counter_u64_t c, uint64_t dec) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) -= inc; + critical_leave(); +} + +#endif /* ! __MACHINE_COUNTER_H__ */ Copied: projects/counters/sys/mips/include/counter.h (from r245598, projects/counters/sys/i386/include/counter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/counters/sys/mips/include/counter.h Fri Jan 18 11:13:29 2013 (r245600, copy of r245598, projects/counters/sys/i386/include/counter.h) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MACHINE_COUNTER_H__ +#define __MACHINE_COUNTER_H__ + +#include + +static __inline void +counter_u64_inc(counter_u64_t c, uint64_t inc) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) += inc; + critical_leave(); +} + +static __inline void +counter_u64_dec(counter_u64_t c, uint64_t dec) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) -= inc; + critical_leave(); +} + +#endif /* ! __MACHINE_COUNTER_H__ */ Copied: projects/counters/sys/powerpc/include/counter.h (from r245598, projects/counters/sys/i386/include/counter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/counters/sys/powerpc/include/counter.h Fri Jan 18 11:13:29 2013 (r245600, copy of r245598, projects/counters/sys/i386/include/counter.h) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MACHINE_COUNTER_H__ +#define __MACHINE_COUNTER_H__ + +#include + +static __inline void +counter_u64_inc(counter_u64_t c, uint64_t inc) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) += inc; + critical_leave(); +} + +static __inline void +counter_u64_dec(counter_u64_t c, uint64_t dec) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) -= inc; + critical_leave(); +} + +#endif /* ! __MACHINE_COUNTER_H__ */ Copied: projects/counters/sys/sparc64/include/counter.h (from r245598, projects/counters/sys/i386/include/counter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/counters/sys/sparc64/include/counter.h Fri Jan 18 11:13:29 2013 (r245600, copy of r245598, projects/counters/sys/i386/include/counter.h) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MACHINE_COUNTER_H__ +#define __MACHINE_COUNTER_H__ + +#include + +static __inline void +counter_u64_inc(counter_u64_t c, uint64_t inc) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) += inc; + critical_leave(); +} + +static __inline void +counter_u64_dec(counter_u64_t c, uint64_t dec) +{ + + critical_enter(); + *(uint64_t *)((char *)c + sizeof(struct pcpu) * curcpu) -= inc; + critical_leave(); +} + +#endif /* ! __MACHINE_COUNTER_H__ */