OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [libgomp/] [config/] [linux/] [ia64/] [futex.h] - Blame information for rev 307

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Copyright (C) 2005 Free Software Foundation, Inc.
2
   Contributed by Richard Henderson <rth@redhat.com>.
3
 
4
   This file is part of the GNU OpenMP Library (libgomp).
5
 
6
   Libgomp is free software; you can redistribute it and/or modify it
7
   under the terms of the GNU Lesser General Public License as published by
8
   the Free Software Foundation; either version 2.1 of the License, or
9
   (at your option) any later version.
10
 
11
   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
12
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
   FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
14
   more details.
15
 
16
   You should have received a copy of the GNU Lesser General Public License
17
   along with libgomp; see the file COPYING.LIB.  If not, write to the
18
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
   MA 02110-1301, USA.  */
20
 
21
/* As a special exception, if you link this library with other files, some
22
   of which are compiled with GCC, to produce an executable, this library
23
   does not by itself cause the resulting executable to be covered by the
24
   GNU General Public License.  This exception does not however invalidate
25
   any other reasons why the executable file might be covered by the GNU
26
   General Public License.  */
27
 
28
/* Provide target-specific access to the futex system call.  */
29
 
30
#include <sys/syscall.h>
31
 
32
#define FUTEX_WAIT      0
33
#define FUTEX_WAKE      1
34
 
35
 
36
static inline void
37
sys_futex0(int *addr, int op, int val)
38
{
39
  register long out0 asm ("out0") = (long) addr;
40
  register long out1 asm ("out1") = op;
41
  register long out2 asm ("out2") = val;
42
  register long out3 asm ("out3") = 0;
43
  register long r15 asm ("r15") = SYS_futex;
44
 
45
  __asm __volatile ("break 0x100000"
46
        : "=r"(r15), "=r"(out0), "=r"(out1), "=r"(out2), "=r"(out3)
47
        : "r"(r15), "r"(out0), "r"(out1), "r"(out2), "r"(out3)
48
        : "memory", "r8", "r10", "out4", "out5", "out6", "out7",
49
          /* Non-stacked integer registers, minus r8, r10, r15.  */
50
          "r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18",
51
          "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27",
52
          "r28", "r29", "r30", "r31",
53
          /* Predicate registers.  */
54
          "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15",
55
          /* Non-rotating fp registers.  */
56
          "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
57
          /* Branch registers.  */
58
          "b6");
59
}
60
 
61
static inline void
62
futex_wait (int *addr, int val)
63
{
64
  sys_futex0 (addr, FUTEX_WAIT, val);
65
}
66
 
67
static inline void
68
futex_wake (int *addr, int count)
69
{
70
  sys_futex0 (addr, FUTEX_WAKE, count);
71
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.