blob: acd4d109f376910db2b2c243157888553d67ec7b [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* Machine-dependent pthreads configuration and inline functions.
2 Xtensa version.
3
4 Copyright (C) 2007 Free Software Foundation, Inc.
5 This file is part of the GNU C Library.
6
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20 Boston, MA 02110-1301, USA. */
21
22#ifndef _PT_MACHINE_H
23#define _PT_MACHINE_H 1
24
25#include <sys/syscall.h>
26#include <asm/unistd.h>
27
28#ifndef PT_EI
29# define PT_EI __extern_always_inline
30#endif
31
32/* Memory barrier. */
33#define MEMORY_BARRIER() __asm__ ("memw" : : : "memory")
34
35/* Spinlock implementation; required. */
36PT_EI long int
37testandset (int *spinlock)
38{
39 int unused = 0;
40 return INTERNAL_SYSCALL (xtensa, , 4, SYS_XTENSA_ATOMIC_SET,
41 spinlock, 1, unused);
42}
43
44/* Get some notion of the current stack. Need not be exactly the top
45 of the stack, just something somewhere in the current frame. */
46#define CURRENT_STACK_FRAME __builtin_frame_address (0)
47
48#endif /* _PT_MACHINE_H */