static int cond_extricate_func(void *obj, pthread_descr th)
{
- volatile pthread_descr self = thread_self();
+ __volatile__ pthread_descr self = thread_self();
pthread_cond_t *cond = obj;
int did_remove = 0;
int __pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
- volatile pthread_descr self = thread_self();
+ __volatile__ pthread_descr self = thread_self();
pthread_extricate_if extr;
int already_canceled = 0;
int spurious_wakeup_count;
pthread_mutex_t *mutex,
const struct timespec * abstime)
{
- volatile pthread_descr self = thread_self();
+ __volatile__ pthread_descr self = thread_self();
int already_canceled = 0;
pthread_extricate_if extr;
int spurious_wakeup_count;
/* Set to 1 by gdb if we're debugging */
-extern volatile int __pthread_threads_debug;
+extern __volatile__ int __pthread_threads_debug;
/* Globally enabled events. */
-extern volatile td_thr_events_t __pthread_threads_events;
+extern __volatile__ td_thr_events_t __pthread_threads_events;
/* Pointer to descriptor of thread with last event. */
-extern volatile pthread_descr __pthread_last_event;
+extern __volatile__ pthread_descr __pthread_last_event;
/* Flag which tells whether we are executing on SMP kernel. */
extern int __pthread_smp_kernel;
distinguish between full, read and write barriers. */
#ifndef MEMORY_BARRIER
-#define MEMORY_BARRIER() asm ("" : : : "memory")
+#define MEMORY_BARRIER() __asm__ ("" : : : "memory")
#endif
#ifndef READ_MEMORY_BARRIER
#define READ_MEMORY_BARRIER() MEMORY_BARRIER()
static int join_extricate_func(void *obj, pthread_descr th)
{
- volatile pthread_descr self = thread_self();
+ __volatile__ pthread_descr self = thread_self();
pthread_handle handle = obj;
pthread_descr jo;
int did_remove = 0;
int pthread_join(pthread_t thread_id, void ** thread_return)
{
- volatile pthread_descr self = thread_self();
+ __volatile__ pthread_descr self = thread_self();
struct pthread_request request;
pthread_handle handle = thread_handle(thread_id);
pthread_descr th;
#endif
/* Number of active entries in __pthread_handles (used by gdb) */
-volatile int __pthread_handles_num = 2;
+__volatile__ int __pthread_handles_num = 2;
/* Whether to use debugger additional actions for thread creation
(set to 1 by gdb) */
-volatile int __pthread_threads_debug;
+__volatile__ int __pthread_threads_debug;
/* Globally enabled events. */
-volatile td_thr_events_t __pthread_threads_events;
+__volatile__ td_thr_events_t __pthread_threads_events;
/* Pointer to thread descriptor with last event. */
-volatile pthread_descr __pthread_last_event;
+__volatile__ pthread_descr __pthread_last_event;
static pthread_descr manager_thread;
/* Flag set in signal handler to record child termination */
-static volatile int terminated_children;
+static __volatile__ int terminated_children;
/* Flag set when the initial thread is blocked on pthread_exit waiting
for all other threads to terminate */
static int new_sem_extricate_func(void *obj, pthread_descr th)
{
- volatile pthread_descr self = thread_self();
+ __volatile__ pthread_descr self = thread_self();
sem_t *sem = obj;
int did_remove = 0;
int sem_wait(sem_t * sem)
{
- volatile pthread_descr self = thread_self();
+ __volatile__ pthread_descr self = thread_self();
pthread_extricate_if extr;
int already_canceled = 0;
int spurious_wakeup_count;
/* sigwait -- synchronously wait for a signal */
int __pthread_sigwait(const sigset_t * set, int * sig)
{
- volatile pthread_descr self = thread_self();
+ __volatile__ pthread_descr self = thread_self();
sigset_t mask;
int s;
sigjmp_buf jmpbuf;
{
WRITE_MEMORY_BARRIER();
*spinlock = __LT_SPINLOCK_INIT;
- __asm __volatile ("" : "=m" (*spinlock) : "m" (*spinlock));
+ __asm__ __volatile__ ("" : "=m" (*spinlock) : "m" (*spinlock));
}
#ifdef BUSY_WAIT_NOP
BUSY_WAIT_NOP;
#endif
- __asm __volatile ("" : "=m" (lock->__status) : "m" (lock->__status));
+ __asm__ __volatile__ ("" : "=m" (lock->__status) : "m" (lock->__status));
}
lock->__spinlock += (spin_count - lock->__spinlock) / 8;
__pthread_spin_lock (pthread_spinlock_t *lock)
{
unsigned int tmp;
- asm volatile
+ __asm__ __volatile__
("1: ldl_l %0,%1\n"
" blbs %0,2f\n"
" or %0,1,%0\n"
unsigned long int oldval;
unsigned long int temp;
- asm volatile
+ __asm__ __volatile__
("1: ldl_l %0,%1\n"
" and %0,%3,%2\n"
" bne %2,2f\n"
int
__pthread_spin_unlock (pthread_spinlock_t *lock)
{
- asm volatile ("mb");
+ __asm__ __volatile__ ("mb");
return *lock = 0;
}
weak_alias (__pthread_spin_unlock, pthread_spin_unlock)
unsigned int val;
do
- asm volatile ("swp %0, %1, [%2]"
+ __asm__ __volatile__ ("swp %0, %1, [%2]"
: "=r" (val)
: "0" (1), "r" (lock)
: "memory");
{
unsigned int val;
- asm volatile ("swp %0, %1, [%2]"
+ __asm__ __volatile__ ("swp %0, %1, [%2]"
: "=r" (val)
: "0" (1), "r" (lock)
: "memory");
unsigned int val;
do
- asm volatile ("ldcw %1,%0"
+ __asm__ __volatile__ ("ldcw %1,%0"
: "=r" (val), "=m" (*lock)
: "m" (*lock));
while (!val);
{
unsigned int val;
- asm volatile ("ldcw %1,%0"
+ __asm__ __volatile__ ("ldcw %1,%0"
: "=r" (val), "=m" (*lock)
: "m" (*lock));
int
__pthread_spin_lock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("\n"
"1:\n\t"
"lock; decl %0\n\t"
{
int oldval;
- asm volatile
+ __asm__ __volatile__
("xchgl %0,%1"
: "=r" (oldval), "=m" (*lock)
: "0" (0));
int
__pthread_spin_unlock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("movl $1,%0"
: "=m" (*lock));
return 0;
{ nr, (unsigned long int) (descr), 0xfffff /* 4GB in pages */, \
1, 0, 0, 1, 0, 1, 0 }; \
int result; \
- asm volatile (TLS_LOAD_EBX \
+ __asm__ __volatile__ (TLS_LOAD_EBX \
"int $0x80\n\t" \
TLS_LOAD_EBX \
: "=a" (result) \
"m" (ldt_entry), TLS_EBX_ARG (1), "c" (&ldt_entry), \
"d" (sizeof (ldt_entry))); \
__builtin_expect (result, 0) == 0 \
- ? ({ asm ("movw %w0, %%gs" : : "q" ((nr) * 8 + 7)); NULL; }) \
+ ? ({ __asm__ ("movw %w0, %%gs" : : "q" ((nr) * 8 + 7)); NULL; }) \
: "cannot set up LDT for thread-local storage\n"; \
}))
int result; \
if (secondcall) \
ldt_entry.entry_number = ({ int _gs; \
- asm ("movw %%gs, %w0" : "=q" (_gs)); \
+ __asm__ ("movw %%gs, %w0" : "=q" (_gs)); \
(_gs & 0xffff) >> 3; }); \
- asm volatile (TLS_LOAD_EBX \
+ __asm__ __volatile__ (TLS_LOAD_EBX \
"int $0x80\n\t" \
TLS_LOAD_EBX \
: "=a" (result), "=m" (ldt_entry.entry_number) \
here. */ \
TLS_EBX_ARG (&ldt_entry), "m" (ldt_entry)); \
if (__builtin_expect (result, 0) == 0) \
- asm ("movw %w0, %%gs" : : "q" (ldt_entry.entry_number * 8 + 3)); \
+ __asm__ ("movw %w0, %%gs" : : "q" (ldt_entry.entry_number * 8 + 3)); \
result; \
})
1, 0, 0, 1, 0, 1, 0 }; \
if (__modify_ldt (1, &ldt_entry, sizeof (ldt_entry)) != 0) \
abort (); \
- asm ("movw %w0, %%gs" : : "q" (nr * 8 + 7)); \
+ __asm__ ("movw %w0, %%gs" : : "q" (nr * 8 + 7)); \
})
#ifdef __PIC__
int __gs; \
if (DO_SET_THREAD_AREA_REUSE (nr)) \
{ \
- asm ("movw %%gs, %w0" : "=q" (__gs)); \
+ __asm__ ("movw %%gs, %w0" : "=q" (__gs)); \
struct modify_ldt_ldt_s ldt_entry = \
{ (__gs & 0xffff) >> 3, \
(unsigned long int) (descr), 0xfffff /* 4GB in pages */, \
1, 0, 0, 1, 0, 1, 0 }; \
\
int __result; \
- __asm (USETLS_LOAD_EBX \
+ __asm__ (USETLS_LOAD_EBX \
"movl %2, %%eax\n\t" \
"int $0x80\n\t" \
USETLS_LOAD_EBX \
"m" (ldt_entry) \
: "memory"); \
if (__result == 0) \
- asm ("movw %w0, %%gs" :: "q" (__gs)); \
+ __asm__ ("movw %w0, %%gs" :: "q" (__gs)); \
else \
__gs = -1; \
} \
(unsigned long int) (descr), 0xfffff /* 4GB in pages */, \
1, 0, 0, 1, 0, 1, 0 }; \
int __result; \
- __asm (USETLS_LOAD_EBX \
+ __asm__ (USETLS_LOAD_EBX \
"movl %2, %%eax\n\t" \
"int $0x80\n\t" \
USETLS_LOAD_EBX \
if (__result == 0) \
{ \
__gs = (ldt_entry.entry_number << 3) + 3; \
- asm ("movw %w0, %%gs" : : "q" (__gs)); \
+ __asm__ ("movw %w0, %%gs" : : "q" (__gs)); \
} \
else \
__gs = -1; \
{
/* Spin without using the atomic instruction. */
do
- __asm __volatile ("" : : : "memory");
+ __asm__ __volatile__ ("" : : : "memory");
while (*p);
}
return 0;
/* Make sure gcc doesn't try to be clever and move things around on
us. We need to use _exactly_ the address the user gave us, not some
alias that contains the same information. */
-#define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x)
+#define __atomic_fool_gcc(x) (*(__volatile__ struct { int a[100]; } *)x)
#ifndef ELF_MACHINE_NAME
unsigned int val;
do
- asm volatile ("tas %1; sne %0"
+ __asm__ __volatile__ ("tas %1; sne %0"
: "=dm" (val), "=m" (*lock)
: "m" (*lock)
: "cc");
{
unsigned int val;
- asm volatile ("tas %1; sne %0"
+ __asm__ __volatile__ ("tas %1; sne %0"
: "=dm" (val), "=m" (*lock)
: "m" (*lock)
: "cc");
{
unsigned int tmp1, tmp2;
- asm volatile
+ __asm__ __volatile__
("\t\t\t# spin_lock\n"
"1:\n\t"
".set push\n\t"
int
__pthread_spin_unlock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("\t\t\t# spin_unlock\n\t"
"sw $0,%0"
: "=m" (*lock)
# define READ_THREAD_POINTER() \
({ void *__result; \
- asm volatile (".set\tpush\n\t.set\tmips32r2\n\t" \
+ __asm__ __volatile__ (".set\tpush\n\t.set\tmips32r2\n\t" \
"rdhwr\t%0, $29\n\t.set\tpop" : "=v" (__result)); \
__result; })
#ifdef __USE_XOPEN2K
/* POSIX spinlock data type. */
-typedef volatile int pthread_spinlock_t;
+typedef __volatile__ int pthread_spinlock_t;
/* POSIX barrier. */
typedef struct {
/* We use embedded asm for .section unconditionally, as this makes it
easier to insert the necessary directives into crtn.S. */
-#define SECTION(x) asm (".section " x )
+#define SECTION(x) __asm__ (".section " x )
/* Embed an #include to pull in the alignment and .end directives. */
-asm ("\n#include \"defs.h\"");
+__asm__ ("\n#include \"defs.h\"");
/* The initial common code ends here. */
-asm ("\n/*@HEADER_ENDS*/");
+__asm__ ("\n/*@HEADER_ENDS*/");
/* To determine whether we need .end and .align: */
-asm ("\n/*@TESTS_BEGIN*/");
+__asm__ ("\n/*@TESTS_BEGIN*/");
extern void dummy (void (*foo) (void));
void
dummy (void (*foo) (void))
if (foo)
(*foo) ();
}
-asm ("\n/*@TESTS_END*/");
+__asm__ ("\n/*@TESTS_END*/");
/* The beginning of _init: */
-asm ("\n/*@_init_PROLOG_BEGINS*/");
+__asm__ ("\n/*@_init_PROLOG_BEGINS*/");
static void
call_initialize_minimal (void)
/* The very first thing we must do is to set up the registers. */
call_initialize_minimal ();
- asm ("ALIGN");
- asm("END_INIT");
+ __asm__ ("ALIGN");
+ __asm__("END_INIT");
/* Now the epilog. */
- asm ("\n/*@_init_PROLOG_ENDS*/");
- asm ("\n/*@_init_EPILOG_BEGINS*/");
+ __asm__ ("\n/*@_init_PROLOG_ENDS*/");
+ __asm__ ("\n/*@_init_EPILOG_BEGINS*/");
SECTION(".init");
}
-asm ("END_INIT");
+__asm__ ("END_INIT");
/* End of the _init epilog, beginning of the _fini prolog. */
-asm ("\n/*@_init_EPILOG_ENDS*/");
-asm ("\n/*@_fini_PROLOG_BEGINS*/");
+__asm__ ("\n/*@_init_EPILOG_ENDS*/");
+__asm__ ("\n/*@_fini_PROLOG_BEGINS*/");
SECTION (".fini");
extern void _fini (void);
{
/* End of the _fini prolog. */
- asm ("ALIGN");
- asm ("END_FINI");
- asm ("\n/*@_fini_PROLOG_ENDS*/");
+ __asm__ ("ALIGN");
+ __asm__ ("END_FINI");
+ __asm__ ("\n/*@_fini_PROLOG_ENDS*/");
{
/* Let GCC know that _fini is not a leaf function by having a dummy
}
/* Beginning of the _fini epilog. */
- asm ("\n/*@_fini_EPILOG_BEGINS*/");
+ __asm__ ("\n/*@_fini_EPILOG_BEGINS*/");
SECTION (".fini");
}
-asm ("END_FINI");
+__asm__ ("END_FINI");
/* End of the _fini epilog. Any further generated assembly (e.g. .ident)
is shared between both crt files. */
-asm ("\n/*@_fini_EPILOG_ENDS*/");
-asm ("\n/*@TRAILER_BEGINS*/");
+__asm__ ("\n/*@_fini_EPILOG_ENDS*/");
+__asm__ ("\n/*@TRAILER_BEGINS*/");
/* End of file. */
int
__pthread_spin_lock (pthread_spinlock_t *lock)
{
- asm volatile(" basr 1,0\n"
+ __asm__ __volatile__(" basr 1,0\n"
"0: slr 0,0\n"
" cs 0,1,%1\n"
" jl 0b\n"
{
int oldval;
- asm volatile(" slr %1,%1\n"
+ __asm__ __volatile__(" slr %1,%1\n"
" basr 1,0\n"
"0: cs %1,1,%0"
: "=m" (*lock), "=&d" (oldval)
int
__pthread_spin_unlock (pthread_spinlock_t *lock)
{
- asm volatile(" xc 0(4,%0),0(%0)\n"
+ __asm__ __volatile__(" xc 0(4,%0),0(%0)\n"
" bcr 15,0"
: : "a" (lock) : "memory" );
return 0;
unsigned int val;
do
- asm volatile ("tas.b @%1; movt %0"
+ __asm__ __volatile__ ("tas.b @%1; movt %0"
: "=r" (val)
: "r" (lock)
: "memory");
{
unsigned int val;
- asm volatile ("tas.b @%1; movt %0"
+ __asm__ __volatile__ ("tas.b @%1; movt %0"
: "=r" (val)
: "r" (lock)
: "memory");
/* Install new dtv for current thread. */
# define INSTALL_NEW_DTV(dtv) \
({ tcbhead_t *__tcbp; \
- __asm __volatile ("stc gbr,%0" : "=r" (__tcbp)); \
+ __asm__ __volatile__ ("stc gbr,%0" : "=r" (__tcbp)); \
__tcbp->dtv = (dtv);})
/* Return dtv of given thread descriptor. */
special attention since 'errno' is not yet available and if the
operation can cause a failure 'errno' must not be touched. */
# define TLS_INIT_TP(tcbp, secondcall) \
- ({ __asm __volatile ("ldc %0,gbr" : : "r" (tcbp)); 0; })
+ ({ __asm__ __volatile__ ("ldc %0,gbr" : : "r" (tcbp)); 0; })
/* Return the address of the dtv for the current thread. */
# define THREAD_DTV() \
({ tcbhead_t *__tcbp; \
- __asm __volatile ("stc gbr,%0" : "=r" (__tcbp)); \
+ __asm__ __volatile__ ("stc gbr,%0" : "=r" (__tcbp)); \
__tcbp->dtv;})
/* Return the thread descriptor for the current thread. */
# undef THREAD_SELF
# define THREAD_SELF \
({ struct _pthread_descr_struct *__self; \
- __asm ("stc gbr,%0" : "=r" (__self)); \
+ __asm__ ("stc gbr,%0" : "=r" (__self)); \
__self - 1;})
# undef INIT_THREAD_SELF
# define INIT_THREAD_SELF(descr, nr) \
({ struct _pthread_descr_struct *__self = (void *) descr; \
- __asm __volatile ("ldc %0,gbr" : : "r" (__self + 1)); \
+ __asm__ __volatile__ ("ldc %0,gbr" : : "r" (__self + 1)); \
0; })
# define TLS_MULTIPLE_THREADS_IN_TCB 1
# define NONTLS_INIT_TP \
do { \
static const tcbhead_t nontls_init_tp = { .multiple_threads = 0 }; \
- __asm __volatile ("ldc %0,gbr" : : "r" (&nontls_init_tp)); \
+ __asm__ __volatile__ ("ldc %0,gbr" : : "r" (&nontls_init_tp)); \
} while (0)
# endif /* __ASSEMBLER__ */
int
__pthread_spin_lock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("1: ldstub [%0], %%g2\n"
" orcc %%g2, 0x0, %%g0\n"
" bne,a 2f\n"
__pthread_spin_trylock (pthread_spinlock_t *lock)
{
int result;
- asm volatile
+ __asm__ __volatile__
("ldstub [%1], %0"
: "=r" (result)
: "r" (lock)
int
__pthread_spin_lock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("1: ldstub [%0], %%g2\n"
" brnz,pn %%g2, 2f\n"
" membar #StoreLoad | #StoreStore\n"
__pthread_spin_trylock (pthread_spinlock_t *lock)
{
int result;
- asm volatile
+ __asm__ __volatile__
("ldstub [%1], %0\n"
"membar #StoreLoad | #StoreStore"
: "=r" (result)
int
__pthread_spin_unlock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("membar #StoreStore | #LoadStore\n"
"stb %%g0, [%0]"
:
int
__pthread_spin_lock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("1: ldstub [%0], %%g5\n"
" brnz,pn %%g5, 2f\n"
" membar #StoreLoad | #StoreStore\n"
__pthread_spin_trylock (pthread_spinlock_t *lock)
{
int result;
- asm volatile
+ __asm__ __volatile__
("ldstub [%1], %0\n"
"membar #StoreLoad | #StoreStore"
: "=r" (result)
int
__pthread_spin_unlock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("membar #StoreStore | #LoadStore\n"
"stb %%g0, [%0]"
:
{
/* Copy the function and parameter so that the parent thread can go
on with its life. */
- volatile union notify_data *data = (volatile union notify_data *) arg;
+ __volatile__ union notify_data *data = (__volatile__ union notify_data *) arg;
void (*fct) (union sigval) = data->fct;
union sigval param = data->param;
register long __o0 __asm__ ("o0"); \
register long __o1 __asm__ ("o1"); \
register long __g1 __asm__ ("g1") = __NR_fork; \
- __asm __volatile (__SYSCALL_STRING \
+ __asm__ __volatile__ (__SYSCALL_STRING \
: "=r" (__g1), "=r" (__o0), "=r" (__o1) \
: "0" (__g1) \
: __SYSCALL_CLOBBERS); \
int
__pthread_spin_lock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("\n"
"1:\n\t"
"lock; decl %0\n\t"
{
int oldval;
- asm volatile
+ __asm__ __volatile__
("xchgl %0,%1"
: "=r" (oldval), "=m" (*lock)
: "0" (0));
int
__pthread_spin_unlock (pthread_spinlock_t *lock)
{
- asm volatile
+ __asm__ __volatile__
("movl $1,%0"
: "=m" (*lock));
return 0;
/* For now the thread descriptor is at the same address. */ \
head->self = _descr; \
\
- asm volatile ("syscall" \
+ __asm__ __volatile__ ("syscall" \
: "=a" (_result) \
: "0" ((unsigned long int) __NR_arch_prctl), \
"D" ((unsigned long int) ARCH_SET_FS), \