summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/alpha
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/alpha')
-rw-r--r--libc/sysdeps/linux/alpha/bits/atomicity.h102
-rw-r--r--libc/sysdeps/linux/alpha/bits/machine-gmon.h26
-rw-r--r--libc/sysdeps/linux/alpha/bits/sigcontextinfo.h25
-rw-r--r--libc/sysdeps/linux/alpha/bits/stackinfo.h28
4 files changed, 181 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/alpha/bits/atomicity.h b/libc/sysdeps/linux/alpha/bits/atomicity.h
new file mode 100644
index 000000000..9388f2384
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/bits/atomicity.h
@@ -0,0 +1,102 @@
+/* Low-level functions for atomic operations. Alpha version.
+ 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. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#include <inttypes.h>
+
+
+static inline int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+ register int result, tmp;
+
+ __asm__ __volatile__ (
+ "/* Inline exchange & add */\n"
+ "1:\t"
+ "ldl_l %0,%3\n\t"
+ "addl %0,%4,%1\n\t"
+ "stl_c %1,%2\n\t"
+ "beq %1,2f\n"
+ ".subsection 1\n"
+ "2:\t"
+ "br 1b\n"
+ ".previous\n\t"
+ "mb\n\t"
+ "/* End exchange & add */"
+ : "=&r"(result), "=&r"(tmp), "=m"(*mem)
+ : "m" (*mem), "r"(val));
+
+ return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+ register int result;
+
+ __asm__ __volatile__ (
+ "/* Inline exchange & add */\n"
+ "1:\t"
+ "ldl_l %0,%2\n\t"
+ "addl %0,%3,%0\n\t"
+ "stl_c %0,%1\n\t"
+ "beq %0,2f\n\t"
+ ".subsection 1\n"
+ "2:\t"
+ "br 1b\n"
+ ".previous\n\t"
+ "mb\n\t"
+ "/* End exchange & add */"
+ : "=&r"(result), "=m"(*mem)
+ : "m" (*mem), "r"(val));
+}
+
+static inline long
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ long int ret;
+
+ __asm__ __volatile__ (
+ "/* Inline compare & swap */\n"
+ "1:\t"
+ "ldq_l %0,%4\n\t"
+ "cmpeq %0,%2,%0\n\t"
+ "beq %0,3f\n\t"
+ "mov %3,%0\n\t"
+ "stq_c %0,%1\n\t"
+ "beq %0,2f\n\t"
+ ".subsection 1\n"
+ "2:\t"
+ "br 1b\n"
+ ".previous\n\t"
+ "3:\t"
+ "mb\n\t"
+ "/* End compare & swap */"
+ : "=&r"(ret), "=m"(*p)
+ : "r"(oldval), "r"(newval), "m"(*p));
+
+ return ret;
+}
+
+#endif /* atomicity.h */
diff --git a/libc/sysdeps/linux/alpha/bits/machine-gmon.h b/libc/sysdeps/linux/alpha/bits/machine-gmon.h
new file mode 100644
index 000000000..5f5522c0b
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/bits/machine-gmon.h
@@ -0,0 +1,26 @@
+/* Machine-specific calling sequence for `mcount' profiling function. alpha
+ Copyright (C) 1995, 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. */
+
+#define _MCOUNT_DECL(from, self) \
+ void __mcount (u_long from, u_long self)
+
+/* Call __mcount with our the return PC for our caller, and the return
+ PC our caller will return to. Empty since we use an assembly stub
+ instead. */
+#define MCOUNT
diff --git a/libc/sysdeps/linux/alpha/bits/sigcontextinfo.h b/libc/sysdeps/linux/alpha/bits/sigcontextinfo.h
new file mode 100644
index 000000000..eb6f4f075
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/bits/sigcontextinfo.h
@@ -0,0 +1,25 @@
+/* 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. */
+
+#define SIGCONTEXT struct sigcontext
+#define SIGCONTEXT_EXTRA_ARGS
+#define GET_PC(ctx) ((void *) (ctx).sc_pc)
+#define GET_FRAME(ctx) ((void *) (ctx).sc_regs[15])
+#define GET_STACK(ctx) ((void *) (ctx).sc_regs[30])
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/libc/sysdeps/linux/alpha/bits/stackinfo.h b/libc/sysdeps/linux/alpha/bits/stackinfo.h
new file mode 100644
index 000000000..0a281bd43
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/bits/stackinfo.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 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. */
+
+/* This file contains a bit of information about the stack allocation
+ of the processor. */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H 1
+
+/* On Alpha the stack grows down. */
+#define _STACK_GROWS_DOWN 1
+
+#endif /* stackinfo.h */