1 /* Machine-dependent pthreads configuration and inline functions.
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/>. */
23 #define _PT_MACHINE_H 1
27 # define PT_EI extern inline
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. */
36 testandset (int *spinlock
)
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
));
53 __asm__
__volatile__ ("mov psw,%0" : "=d" (res
));
59 set_eflags (int newflags
)
61 __asm__
__volatile__ ("mov %0,psw" : : "d" (newflags
) : "cc");
64 #endif /* __ASSEMBLER__ */
66 #endif /* pt-machine.h */