diff options
Diffstat (limited to 'libc/sysdeps/linux/common/bits')
-rw-r--r-- | libc/sysdeps/linux/common/bits/atomicity.h | 54 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/bits/machine-gmon.h | 54 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/bits/profil-counter.h | 27 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/bits/sigcontextinfo.h | 27 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/bits/stackinfo.h | 34 |
5 files changed, 196 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/bits/atomicity.h b/libc/sysdeps/linux/common/bits/atomicity.h new file mode 100644 index 000000000..1a756498b --- /dev/null +++ b/libc/sysdeps/linux/common/bits/atomicity.h @@ -0,0 +1,54 @@ +/* Low-level functions for atomic operations. Stub version. + Copyright (C) 1997,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ATOMICITY_H +#define _ATOMICITY_H 1 + +#include <inttypes.h> + +#warning stub atomicity functions are not really atomic + +static inline int +__attribute__ ((unused)) +exchange_and_add (volatile uint32_t *mem, int val) +{ + int result = *mem; + *mem += val; + return result; +} + +static inline void +__attribute__ ((unused)) +atomic_add (volatile uint32_t *mem, int val) +{ + *mem += val; +} + +static inline int +__attribute__ ((unused)) +compare_and_swap (volatile long int *p, long int oldval, long int newval) +{ + if (*p != oldval) + return 0; + + *p = newval; + return 1; +} + +#endif /* atomicity.h */ diff --git a/libc/sysdeps/linux/common/bits/machine-gmon.h b/libc/sysdeps/linux/common/bits/machine-gmon.h new file mode 100644 index 000000000..eb046b068 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/machine-gmon.h @@ -0,0 +1,54 @@ +/* Machine-dependent definitions for profiling support. Generic GCC 2 version. + Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* GCC version 2 gives us a perfect magical function to get + just the information we need: + void *__builtin_return_address (unsigned int N) + returns the return address of the frame N frames up. */ + +/* Be warned that GCC cannot usefully compile __builtin_return_address(N) + for N != 0 on all machines. In this case, you may have to write + your own version of _mcount(). */ + +#if __GNUC__ < 2 + #error "This file uses __builtin_return_address, a GCC 2 extension." +#endif + +#include <sysdep.h> +#ifndef NO_UNDERSCORES +/* The asm symbols for C functions are `_function'. + The canonical name for the counter function is `mcount', no _. */ +void _mcount (void) asm ("mcount"); +#else +/* The canonical name for the function is `_mcount' in both C and asm, + but some old asm code might assume it's `mcount'. */ +void _mcount (void); +weak_alias (_mcount, mcount) +#endif + +static void mcount_internal (u_long frompc, u_long selfpc); + +#define _MCOUNT_DECL(frompc, selfpc) \ +static inline void mcount_internal (u_long frompc, u_long selfpc) + +#define MCOUNT \ +void _mcount (void) \ +{ \ + mcount_internal ((u_long) RETURN_ADDRESS (1), (u_long) RETURN_ADDRESS (0)); \ +} diff --git a/libc/sysdeps/linux/common/bits/profil-counter.h b/libc/sysdeps/linux/common/bits/profil-counter.h new file mode 100644 index 000000000..9cae5840d --- /dev/null +++ b/libc/sysdeps/linux/common/bits/profil-counter.h @@ -0,0 +1,27 @@ +/* Machine-dependent SIGPROF signal handler. "Generic" version w/ sigcontext + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* In many Unix systems signal handlers are called like this + and the interrupted PC is easily findable in the `struct sigcontext'. */ + +static void +profil_counter (int signr, int code, struct sigcontext *scp) +{ + profil_count ((void *) scp->sc_pc); +} diff --git a/libc/sysdeps/linux/common/bits/sigcontextinfo.h b/libc/sysdeps/linux/common/bits/sigcontextinfo.h new file mode 100644 index 000000000..40305b488 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/sigcontextinfo.h @@ -0,0 +1,27 @@ +/* Copyright (C) 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* In general we cannot provide any information. */ +#define SIGCONTEXT struct sigcontext * +#define SIGCONTEXT_EXTRA_ARGS +#define GET_PC(ctx) ((void *) 0) +#define GET_FRAME(ctx) ((void *) 0) +#define GET_STACK(ctx) ((void *) 0) +#define CALL_SIGHANDLER(handler, signo, ctx) \ + (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) diff --git a/libc/sysdeps/linux/common/bits/stackinfo.h b/libc/sysdeps/linux/common/bits/stackinfo.h new file mode 100644 index 000000000..1ed7b9503 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/stackinfo.h @@ -0,0 +1,34 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file contains a bit of information about the stack allocation + of the processor. Since there is no general truth we can't say + anything here. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +#error Machine stack direction unknown. +#if 0 +#define _STACK_GROWS_DOWN 1 +#define _STACK_GROWS_UP 1 +#endif + +#endif /* stackinfo.h */ + + |