summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/metag/sysdep.h
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2010-11-18 14:58:01 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2013-03-14 22:47:08 +0100
commitdaecc9a410a6f23d80daf8ce3afd280fea329e63 (patch)
tree8d603dd538809431cc01b9e656c827d1f0709052 /libc/sysdeps/linux/metag/sysdep.h
parent20221281b3d67880439cd1d16c151f4528d034fb (diff)
metag: Add NPTL support
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/metag/sysdep.h')
-rw-r--r--libc/sysdeps/linux/metag/sysdep.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/metag/sysdep.h b/libc/sysdeps/linux/metag/sysdep.h
new file mode 100644
index 000000000..a12f393ce
--- /dev/null
+++ b/libc/sysdeps/linux/metag/sysdep.h
@@ -0,0 +1,59 @@
+/*
+ * Assembler macros for Meta.
+ *
+ * Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#include <common/sysdep.h>
+
+#include <features.h>
+#include <libc-internal.h>
+
+#ifdef __ASSEMBLER__
+
+#ifdef SHARED
+#define PLTJMP(_x) _x##@PLT
+#else
+#define PLTJMP(_x) _x
+#endif
+
+#undef PSEUDO_END
+#define PSEUDO_END(name) \
+ SYSCALL_ERROR_HANDLER \
+ END (name)
+
+#if defined NOT_IN_libc
+# define SYSCALL_ERROR __local_syscall_error
+# ifdef RTLD_PRIVATE_ERRNO
+# define SYSCALL_ERROR_HANDLER \
+__local_syscall_error: \
+ NEG D0Re0, D0Re0; \
+ ADDT D1Re0, CPC1, #HI(_rtld_errno); \
+ ADD D1Re0, D1Re0, #LO(_rtld_errno) + 4; \
+ SETD [D1Re0], D0Re0; \
+ NEG D0Re0, #0x1; \
+ MOV PC, D1RtP;
+# else
+# define SYSCALL_ERROR_HANDLER \
+__local_syscall_error: \
+ MOV D1Re0, D1RtP; \
+ SETL [A0StP++], D0Re0, D1Re0; \
+ CALLR D1RtP, PLTJMP(___errno_location); \
+ GETD D1Re0, [A0StP+#-8]; \
+ NEG D1Re0, D1Re0; \
+ SETD [D0Re0], D1Re0; \
+ NEG D0Re0, #0x1; \
+ GETD D1RtP, [A0StP+#-4]; \
+ SUB A0StP, A0StP, #0x8; \
+ MOV PC, D1RtP;
+# endif
+#else
+# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
+# define SYSCALL_ERROR ___syscall_error
+#endif
+
+#endif /* __ASSEMBLER __*/
+
+/* Pointer mangling is not yet supported for META. */
+#define PTR_MANGLE(var) (void) (var)
+#define PTR_DEMANGLE(var) (void) (var)