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/] [alpha/] [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
#ifndef SYS_futex
31
#define SYS_futex               394
32
#endif
33
#define FUTEX_WAIT              0
34
#define FUTEX_WAKE              1
35
 
36
 
37
static inline void
38
futex_wait (int *addr, int val)
39
{
40
  register long sc_0 __asm__("$0");
41
  register long sc_16 __asm__("$16");
42
  register long sc_17 __asm__("$17");
43
  register long sc_18 __asm__("$18");
44
  register long sc_19 __asm__("$19");
45
 
46
  sc_0 = SYS_futex;
47
  sc_16 = (long) addr;
48
  sc_17 = FUTEX_WAIT;
49
  sc_18 = val;
50
  sc_19 = 0;
51
  __asm volatile ("callsys"
52
                  : "=r" (sc_0), "=r"(sc_19)
53
                  : "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18), "1"(sc_19)
54
                  : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
55
                    "$22", "$23", "$24", "$25", "$27", "$28", "memory");
56
}
57
 
58
static inline void
59
futex_wake (int *addr, int count)
60
{
61
  register long sc_0 __asm__("$0");
62
  register long sc_16 __asm__("$16");
63
  register long sc_17 __asm__("$17");
64
  register long sc_18 __asm__("$18");
65
  register long sc_19 __asm__("$19");
66
 
67
  sc_0 = SYS_futex;
68
  sc_16 = (long) addr;
69
  sc_17 = FUTEX_WAKE;
70
  sc_18 = count;
71
  __asm volatile ("callsys"
72
                  : "=r" (sc_0), "=r"(sc_19)
73
                  : "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18)
74
                  : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
75
                    "$22", "$23", "$24", "$25", "$27", "$28", "memory");
76
}

powered by: WebSVN 2.1.0

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