summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/cris/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/cris/bits')
-rw-r--r--libc/sysdeps/linux/cris/bits/byteswap.h74
-rw-r--r--libc/sysdeps/linux/cris/bits/syscalls.h8
-rw-r--r--libc/sysdeps/linux/cris/bits/termios.h215
-rw-r--r--libc/sysdeps/linux/cris/bits/uClibc_arch_features.h45
-rw-r--r--libc/sysdeps/linux/cris/bits/uClibc_page.h6
5 files changed, 315 insertions, 33 deletions
diff --git a/libc/sysdeps/linux/cris/bits/byteswap.h b/libc/sysdeps/linux/cris/bits/byteswap.h
index e35c4b63f..4027456ac 100644
--- a/libc/sysdeps/linux/cris/bits/byteswap.h
+++ b/libc/sysdeps/linux/cris/bits/byteswap.h
@@ -1,51 +1,56 @@
#ifndef _BITS_BYTESWAP_H
#define _BITS_BYTESWAP_H 1
-#define ___swab16(x) \
+/* CRIS specific byte swap operations: 16, 32 and 64-bit */
+
+/* Swap bytes in 16 bit value. */
+#define __bswap_constant_16(x) \
({ \
unsigned short __x = (x); \
((unsigned short)( \
- (((unsigned short)(__x) & (unsigned short)0x00ffU) << 8) | \
- (((unsigned short)(__x) & (unsigned short)0xff00U) >> 8) )); \
+ (((unsigned short)(__x) & (unsigned short)0x00ffu) << 8) | \
+ (((unsigned short)(__x) & (unsigned short)0xff00u) >> 8) )); \
})
-#define ___swab32(x) \
+#if defined __GNUC__ && __GNUC__ >= 2
+# define __bswap_16(x) \
+ __extension__ \
+ ({ unsigned short __bswap_16_v; \
+ if (__builtin_constant_p (x)) \
+ __bswap_16_v = __bswap_constant_16 (x); \
+ else \
+ __asm__ ("swapb %0" : "=r" (__bswap_16_v) : "0" (x)); \
+ __bswap_16_v; })
+#else
+# define __bswap_16(x) __bswap_constant_16 (x)
+#endif
+
+
+/* Swap bytes in 32 bit value. */
+#define __bswap_constant_32(x) \
({ \
unsigned long __x = (x); \
((unsigned long)( \
- (((unsigned long)(__x) & (unsigned long)0x000000ffUL) << 24) | \
- (((unsigned long)(__x) & (unsigned long)0x0000ff00UL) << 8) | \
- (((unsigned long)(__x) & (unsigned long)0x00ff0000UL) >> 8) | \
- (((unsigned long)(__x) & (unsigned long)0xff000000UL) >> 24) )); \
+ (((unsigned long)(__x) & (unsigned long)0x000000fful) << 24) | \
+ (((unsigned long)(__x) & (unsigned long)0x0000ff00ul) << 8) | \
+ (((unsigned long)(__x) & (unsigned long)0x00ff0000ul) >> 8) | \
+ (((unsigned long)(__x) & (unsigned long)0xff000000ul) >> 24) )); \
})
-/* these are CRIS specific */
-
-static inline unsigned short __fswab16(unsigned short x)
-{
- __asm__ ("swapb %0" : "=r" (x) : "0" (x));
-
- return(x);
-}
-
-static inline unsigned long __fswab32(unsigned long x)
-{
- __asm__ ("swapwb %0" : "=r" (x) : "0" (x));
-
- return(x);
-}
-
-# define __bswap_16(x) \
-(__builtin_constant_p((unsigned short)(x)) ? \
- ___swab16((x)) : \
- __fswab16((x)))
-
+#if defined __GNUC__ && __GNUC__ >= 2
# define __bswap_32(x) \
-(__builtin_constant_p((unsigned long)(x)) ? \
- ___swab32((x)) : \
- __fswab32((x)))
+ __extension__ \
+ ({ unsigned long __bswap_32_v; \
+ if (__builtin_constant_p (x)) \
+ __bswap_32_v = __bswap_constant_32 (x); \
+ else \
+ __asm__ ("swapwb %0" : "=r" (__bswap_32_v) : "0" (x)); \
+ __bswap_32_v; })
+#else
+# define __bswap_32(x) __bswap_constant_32 (x)
+#endif
+
-#if defined __GNUC__ && __GNUC__ >= 2
/* Swap bytes in 64 bit value. */
# define __bswap_constant_64(x) \
((((x) & 0xff00000000000000ull) >> 56) \
@@ -57,6 +62,7 @@ static inline unsigned long __fswab32(unsigned long x)
| (((x) & 0x000000000000ff00ull) << 40) \
| (((x) & 0x00000000000000ffull) << 56))
+#if defined __GNUC__ && __GNUC__ >= 2
# define __bswap_64(x) \
(__extension__ \
({ union { __extension__ unsigned long long int __ll; \
@@ -70,6 +76,8 @@ static inline unsigned long __fswab32(unsigned long x)
__r.__l[1] = __bswap_32 (__w.__l[0]); \
} \
__r.__ll; }))
+#else
+# define __bswap_64(x) __bswap_constant_64 (x)
#endif
#endif /* _BITS_BYTESWAP_H */
diff --git a/libc/sysdeps/linux/cris/bits/syscalls.h b/libc/sysdeps/linux/cris/bits/syscalls.h
index 5f587854f..ce68c04d4 100644
--- a/libc/sysdeps/linux/cris/bits/syscalls.h
+++ b/libc/sysdeps/linux/cris/bits/syscalls.h
@@ -62,6 +62,14 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \
}
+#undef _syscall6
+#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
+ type5,arg5,type6,arg6) \
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
+{ \
+return (type) (INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6)); \
+}
+
#undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \
({ \
diff --git a/libc/sysdeps/linux/cris/bits/termios.h b/libc/sysdeps/linux/cris/bits/termios.h
new file mode 100644
index 000000000..63ca4ea93
--- /dev/null
+++ b/libc/sysdeps/linux/cris/bits/termios.h
@@ -0,0 +1,215 @@
+/* termios type and macro definitions. Linux version.
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005
+ 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 _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 32
+struct termios
+ {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+ speed_t c_ispeed; /* input speed */
+ speed_t c_ospeed; /* output speed */
+#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
+#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
+ };
+
+/* c_cc characters */
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VTIME 5
+#define VMIN 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VEOL 11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOL2 16
+
+/* c_iflag bits */
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+#define IUTF8 0040000
+
+/* c_oflag bits */
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY 0000400
+# define NL0 0000000
+# define NL1 0000400
+# define CRDLY 0003000
+# define CR0 0000000
+# define CR1 0001000
+# define CR2 0002000
+# define CR3 0003000
+# define TABDLY 0014000
+# define TAB0 0000000
+# define TAB1 0004000
+# define TAB2 0010000
+# define TAB3 0014000
+# define BSDLY 0020000
+# define BS0 0000000
+# define BS1 0020000
+# define FFDLY 0100000
+# define FF0 0000000
+# define FF1 0100000
+#endif
+
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+
+#ifdef __USE_MISC
+# define XTABS 0014000
+#endif
+
+/* c_cflag bit meaning */
+#ifdef __USE_MISC
+# define CBAUD 0010017
+#endif
+#define B0 0000000 /* hang up */
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+#ifdef __USE_MISC
+# define EXTA B19200
+# define EXTB B38400
+#endif
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+#ifdef __USE_MISC
+# define CBAUDEX 0010000
+#endif
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+#define B921600 0010005
+#define B1843200 0010006
+#define B6250000 0010007
+#ifdef __arch_v32
+#define B12500000 0010010
+#define __MAX_BAUD B12500000
+#else
+#define __MAX_BAUD B6250000
+#endif
+#ifdef __USE_MISC
+# define CIBAUD 002003600000 /* input baud rate (not used) */
+# define CMSPAR 010000000000 /* mark or space (stick) parity */
+# define CRTSCTS 020000000000 /* flow control */
+#endif
+
+/* c_lflag bits */
+#define ISIG 0000001
+#define ICANON 0000002
+#if defined __USE_MISC || defined __USE_XOPEN
+# define XCASE 0000004
+#endif
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#ifdef __USE_MISC
+# define ECHOCTL 0001000
+# define ECHOPRT 0002000
+# define ECHOKE 0004000
+# define FLUSHO 0010000
+# define PENDIN 0040000
+#endif
+#define IEXTEN 0100000
+
+/* tcflow() and TCXONC use these */
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+/* tcflush() and TCFLSH use these */
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+/* tcsetattr uses these */
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+
+#define _IOT_termios /* Hurd ioctl type field. */ \
+ _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
diff --git a/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h b/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h
new file mode 100644
index 000000000..b62a51020
--- /dev/null
+++ b/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h
@@ -0,0 +1,45 @@
+/*
+ * Track misc arch-specific features that aren't config options
+ */
+
+#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
+#define _BITS_UCLIBC_ARCH_FEATURES_H
+
+/* instruction used when calling abort() to kill yourself */
+/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/
+#undef __UCLIBC_ABORT_INSTRUCTION__
+
+/* can your target use syscall6() for mmap ? */
+#undef __UCLIBC_MMAP_HAS_6_ARGS__
+
+/* does your target use syscall4() for truncate64 ? (32bit arches only) */
+#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
+
+/* does your target have a broken create_module() ? */
+#define __UCLIBC_BROKEN_CREATE_MODULE__
+
+/* does your target prefix all symbols with an _ ? */
+#define __UCLIBC_NO_UNDERSCORES__
+
+/* does your target have an asm .set ? */
+#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
+
+/* define if target doesn't like .global */
+#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
+
+/* define if target supports .weak */
+#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
+
+/* define if target supports .weakext */
+#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
+
+/* needed probably only for ppc64 */
+#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
+
+/* define if target supports IEEE signed zero floats */
+#define __UCLIBC_HAVE_SIGNED_ZERO__
+
+/* lovely */
+#define ASM_LINE_SEP @
+
+#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/libc/sysdeps/linux/cris/bits/uClibc_page.h b/libc/sysdeps/linux/cris/bits/uClibc_page.h
index 8219a19da..adfc3c9af 100644
--- a/libc/sysdeps/linux/cris/bits/uClibc_page.h
+++ b/libc/sysdeps/linux/cris/bits/uClibc_page.h
@@ -25,4 +25,10 @@
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
+/* Some architectures always use 12 as page shift for mmap2() eventhough the
+ * real PAGE_SHIFT != 12. Other architectures use the same value as
+ * PAGE_SHIFT...
+ */
+#define MMAP2_PAGE_SHIFT PAGE_SHIFT
+
#endif /* _UCLIBC_PAGE_H */