Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add __insn_barrier(3). XXX: Someone more knowledgeable may w...



details:   https://anonhg.NetBSD.org/src/rev/f185e7152c03
branches:  trunk
changeset: 759816:f185e7152c03
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Dec 17 07:10:37 2010 +0000

description:
Add __insn_barrier(3). XXX: Someone more knowledgeable may want to check this.

diffstat:

 distrib/sets/lists/comp/mi      |   5 ++-
 share/man/man3/Makefile         |   5 +-
 share/man/man3/__insn_barrier.3 |  64 +++++++++++++++++++++++++++++++++++++++++
 share/man/man3/cdefs.3          |  11 +++---
 4 files changed, 77 insertions(+), 8 deletions(-)

diffs (157 lines):

diff -r 4142f3ffb366 -r f185e7152c03 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Fri Dec 17 07:04:52 2010 +0000
+++ b/distrib/sets/lists/comp/mi        Fri Dec 17 07:10:37 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.1551 2010/12/16 23:01:56 joerg Exp $
+#      $NetBSD: mi,v 1.1552 2010/12/17 07:10:37 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4910,6 +4910,7 @@
 ./usr/share/man/cat3/__builtin_object_size.0   comp-c-catman           .cat
 ./usr/share/man/cat3/__constfunc.0             comp-c-catman           .cat
 ./usr/share/man/cat3/__dead.0                  comp-c-catman           .cat
+./usr/share/man/cat3/__insn_barrier.0          comp-c-catman           .cat
 ./usr/share/man/cat3/__noinline.0              comp-c-catman           .cat
 ./usr/share/man/cat3/__packed.0                        comp-c-catman           .cat
 ./usr/share/man/cat3/__pure.0                  comp-c-catman           .cat
@@ -10994,6 +10995,7 @@
 ./usr/share/man/html3/__builtin_object_size.html       comp-c-htmlman          html
 ./usr/share/man/html3/__constfunc.html         comp-c-htmlman          html
 ./usr/share/man/html3/__dead.html              comp-c-htmlman          html
+./usr/share/man/html3/__insn_barrier.html      comp-c-htmlman          html
 ./usr/share/man/html3/__noinline.html          comp-c-htmlman          html
 ./usr/share/man/html3/__packed.html            comp-c-htmlman          html
 ./usr/share/man/html3/__pure.html              comp-c-htmlman          html
@@ -16878,6 +16880,7 @@
 ./usr/share/man/man3/__builtin_object_size.3   comp-c-man              .man
 ./usr/share/man/man3/__constfunc.3             comp-c-man              .man
 ./usr/share/man/man3/__dead.3                  comp-c-man              .man
+./usr/share/man/man3/__insn_barrier.3          comp-c-man              .man
 ./usr/share/man/man3/__noinline.3              comp-c-man              .man
 ./usr/share/man/man3/__packed.3                        comp-c-man              .man
 ./usr/share/man/man3/__pure.3                  comp-c-man              .man
diff -r 4142f3ffb366 -r f185e7152c03 share/man/man3/Makefile
--- a/share/man/man3/Makefile   Fri Dec 17 07:04:52 2010 +0000
+++ b/share/man/man3/Makefile   Fri Dec 17 07:10:37 2010 +0000
@@ -1,8 +1,9 @@
-#      $NetBSD: Makefile,v 1.61 2010/12/16 17:47:54 jruoho Exp $
+#      $NetBSD: Makefile,v 1.62 2010/12/17 07:10:38 jruoho Exp $
 #      @(#)Makefile    8.2 (Berkeley) 12/13/93
 
 MAN=   _DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \
-       __arraycount.3 assert.3 attribute.3 bits.3 bitstring.3 \
+       __arraycount.3 __insn_barrier.3 \
+       assert.3 attribute.3 bits.3 bitstring.3 \
        cdefs.3 dirent.3 dlfcn.3 dl_iterate_phdr.3 end.3 \
        fast_divide32.3 ffs32.3 gcq.3 \
        ilog2.3 intro.3 inttypes.3 iso646.3 \
diff -r 4142f3ffb366 -r f185e7152c03 share/man/man3/__insn_barrier.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man3/__insn_barrier.3   Fri Dec 17 07:10:37 2010 +0000
@@ -0,0 +1,64 @@
+.\" $NetBSD: __insn_barrier.3,v 1.1 2010/12/17 07:10:38 jruoho Exp $
+.\"
+.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
+.\" 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 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.
+.\"
+.Dd December 17, 2010
+.Dt __INSN_BARRIER 3
+.Os
+.Sh NAME
+.Nm __insn_barrier
+.Nd compiler reorder barrier
+.Sh SYNOPSIS
+.In sys/cdefs.h
+.Ft void
+.Fn __insn_barrier
+.Sh DESCRIPTION
+The
+.Fn __insn_barrier
+macro prevents
+.Tn GCC
+from moving code across the barrier.
+In other words, the compiler is not allowed to reorder read and write
+commands below the barrier with the code preceding the barrier.
+Like with the
+.Em volatile
+type qualifier,
+.Fn __insn_barrier
+may be necessary in some corner cases to prevent the compiler
+from misoptimizing.
+.Sh SEE ALSO
+.Xr gcc 1 ,
+.Xr cdefs 3
+.Rs
+.%A Paul E. McKenney
+.%T Memory Barriers: a Hardware View for Software Hackers
+.%D June 7, 2010
+.%U http://www.rdrop.com/users/paulmck/scalability/paper/whymb.2010.06.07c.pdf
+.Re
+.Sh HISTORY
+The
+.Fn __insn_barrier
+macro first appeared in
+.Nx 2.0 .
diff -r 4142f3ffb366 -r f185e7152c03 share/man/man3/cdefs.3
--- a/share/man/man3/cdefs.3    Fri Dec 17 07:04:52 2010 +0000
+++ b/share/man/man3/cdefs.3    Fri Dec 17 07:10:37 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: cdefs.3,v 1.1 2010/12/16 10:19:14 jruoho Exp $
+.\" $NetBSD: cdefs.3,v 1.2 2010/12/17 07:10:38 jruoho Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 16, 2010
+.Dd December 17, 2010
 .Dt CDEFS 3
 .Os
 .Sh NAME
@@ -54,10 +54,11 @@
 .Tn C99 .
 .It
 Macros and definitions specific to compilers, preprocessors, and linkers; see
-.Xr attribute 3 ,
 .Xr __CONCAT 3 ,
+.Xr __UNCONST 3 ,
+.Xr __insn_barrier 3 ,
 and
-.Xr __UNCONST 3 .
+.Xr attribute 3 .
 .It
 Utility macros provided for convenience; see
 .Xr __arraycount 3
@@ -87,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: cdefs.3,v 1.1 2010/12/16 10:19:14 jruoho Exp $");
+__RCSID("$NetBSD: cdefs.3,v 1.2 2010/12/17 07:10:38 jruoho Exp $");
 .Ed
 .Pp
 It is possible to identify the



Home | Main Index | Thread Index | Old Index