Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / am33 / linuxthreads / pt-machine.h
blob9e11746fe873e730bf7d6b29abe0ce9eec33d436
1 /* Machine-dependent pthreads configuration and inline functions.
2 am33 version.
3 Copyright (C) 1996-2014 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Alexandre Oliva <aoliva@redhat.com>
6 Based on ../i386/pt-machine.h.
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public
19 License along with the GNU C Library. If not, see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef _PT_MACHINE_H
23 #define _PT_MACHINE_H 1
25 #ifndef __ASSEMBLER__
26 #ifndef PT_EI
27 # define PT_EI extern inline
28 #endif
30 /* Get some notion of the current stack. Need not be exactly the top
31 of the stack, just something somewhere in the current frame. */
32 #define CURRENT_STACK_FRAME __builtin_frame_address (0)
34 /* Spinlock implementation; required. */
35 PT_EI long int
36 testandset (int *spinlock)
38 long int ret = 1;
40 /* This won't test&set the entire int, only the least significant
41 byte. I hope this doesn't matter, since we can't do better. */
42 __asm__ __volatile__ ("bset %0, %1; bne 1f; clr %0; 1:" :
43 "+d" (ret), "+m" (*(volatile int *)spinlock));
45 return ret;
49 PT_EI int
50 get_eflags (void)
52 int res;
53 __asm__ __volatile__ ("mov psw,%0" : "=d" (res));
54 return res;
58 PT_EI void
59 set_eflags (int newflags)
61 __asm__ __volatile__ ("mov %0,psw" : : "d" (newflags) : "cc");
64 #endif /* __ASSEMBLER__ */
66 #endif /* pt-machine.h */