summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/mips/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/mips/bits')
-rw-r--r--libc/sysdeps/linux/mips/bits/dlfcn.h28
-rw-r--r--libc/sysdeps/linux/mips/bits/fcntl.h127
-rw-r--r--libc/sysdeps/linux/mips/bits/kernel_stat.h74
-rw-r--r--libc/sysdeps/linux/mips/bits/kernel_types.h2
-rw-r--r--libc/sysdeps/linux/mips/bits/mman.h30
-rw-r--r--libc/sysdeps/linux/mips/bits/resource.h22
-rw-r--r--libc/sysdeps/linux/mips/bits/setjmp.h10
-rw-r--r--libc/sysdeps/linux/mips/bits/sigcontext.h84
-rw-r--r--libc/sysdeps/linux/mips/bits/sigcontextinfo.h18
-rw-r--r--libc/sysdeps/linux/mips/bits/siginfo.h27
-rw-r--r--libc/sysdeps/linux/mips/bits/socket.h31
-rw-r--r--libc/sysdeps/linux/mips/bits/stat.h77
-rw-r--r--libc/sysdeps/linux/mips/bits/syscalls.h563
-rw-r--r--libc/sysdeps/linux/mips/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/mips/bits/wordsize.h4
15 files changed, 781 insertions, 319 deletions
diff --git a/libc/sysdeps/linux/mips/bits/dlfcn.h b/libc/sysdeps/linux/mips/bits/dlfcn.h
index 55e68e91e..1f054f979 100644
--- a/libc/sysdeps/linux/mips/bits/dlfcn.h
+++ b/libc/sysdeps/linux/mips/bits/dlfcn.h
@@ -1,5 +1,6 @@
/* System dependent definitions for run-time dynamic loading.
- Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1999, 2000, 2001, 2004
+ 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
@@ -24,8 +25,9 @@
/* The MODE argument to `dlopen' contains one of the following: */
#define RTLD_LAZY 0x0001 /* Lazy function call binding. */
#define RTLD_NOW 0x0002 /* Immediate function call binding. */
-#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
+#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
#define RTLD_NOLOAD 0x00008 /* Do not load the object. */
+#define RTLD_DEEPBIND 0x00010 /* Use deep binding. */
/* If the following bit is set in the MODE argument to `dlopen',
the symbols of the loaded object and its dependencies are made
@@ -40,3 +42,25 @@
/* Do not delete object when closed. */
#define RTLD_NODELETE 0x01000
+#if 0 /*def __USE_GNU*/
+/* To support profiling of shared objects it is a good idea to call
+ the function found using `dlsym' using the following macro since
+ these calls do not use the PLT. But this would mean the dynamic
+ loader has no chance to find out when the function is called. The
+ macro applies the necessary magic so that profiling is possible.
+ Rewrite
+ foo = (*fctp) (arg1, arg2);
+ into
+ foo = DL_CALL_FCT (fctp, (arg1, arg2));
+*/
+# define DL_CALL_FCT(fctp, args) \
+ (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args)
+
+__BEGIN_DECLS
+
+/* This function calls the profiling functions. */
+extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW;
+
+__END_DECLS
+
+#endif
diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h
index 87affe3f3..90011d5d0 100644
--- a/libc/sysdeps/linux/mips/bits/fcntl.h
+++ b/libc/sysdeps/linux/mips/bits/fcntl.h
@@ -18,32 +18,33 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _FCNTL_H
+#ifndef _FCNTL_H
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
#include <sgidefs.h>
#include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
-#define O_ACCMODE 0x0003
-#define O_RDONLY 0x0000
-#define O_WRONLY 0x0001
-#define O_RDWR 0x0002
-#define O_APPEND 0x0008
-#define O_SYNC 0x0010
-#define O_NONBLOCK 0x0080
-#define O_CREAT 0x0100 /* not fcntl */
-#define O_TRUNC 0x0200 /* not fcntl */
-#define O_EXCL 0x0400 /* not fcntl */
-#define O_NOCTTY 0x0800 /* not fcntl */
-#define O_FSYNC O_SYNC
-#define O_ASYNC 0x1000
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 0x2000 /* Allow large file opens. */
-#endif
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#define O_APPEND 0x0008
+#define O_SYNC 0x0010
+#define O_NONBLOCK 0x0080
+#define O_NDELAY O_NONBLOCK
+#define O_CREAT 0x0100 /* not fcntl */
+#define O_TRUNC 0x0200 /* not fcntl */
+#define O_EXCL 0x0400 /* not fcntl */
+#define O_NOCTTY 0x0800 /* not fcntl */
+#define O_FSYNC O_SYNC
+#define O_ASYNC 0x1000
#ifdef __USE_GNU
# define O_NOFOLLOW 0x20000 /* Do not follow links. */
@@ -52,16 +53,22 @@
# define O_NOATIME 0x40000 /* Do not set atime. */
#endif
-#define O_NDELAY O_NONBLOCK
-
-/* For now Linux has no synchronisity options for data and read
- operations. We define the symbols here but let them do the same as
- O_SYNC since this is a superset. */
+/* For now Linux has no synchronisity options for data and read operations.
+ We define the symbols here but let them do the same as O_SYNC since
+ this is a superset. */
#if defined __USE_POSIX199309 || defined __USE_UNIX98
# define O_DSYNC O_SYNC /* Synchronize data. */
# define O_RSYNC O_SYNC /* Synchronize read operations. */
#endif
+#ifdef __USE_LARGEFILE64
+# if __WORDSIZE == 64
+# define O_LARGEFILE 0
+# else
+# define O_LARGEFILE 0x2000 /* Allow large file opens. */
+# endif
+#endif
+
/* Values for the second argument to `fcntl'. */
#define F_DUPFD 0 /* Duplicate file descriptor. */
#define F_GETFD 1 /* Get file descriptor flags. */
@@ -78,9 +85,15 @@
# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
#endif
-#define F_GETLK64 33 /* Get record locking info. */
-#define F_SETLK64 34 /* Set record locking info (non-blocking). */
-#define F_SETLKW64 35 /* Set record locking info (blocking). */
+#if __WORDSIZE == 64
+# define F_GETLK64 14 /* Get record locking info. */
+# define F_SETLK64 6 /* Set record locking info (non-blocking). */
+# define F_SETLKW64 7 /* Set record locking info (blocking). */
+#else
+# define F_GETLK64 33 /* Get record locking info. */
+# define F_SETLK64 34 /* Set record locking info (non-blocking). */
+# define F_SETLKW64 35 /* Set record locking info (blocking). */
+#endif
#if defined __USE_BSD || defined __USE_UNIX98
# define F_SETOWN 24 /* Get owner of socket (receiver of SIGIO). */
@@ -96,9 +109,11 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
#endif
-/* for F_[GET|SET]FL */
+/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
@@ -106,12 +121,12 @@
#define F_WRLCK 1 /* Write lock. */
#define F_UNLCK 2 /* Remove lock. */
-/* for old implementation of bsd flock () */
+/* For old implementation of bsd flock(). */
#define F_EXLCK 4 /* or 3 */
#define F_SHLCK 8 /* or 4 */
#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation */
+/* Operations for bsd flock(), also used by the kernel implementation. */
# define LOCK_SH 1 /* shared lock */
# define LOCK_EX 2 /* exclusive lock */
# define LOCK_NB 4 /* or'd with one of the above to prevent
@@ -137,7 +152,7 @@
# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
#endif
-typedef struct flock
+struct flock
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
@@ -159,7 +174,8 @@ typedef struct flock
flock in o32 and n32, never has this field. */
long int pad[4];
#endif
-} flock_t;
+ };
+typedef struct flock flock_t;
#ifdef __USE_LARGEFILE64
struct flock64
@@ -172,7 +188,6 @@ struct flock64
};
#endif
-
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
@@ -193,16 +208,58 @@ struct flock64
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
-/* Linux-specific operations for posix_fadvise. */
+
#ifdef __USE_GNU
-# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */
-# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */
+#if 0
+/* Flags for SYNC_FILE_RANGE. */
+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
+ in the range before performing the
+ write. */
+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
+ dirty pages in the range which are
+ not presently under writeback. */
+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
+ the range after performing the
+ write. */
+#endif
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
#endif
__BEGIN_DECLS
+#ifdef __USE_GNU
+
/* Provide kernel hint to read ahead. */
extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
__THROW;
+
+#if 0
+/* Selective file content synch'ing. */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+ unsigned int __flags);
+#endif
+
+/* Splice address range into a pipe. */
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
+
+/* Splice two files together. */
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
+
+/* In-kernel implementation of tee for pipe buffers. */
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
+
+#endif
__END_DECLS
+
diff --git a/libc/sysdeps/linux/mips/bits/kernel_stat.h b/libc/sysdeps/linux/mips/bits/kernel_stat.h
index 2bce38884..13c23d359 100644
--- a/libc/sysdeps/linux/mips/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/mips/bits/kernel_stat.h
@@ -1,13 +1,65 @@
#ifndef _BITS_STAT_STRUCT_H
#define _BITS_STAT_STRUCT_H
+#ifndef _LIBC
+#error bits/kernel_stat.h is for internal uClibc use only!
+#endif
+
/* This file provides whatever this particular arch's kernel thinks
* struct kernel_stat should look like... It turns out each arch has a
* different opinion on the subject... */
-#if __WORDSIZE == 64
-#define kernel_stat kernel_stat64
-#else
+#include <sgidefs.h>
+
+#if _MIPS_SIM == _MIPS_SIM_ABI64
+/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
+struct kernel_stat {
+ __kernel_dev_t st_dev;
+ unsigned int st_pad1[3];
+ __kernel_ino_t st_ino;
+ __kernel_mode_t st_mode;
+ __kernel_nlink_t st_nlink;
+ __kernel_uid_t st_uid;
+ __kernel_gid_t st_gid;
+ __kernel_dev_t st_rdev;
+ unsigned int st_pad2[3];
+ __kernel_off_t st_size;
+ unsigned int st_atime;
+ unsigned int st_atime_nsec;
+ unsigned int st_mtime;
+ unsigned int st_mtime_nsec;
+ unsigned int st_ctime;
+ unsigned int st_ctime_nsec;
+ unsigned int st_blksize;
+ unsigned int reserved3;
+ unsigned long st_blocks;
+};
+#define kernel_stat64 kernel_stat
+#elif _MIPS_SIM == _MIPS_SIM_NABI32
+/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
+struct kernel_stat {
+ unsigned int st_dev;
+ unsigned int st_pad1[3];
+ unsigned long long st_ino;
+ __kernel_mode_t st_mode;
+ __kernel_nlink_t st_nlink;
+ __kernel_uid_t st_uid;
+ __kernel_gid_t st_gid;
+ unsigned int st_rdev;
+ unsigned int st_pad2[3];
+ unsigned long long st_size;
+ unsigned int st_atime;
+ unsigned int st_atime_nsec;
+ unsigned int st_mtime;
+ unsigned int st_mtime_nsec;
+ unsigned int st_ctime;
+ unsigned int st_ctime_nsec;
+ unsigned int st_blksize;
+ unsigned int reserved3;
+ unsigned long long st_blocks;
+};
+#define kernel_stat64 kernel_stat
+#else /* O32 */
struct kernel_stat {
__kernel_dev_t st_dev;
long st_pad1[3];
@@ -21,16 +73,15 @@ struct kernel_stat {
__kernel_off_t st_size;
long st_pad3;
time_t st_atime;
- long reserved0;
+ long st_atime_nsec;
time_t st_mtime;
- long reserved1;
+ long st_mtime_nsec;
time_t st_ctime;
- long reserved2;
+ long st_ctime_nsec;
long st_blksize;
long st_blocks;
long st_pad4[14];
};
-#endif
struct kernel_stat64 {
unsigned long st_dev;
@@ -44,15 +95,18 @@ struct kernel_stat64 {
unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
long long st_size;
time_t st_atime;
- unsigned long reserved0; /* Reserved for st_atime expansion */
+ unsigned long st_atime_nsec;
time_t st_mtime;
- unsigned long reserved1; /* Reserved for st_mtime expansion */
+ unsigned long st_mtime_nsec;
time_t st_ctime;
- unsigned long reserved2; /* Reserved for st_ctime expansion */
+ unsigned long st_ctime_nsec;
unsigned long st_blksize;
unsigned long st_pad2;
long long st_blocks;
};
+#endif /* O32 */
+
+#define STAT_HAVE_NSEC 1
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/mips/bits/kernel_types.h b/libc/sysdeps/linux/mips/bits/kernel_types.h
index f23b24874..b7e61bd6b 100644
--- a/libc/sysdeps/linux/mips/bits/kernel_types.h
+++ b/libc/sysdeps/linux/mips/bits/kernel_types.h
@@ -9,7 +9,7 @@
# if __WORDSIZE == 64
typedef unsigned int __kernel_dev_t;
-typedef unsigned int __kernel_ino_t;
+typedef unsigned long __kernel_ino_t;
typedef unsigned int __kernel_mode_t;
typedef unsigned int __kernel_nlink_t;
typedef long __kernel_off_t;
diff --git a/libc/sysdeps/linux/mips/bits/mman.h b/libc/sysdeps/linux/mips/bits/mman.h
index b1b00e6f3..47d33933a 100644
--- a/libc/sysdeps/linux/mips/bits/mman.h
+++ b/libc/sysdeps/linux/mips/bits/mman.h
@@ -50,7 +50,7 @@
/* Other flags. */
#define MAP_FIXED 0x10 /* Interpret addr exactly. */
#ifdef __USE_MISC
-# define MAP_FILE 0x00
+# define MAP_FILE 0
# define MAP_ANONYMOUS 0x0800 /* Don't use a file. */
# define MAP_ANON MAP_ANONYMOUS
# define MAP_RENAME MAP_ANONYMOUS
@@ -70,22 +70,30 @@
/* Flags to `msync'. */
#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
#define MS_SYNC 4 /* Synchronous memory sync. */
+#define MS_INVALIDATE 2 /* Invalidate the caches. */
/* Flags for `mlockall'. */
#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
#define MCL_FUTURE 2 /* Lock all additions to address
space. */
+/* Flags for `mremap'. */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE 1
+# define MREMAP_FIXED 2
+#endif
+
/* Advice to `madvise'. */
#ifdef __USE_BSD
-#define MADV_NORMAL 0 /* default page-in behavior */
-#define MADV_RANDOM 1 /* page-in minimum required */
-#define MADV_SEQUENTIAL 2 /* read-ahead aggressively */
-#define MADV_WILLNEED 3 /* pre-fault pages */
-#define MADV_DONTNEED 4 /* discard these pages */
-#define MADV_REMOVE 5 /* remove these pages & resources */
+# define MADV_NORMAL 0 /* No further special treatment. */
+# define MADV_RANDOM 1 /* Expect random page references. */
+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define MADV_WILLNEED 3 /* Will need these pages. */
+# define MADV_DONTNEED 4 /* Don't need these pages. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
#endif
/* The POSIX people had to invent similar names for the same things. */
@@ -96,9 +104,3 @@
# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
#endif
-
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-# define MREMAP_FIXED 2
-#endif
diff --git a/libc/sysdeps/linux/mips/bits/resource.h b/libc/sysdeps/linux/mips/bits/resource.h
index 9e99f5d5d..1c8b99a93 100644
--- a/libc/sysdeps/linux/mips/bits/resource.h
+++ b/libc/sysdeps/linux/mips/bits/resource.h
@@ -107,14 +107,22 @@ enum __rlimit_resource
};
/* Value to indicate that there is no limit. */
-#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY ((long int)(~0UL >> 1))
+#if _MIPS_SIM == _ABI64
+/* The N64 syscall uses this value. */
+# define RLIM_INFINITY 0xffffffffffffffffUL
+# ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0xffffffffffffffffUL
+# endif
#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
+/* The O32 and N32 syscalls use 0x7fffffff. */
+# ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY ((long int)(~0UL >> 1))
+# else
+# define RLIM_INFINITY 0x7fffffffffffffffULL
+# endif
+# ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffULL
+# endif
#endif
/* We can represent all limits. */
diff --git a/libc/sysdeps/linux/mips/bits/setjmp.h b/libc/sysdeps/linux/mips/bits/setjmp.h
index 4eb8e9f2a..08e74fe0a 100644
--- a/libc/sysdeps/linux/mips/bits/setjmp.h
+++ b/libc/sysdeps/linux/mips/bits/setjmp.h
@@ -24,6 +24,8 @@
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
#endif
+#include <sgidefs.h>
+
typedef struct
{
/* Program counter. */
@@ -33,7 +35,11 @@ typedef struct
void * __sp;
/* Callee-saved registers s0 through s7. */
+#if _MIPS_SIM == _MIPS_SIM_ABI32
int __regs[8];
+#else
+ long long __regs[8];
+#endif
/* The frame pointer. */
void * __fp;
@@ -45,7 +51,11 @@ typedef struct
int __fpc_csr;
/* Callee-saved floating point registers. */
+#if _MIPS_SIM == _MIPS_SIM_ABI64
+ double __fpregs[8];
+#else /* N32 || O32 */
double __fpregs[6];
+#endif /* N32 || O32 */
} __jmp_buf[1];
#ifdef __USE_MISC
diff --git a/libc/sysdeps/linux/mips/bits/sigcontext.h b/libc/sysdeps/linux/mips/bits/sigcontext.h
new file mode 100644
index 000000000..99faeed39
--- /dev/null
+++ b/libc/sysdeps/linux/mips/bits/sigcontext.h
@@ -0,0 +1,84 @@
+/* Copyright (C) 1996, 1997, 1998, 2003, 2004, 2006 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 _BITS_SIGCONTEXT_H
+#define _BITS_SIGCONTEXT_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+#include <sgidefs.h>
+
+#if _MIPS_SIM == _ABIO32
+
+/* Certain unused fields were replaced with new ones in 2.6.12-rc4.
+ The changes were as follows:
+
+ sc_cause -> sc_hi1
+ sc_badvaddr -> sc_lo1
+ sc_sigset[0] -> sc_hi2
+ sc_sigset[1] -> sc_lo2
+ sc_sigset[2] -> sc_hi3
+ sc_sigset[3] -> sc_lo3
+
+ sc_regmask, sc_ownedfp and sc_fpc_eir are not used. */
+struct sigcontext {
+ unsigned int sc_regmask;
+ unsigned int sc_status;
+ unsigned long long sc_pc;
+ unsigned long long sc_regs[32];
+ unsigned long long sc_fpregs[32];
+ unsigned int sc_ownedfp;
+ unsigned int sc_fpc_csr;
+ unsigned int sc_fpc_eir;
+ unsigned int sc_used_math;
+ unsigned int sc_dsp;
+ unsigned long long sc_mdhi;
+ unsigned long long sc_mdlo;
+ unsigned long sc_hi1;
+ unsigned long sc_lo1;
+ unsigned long sc_hi2;
+ unsigned long sc_lo2;
+ unsigned long sc_hi3;
+ unsigned long sc_lo3;
+};
+
+#else
+
+/* This structure changed in 2.6.12-rc4 when DSP support was added. */
+struct sigcontext {
+ unsigned long long sc_regs[32];
+ unsigned long long sc_fpregs[32];
+ unsigned long long sc_mdhi;
+ unsigned long long sc_hi1;
+ unsigned long long sc_hi2;
+ unsigned long long sc_hi3;
+ unsigned long long sc_mdlo;
+ unsigned long long sc_lo1;
+ unsigned long long sc_lo2;
+ unsigned long long sc_lo3;
+ unsigned long long sc_pc;
+ unsigned int sc_fpc_csr;
+ unsigned int sc_used_math;
+ unsigned int sc_dsp;
+ unsigned int sc_reserved;
+};
+
+#endif /* _MIPS_SIM != _ABIO32 */
+#endif
diff --git a/libc/sysdeps/linux/mips/bits/sigcontextinfo.h b/libc/sysdeps/linux/mips/bits/sigcontextinfo.h
index a51c6f043..f453c8d9b 100644
--- a/libc/sysdeps/linux/mips/bits/sigcontextinfo.h
+++ b/libc/sysdeps/linux/mips/bits/sigcontextinfo.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
@@ -18,6 +18,10 @@
02111-1307 USA. */
+#include <sgidefs.h>
+
+#if _MIPS_SIM == _ABIO32
+
#define SIGCONTEXT unsigned long _code, struct sigcontext *
#define SIGCONTEXT_EXTRA_ARGS _code,
#define GET_PC(ctx) ((void *) ctx->sc_pc)
@@ -25,3 +29,15 @@
#define GET_STACK(ctx) ((void *) ctx->sc_regs[29])
#define CALL_SIGHANDLER(handler, signo, ctx) \
(handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
+
+#else
+
+#define SIGCONTEXT unsigned long _code, ucontext_t *
+#define SIGCONTEXT_EXTRA_ARGS _code,
+#define GET_PC(ctx) ((void *) ctx->uc_mcontext.pc)
+#define GET_FRAME(ctx) ((void *) ctx->uc_mcontext.gregs[30])
+#define GET_STACK(ctx) ((void *) ctx->uc_mcontext.gregs[29])
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
+
+#endif
diff --git a/libc/sysdeps/linux/mips/bits/siginfo.h b/libc/sysdeps/linux/mips/bits/siginfo.h
index 248893e86..ba3e1f630 100644
--- a/libc/sysdeps/linux/mips/bits/siginfo.h
+++ b/libc/sysdeps/linux/mips/bits/siginfo.h
@@ -1,5 +1,6 @@
/* siginfo_t, sigevent and constants. Linux/MIPS version.
- Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, 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
@@ -22,6 +23,8 @@
# error "Never include this file directly. Use <signal.h> instead"
#endif
+#include <bits/wordsize.h>
+
#if (!defined __have_sigval_t \
&& (defined _SIGNAL_H || defined __need_siginfo_t \
|| defined __need_sigevent_t))
@@ -39,8 +42,13 @@ typedef union sigval
&& (defined _SIGNAL_H || defined __need_siginfo_t))
# define __have_siginfo_t 1
-# define __SI_MAX_SIZE 128
-# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# define __SI_MAX_SIZE 128
+# if __WORDSIZE == 64
+# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
+# else
+# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# endif
+
typedef struct siginfo
{
@@ -48,6 +56,8 @@ typedef struct siginfo
int si_code; /* Signal code. */
int si_errno; /* If non-zero, an errno value associated with
this signal, as defined in <errno.h>. */
+ int __pad0[__SI_MAX_SIZE / sizeof (int) - __SI_PAD_SIZE - 3];
+ /* Explicit padding. */
union
{
@@ -149,7 +159,7 @@ enum
# define ILL_ILLOPN ILL_ILLOPN
ILL_ILLADR, /* Illegal addressing mode. */
# define ILL_ILLADR ILL_ILLADR
- ILL_ILLTRP, /* Illegal trap. */
+ ILL_ILLTRP, /* Illegal trap. */
# define ILL_ILLTRP ILL_ILLTRP
ILL_PRVOPC, /* Privileged opcode. */
# define ILL_PRVOPC ILL_PRVOPC
@@ -255,7 +265,8 @@ enum
/* Structure to transport application-defined values with signals. */
# define __SIGEV_MAX_SIZE 64
-# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# define __SIGEV_HEAD_SIZE (sizeof(long) + 2*sizeof(int))
+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE - __SIGEV_HEAD_SIZE) / sizeof (int))
/* Forward declaration of the `pthread_attr_t' type. */
struct __pthread_attr_s;
@@ -273,8 +284,8 @@ typedef struct sigevent
struct
{
- void (*_function) (sigval_t); /* Function to start. */
- struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */
+ void (*_function) (sigval_t); /* Function to start. */
+ void *_attribute; /* Really pthread_attr_t. */
} _sigev_thread;
} _sigev_un;
} sigevent_t;
@@ -294,7 +305,7 @@ enum
# define SIGEV_THREAD SIGEV_THREAD
SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */
-#define SIGEV_THREAD_ID SIGEV_THREAD_ID
+#define SIGEV_THREAD_ID SIGEV_THREAD_ID
};
#endif /* have _SIGNAL_H. */
diff --git a/libc/sysdeps/linux/mips/bits/socket.h b/libc/sysdeps/linux/mips/bits/socket.h
index a10c3a711..c43a4cd2e 100644
--- a/libc/sysdeps/linux/mips/bits/socket.h
+++ b/libc/sysdeps/linux/mips/bits/socket.h
@@ -1,5 +1,6 @@
/* System-specific socket constants and types. Linux/MIPS version.
- Copyright (C) 1991,92,1994-1999,2000,2001 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004, 2005, 2006
+ 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
@@ -212,16 +213,29 @@ enum
/* Structure describing messages sent by
`sendmsg' and received by `recvmsg'. */
+/* Note: do not change these members to match glibc; these match the
+ SuSv3 spec already (e.g. msg_iovlen/msg_controllen).
+ http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html */
+/* Note: linux kernel uses __kernel_size_t (which is 8bytes on 64bit
+ platforms, and 4bytes on 32bit platforms) for msg_iovlen/msg_controllen */
struct msghdr
{
void *msg_name; /* Address to send to/receive from. */
socklen_t msg_namelen; /* Length of address data. */
struct iovec *msg_iov; /* Vector of data to send/receive into. */
+#if __WORDSIZE == 32
int msg_iovlen; /* Number of elements in the vector. */
+#else
+ size_t msg_iovlen; /* Number of elements in the vector. */
+#endif
void *msg_control; /* Ancillary data (eg BSD filedesc passing). */
+#if __WORDSIZE == 32
socklen_t msg_controllen; /* Ancillary data buffer length. */
+#else
+ size_t msg_controllen; /* Ancillary data buffer length. */
+#endif
int msg_flags; /* Flags on received message. */
};
@@ -254,14 +268,14 @@ struct cmsghdr
+ CMSG_ALIGN (sizeof (struct cmsghdr)))
#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
-extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
- struct cmsghdr *__cmsg) __THROW;
+extern struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr,
+ struct cmsghdr *__cmsg)) __THROW;
#ifdef __USE_EXTERN_INLINES
# ifndef _EXTERN_INLINE
# define _EXTERN_INLINE extern __inline
# endif
_EXTERN_INLINE struct cmsghdr *
-__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
+__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
{
if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
/* The kernel header does this so there may be a reason. */
@@ -269,8 +283,8 @@ __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
__cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ CMSG_ALIGN (__cmsg->cmsg_len));
- if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
- + __mhdr->msg_controllen)
+ if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
+ + __mhdr->msg_controllen)
|| ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
> ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
/* No more entries. */
@@ -283,13 +297,12 @@ __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
<linux/socket.h>. */
enum
{
- SCM_RIGHTS = 0x01, /* Transfer file descriptors. */
+ SCM_RIGHTS = 0x01 /* Transfer file descriptors. */
#define SCM_RIGHTS SCM_RIGHTS
#ifdef __USE_BSD
- SCM_CREDENTIALS = 0x02, /* Credentials passing. */
+ , SCM_CREDENTIALS = 0x02 /* Credentials passing. */
# define SCM_CREDENTIALS SCM_CREDENTIALS
#endif
- __SCM_CONNECT = 0x03 /* Data array is `struct scm_connect'. */
};
/* User visible structure for SCM_CREDENTIALS message */
diff --git a/libc/sysdeps/linux/mips/bits/stat.h b/libc/sysdeps/linux/mips/bits/stat.h
index bb4076f05..e35d64928 100644
--- a/libc/sysdeps/linux/mips/bits/stat.h
+++ b/libc/sysdeps/linux/mips/bits/stat.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+ 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
@@ -20,6 +21,8 @@
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#include <sgidefs.h>
+
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
@@ -33,6 +36,7 @@
#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
+#if _MIPS_SIM == _ABIO32
/* Structure describing file characteristics. */
struct stat
{
@@ -62,11 +66,11 @@ struct stat
* st_ctime but we don't have it under Linux.
*/
__time_t st_atime; /* Time of last access. */
- long int __reserved0;
+ unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
- long int __reserved1;
+ unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
- long int __reserved2;
+ unsigned long int st_ctimensec; /* Nsecs of last status change. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
#ifndef __USE_FILE_OFFSET64
__blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
@@ -76,8 +80,38 @@ struct stat
#endif
long int st_pad5[14];
};
+#else /* N32 || N64 */
+/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
+struct stat {
+ unsigned int st_dev;
+ int st_pad1[3];
+ __ino_t st_ino; /* File serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ unsigned int st_rdev; /* Device number, if device. */
+ int st_pad2[3];
+ __off_t st_size; /* Size of file, in bytes. */
+ /*
+ * Actually this should be timestruc_t st_atime, st_mtime and
+ * st_ctime but we don't have it under Linux.
+ */
+ int st_atime;
+ int st_atimensec;
+ int st_mtime;
+ int st_mtimensec;
+ int st_ctime;
+ int st_ctimensec;
+ int st_blksize; /* Optimal block size for I/O. */
+ int st_pad3;
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
+ int st_pad4[14];
+};
+#endif /* N32 || N64 */
#ifdef __USE_LARGEFILE64
+#if _MIPS_SIM == _ABIO32
struct stat64
{
__dev_t st_dev;
@@ -95,16 +129,45 @@ struct stat64
* st_ctime but we don't have it under Linux.
*/
__time_t st_atime; /* Time of last access. */
- long int __reserved0;
+ unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
- long int __reserved1;
+ unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
- long int __reserved2;
+ unsigned long int st_ctimensec; /* Nsecs of last status change. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
long int st_pad3;
__blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
long int st_pad4[14];
};
+#else /* N32 || N64 */
+/* stat64 of N32/N64 is just an alias of stat syscall. */
+struct stat64 {
+ unsigned int st_dev;
+ int st_pad1[3];
+ __ino_t st_ino; /* File serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ unsigned int st_rdev; /* Device number, if device. */
+ int st_pad2[3];
+ __off_t st_size; /* Size of file, in bytes. */
+ /*
+ * Actually this should be timestruc_t st_atime, st_mtime and
+ * st_ctime but we don't have it under Linux.
+ */
+ int st_atime;
+ int st_atimensec;
+ int st_mtime;
+ int st_mtimensec;
+ int st_ctime;
+ int st_ctimensec;
+ int st_blksize; /* Optimal block size for I/O. */
+ int st_pad3;
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
+ int st_pad4[14];
+};
+#endif /* N32 || N64 */
#endif
/* Tell code we have these members. */
diff --git a/libc/sysdeps/linux/mips/bits/syscalls.h b/libc/sysdeps/linux/mips/bits/syscalls.h
index 7133d83e3..324d75d9f 100644
--- a/libc/sysdeps/linux/mips/bits/syscalls.h
+++ b/libc/sysdeps/linux/mips/bits/syscalls.h
@@ -4,267 +4,390 @@
# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
#endif
-/* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel
- * header files. It also defines the traditional `SYS_<name>' macros for older
- * programs. */
-#include <bits/sysnum.h>
-
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
-#ifndef SYS_ify
-# define SYS_ify(syscall_name) (__NR_##syscall_name)
-#endif
+#include <sgidefs.h>
#ifndef __ASSEMBLER__
-#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"
+#include <errno.h>
+
+#define SYS_ify(syscall_name) (__NR_##syscall_name)
+#undef _syscall0
#define _syscall0(type,name) \
type name(void) \
-{ \
- long err; \
- long sys_result; \
+{ \
+return (type) (INLINE_SYSCALL(name, 0)); \
+}
+
+#undef _syscall1
+#define _syscall1(type,name,type1,arg1) \
+type name(type1 arg1) \
+{ \
+return (type) (INLINE_SYSCALL(name, 1, arg1)); \
+}
+
+#undef _syscall2
+#define _syscall2(type,name,type1,arg1,type2,arg2) \
+type name(type1 arg1,type2 arg2) \
+{ \
+return (type) (INLINE_SYSCALL(name, 2, arg1, arg2)); \
+}
+
+#undef _syscall3
+#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
+type name(type1 arg1,type2 arg2,type3 arg3) \
+{ \
+return (type) (INLINE_SYSCALL(name, 3, arg1, arg2, arg3)); \
+}
+
+#undef _syscall4
+#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
+type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
+{ \
+return (type) (INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4)); \
+}
+
+#undef _syscall5
+#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
+ type5,arg5) \
+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 _syscall7
+#define _syscall7(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
+ type5,arg5,type6,arg6,type7,arg7) \
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6,type7 arg7) \
+{ \
+return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7)); \
+}
+
+/*
+ * Import from:
+ * glibc-ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+ * glibc-ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
+ * glibc-ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
+ */
+
+/* Define a macro which expands into the inline wrapper code for a system
+ call. */
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+ ({ INTERNAL_SYSCALL_DECL(err); \
+ long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
+ if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
+ { \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
+ result_var = -1L; \
+ } \
+ result_var; })
+
+#undef INTERNAL_SYSCALL_DECL
+#define INTERNAL_SYSCALL_DECL(err) long err
+
+#undef INTERNAL_SYSCALL_ERROR_P
+#define INTERNAL_SYSCALL_ERROR_P(val, err) ((long) (err))
+
+#undef INTERNAL_SYSCALL_ERRNO
+#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
+
+#undef INTERNAL_SYSCALL
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+ internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t", \
+ "i" (SYS_ify (name)), err, args)
+
+#undef INTERNAL_SYSCALL_NCS
+#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
+ internal_syscall##nr (= number, , "r" (__v0), err, args)
+
+#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABI64
+# define ARG_TYPE long
+#else
+# define ARG_TYPE long long
+#endif
+
+#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \
+({ \
+ long _sys_result; \
+ \
{ \
- register unsigned long __v0 asm("$2"); \
- register unsigned long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set noreorder\n\t" \
- "li $2, %2 # " #name "\n\t" \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : "i" (SYS_ify(name)) \
- : __SYSCALL_CLOBBERS); \
+ register ARG_TYPE __v0 __asm__("$2") ncs_init; \
+ register ARG_TYPE __a3 __asm__("$7"); \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ cs_init \
+ "syscall\n\t" \
+ ".set reorder" \
+ : "=r" (__v0), "=r" (__a3) \
+ : input \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
- sys_result = __v0; \
+ _sys_result = __v0; \
} \
- if (err == 0) \
- return (type) sys_result; \
- __set_errno(sys_result); \
- return (type)-1; \
-}
+ _sys_result; \
+})
-#define _syscall1(type,name,atype,a) \
-type name(atype a) \
-{ \
- long err; \
- long sys_result; \
+#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \
+({ \
+ long _sys_result; \
+ \
{ \
- register unsigned long __v0 asm("$2"); \
- register unsigned long __a0 asm("$4") = (unsigned long) a; \
- register unsigned long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set noreorder\n\t" \
- "li $2, %3\t\t\t# " #name "\n\t" \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : "r" (__a0), "i" (SYS_ify(name)) \
- : __SYSCALL_CLOBBERS); \
+ register ARG_TYPE __v0 __asm__("$2") ncs_init; \
+ register ARG_TYPE __a0 __asm__("$4") = (ARG_TYPE) arg1; \
+ register ARG_TYPE __a3 __asm__("$7"); \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ cs_init \
+ "syscall\n\t" \
+ ".set reorder" \
+ : "=r" (__v0), "=r" (__a3) \
+ : input, "r" (__a0) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
- sys_result = __v0; \
+ _sys_result = __v0; \
} \
- if (err == 0) \
- return (type) sys_result; \
- __set_errno(sys_result); \
- return (type)-1; \
-}
+ _sys_result; \
+})
-#define _syscall2(type,name,atype,a,btype,b) \
-type name(atype a,btype b) \
-{ \
- long err; \
- long sys_result; \
+#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \
+({ \
+ long _sys_result; \
+ \
{ \
- register unsigned long __v0 asm("$2"); \
- register unsigned long __a0 asm("$4") = (unsigned long) a; \
- register unsigned long __a1 asm("$5") = (unsigned long) b; \
- register unsigned long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set noreorder\n\t" \
- "li $2, %4\t\t\t# " #name "\n\t" \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : "r" (__a0), "r" (__a1), "i" (SYS_ify(name)) \
- : __SYSCALL_CLOBBERS); \
+ register ARG_TYPE __v0 __asm__("$2") ncs_init; \
+ register ARG_TYPE __a0 __asm__("$4") = (ARG_TYPE) arg1; \
+ register ARG_TYPE __a1 __asm__("$5") = (ARG_TYPE) arg2; \
+ register ARG_TYPE __a3 __asm__("$7"); \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ cs_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "=r" (__a3) \
+ : input, "r" (__a0), "r" (__a1) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
- sys_result = __v0; \
+ _sys_result = __v0; \
} \
- if (err == 0) \
- return (type) sys_result; \
- __set_errno(sys_result); \
- return (type)-1; \
-}
+ _sys_result; \
+})
-#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
-type name (atype a, btype b, ctype c) \
-{ \
- long err; \
- long sys_result; \
+#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3)\
+({ \
+ long _sys_result; \
+ \
{ \
- register unsigned long __v0 asm("$2"); \
- register unsigned long __a0 asm("$4") = (unsigned long) a; \
- register unsigned long __a1 asm("$5") = (unsigned long) b; \
- register unsigned long __a2 asm("$6") = (unsigned long) c; \
- register unsigned long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set noreorder\n\t" \
- "li $2, %5\t\t\t# " #name "\n\t" \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) \
- : __SYSCALL_CLOBBERS); \
+ register ARG_TYPE __v0 __asm__("$2") ncs_init; \
+ register ARG_TYPE __a0 __asm__("$4") = (ARG_TYPE) arg1; \
+ register ARG_TYPE __a1 __asm__("$5") = (ARG_TYPE) arg2; \
+ register ARG_TYPE __a2 __asm__("$6") = (ARG_TYPE) arg3; \
+ register ARG_TYPE __a3 __asm__("$7"); \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ cs_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "=r" (__a3) \
+ : input, "r" (__a0), "r" (__a1), "r" (__a2) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
- sys_result = __v0; \
+ _sys_result = __v0; \
} \
- if (err == 0) \
- return (type) sys_result; \
- __set_errno(sys_result); \
- return (type)-1; \
-}
+ _sys_result; \
+})
-#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
-type name (atype a, btype b, ctype c, dtype d) \
-{ \
- long err; \
- long sys_result; \
+#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4)\
+({ \
+ long _sys_result; \
+ \
{ \
- register unsigned long __v0 asm("$2"); \
- register unsigned long __a0 asm("$4") = (unsigned long) a; \
- register unsigned long __a1 asm("$5") = (unsigned long) b; \
- register unsigned long __a2 asm("$6") = (unsigned long) c; \
- register unsigned long __a3 asm("$7") = (unsigned long) d; \
- __asm__ volatile ( \
- ".set noreorder\n\t" \
- "li $2, %5\t\t\t# " #name "\n\t" \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "+r" (__a3) \
- : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) \
- : __SYSCALL_CLOBBERS); \
+ register ARG_TYPE __v0 __asm__("$2") ncs_init; \
+ register ARG_TYPE __a0 __asm__("$4") = (ARG_TYPE) arg1; \
+ register ARG_TYPE __a1 __asm__("$5") = (ARG_TYPE) arg2; \
+ register ARG_TYPE __a2 __asm__("$6") = (ARG_TYPE) arg3; \
+ register ARG_TYPE __a3 __asm__("$7") = (ARG_TYPE) arg4; \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ cs_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
+ : input, "r" (__a0), "r" (__a1), "r" (__a2) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
- sys_result = __v0; \
+ _sys_result = __v0; \
} \
- if (err == 0) \
- return (type) sys_result; \
- __set_errno(sys_result); \
- return (type)-1; \
-}
+ _sys_result; \
+})
+
+#if _MIPS_SIM == _ABIO32
+#include <alloca.h>
+/* We need to use a frame pointer for the functions in which we
+ adjust $sp around the syscall, or debug information and unwind
+ information will be $sp relative and thus wrong during the syscall. As
+ of GCC 3.4.3, this is sufficient. */
+#define FORCE_FRAME_POINTER alloca (4)
-#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
-type name (atype a,btype b,ctype c,dtype d,etype e) \
-{ \
- long err; \
- long sys_result; \
- const unsigned long *constE = (void*)(unsigned long) e; \
+#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5)\
+({ \
+ long _sys_result; \
+ \
+ FORCE_FRAME_POINTER; \
{ \
- register unsigned long __v0 asm("$2"); \
- register unsigned long __a0 asm("$4") = (unsigned long) a; \
- register unsigned long __a1 asm("$5") = (unsigned long) b; \
- register unsigned long __a2 asm("$6") = (unsigned long) c; \
- register unsigned long __a3 asm("$7") = (unsigned long) d; \
- __asm__ volatile ( \
- ".set noreorder\n\t" \
- "lw $2, %6\n\t" \
- "subu $29, 32\n\t" \
- "sw $2, 16($29)\n\t" \
- "li $2, %5\t\t\t# " #name "\n\t" \
- "syscall\n\t" \
- "addiu $29, 32\n\t" \
- ".set reorder" \
- : "=r" (__v0), "+r" (__a3) \
- : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \
- "m" (constE) \
- : __SYSCALL_CLOBBERS); \
+ register long __v0 __asm__("$2") ncs_init; \
+ register long __a0 __asm__("$4") = (long) arg1; \
+ register long __a1 __asm__("$5") = (long) arg2; \
+ register long __a2 __asm__("$6") = (long) arg3; \
+ register long __a3 __asm__("$7") = (long) arg4; \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ "subu\t$29, 32\n\t" \
+ "sw\t%6, 16($29)\n\t" \
+ cs_init \
+ "syscall\n\t" \
+ "addiu\t$29, 32\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
+ : input, "r" (__a0), "r" (__a1), "r" (__a2), \
+ "r" ((long)arg5) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
- sys_result = __v0; \
+ _sys_result = __v0; \
} \
- if (err == 0) \
- return (type) sys_result; \
- __set_errno(sys_result); \
- return (type)-1; \
-}
+ _sys_result; \
+})
-#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
-type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
-{ \
- long err; \
- long sys_result; \
- const unsigned long *constE = (void*)(unsigned long) e; \
- const unsigned long *constF = (void*)(unsigned long) f; \
+#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6)\
+({ \
+ long _sys_result; \
+ \
+ FORCE_FRAME_POINTER; \
{ \
- register unsigned long __v0 asm("$2"); \
- register unsigned long __a0 asm("$4") = (unsigned long) a; \
- register unsigned long __a1 asm("$5") = (unsigned long) b; \
- register unsigned long __a2 asm("$6") = (unsigned long) c; \
- register unsigned long __a3 asm("$7") = (unsigned long) d; \
- __asm__ volatile ( \
- ".set noreorder\n\t" \
- "lw $2, %6\n\t" \
- "lw $8, %7\n\t" \
- "subu $29, 32\n\t" \
- "sw $2, 16($29)\n\t" \
- "sw $8, 20($29)\n\t" \
- "li $2, %5\t\t\t# " #name "\n\t" \
+ register long __v0 __asm__("$2") ncs_init; \
+ register long __a0 __asm__("$4") = (long) arg1; \
+ register long __a1 __asm__("$5") = (long) arg2; \
+ register long __a2 __asm__("$6") = (long) arg3; \
+ register long __a3 __asm__("$7") = (long) arg4; \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ "subu\t$29, 32\n\t" \
+ "sw\t%6, 16($29)\n\t" \
+ "sw\t%7, 20($29)\n\t" \
+ cs_init \
+ "syscall\n\t" \
+ "addiu\t$29, 32\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
+ : input, "r" (__a0), "r" (__a1), "r" (__a2), \
+ "r" ((long)arg5), "r" ((long)arg6) \
+ : __SYSCALL_CLOBBERS); \
+ err = __a3; \
+ _sys_result = __v0; \
+ } \
+ _sys_result; \
+})
+
+#define internal_syscall7(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\
+({ \
+ long _sys_result; \
+ \
+ FORCE_FRAME_POINTER; \
+ { \
+ register long __v0 __asm__("$2") ncs_init; \
+ register long __a0 __asm__("$4") = (long) arg1; \
+ register long __a1 __asm__("$5") = (long) arg2; \
+ register long __a2 __asm__("$6") = (long) arg3; \
+ register long __a3 __asm__("$7") = (long) arg4; \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ "subu\t$29, 32\n\t" \
+ "sw\t%6, 16($29)\n\t" \
+ "sw\t%7, 20($29)\n\t" \
+ "sw\t%8, 24($29)\n\t" \
+ cs_init \
+ "syscall\n\t" \
+ "addiu\t$29, 32\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
+ : input, "r" (__a0), "r" (__a1), "r" (__a2), \
+ "r" ((long)arg5), "r" ((long)arg6), "r" ((long)arg7) \
+ : __SYSCALL_CLOBBERS); \
+ err = __a3; \
+ _sys_result = __v0; \
+ } \
+ _sys_result; \
+})
+
+#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "memory"
+
+#else /* N32 || N64 */
+
+#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ register ARG_TYPE __v0 __asm__("$2") ncs_init; \
+ register ARG_TYPE __a0 __asm__("$4") = (ARG_TYPE) arg1; \
+ register ARG_TYPE __a1 __asm__("$5") = (ARG_TYPE) arg2; \
+ register ARG_TYPE __a2 __asm__("$6") = (ARG_TYPE) arg3; \
+ register ARG_TYPE __a3 __asm__("$7") = (ARG_TYPE) arg4; \
+ register ARG_TYPE __a4 __asm__("$8") = (ARG_TYPE) arg5; \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ cs_init \
"syscall\n\t" \
- "addiu $29, 32\n\t" \
- ".set reorder" \
+ ".set\treorder" \
: "=r" (__v0), "+r" (__a3) \
- : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \
- "m" (constE), "m" (constF) \
- : __SYSCALL_CLOBBERS); \
+ : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
- sys_result = __v0; \
+ _sys_result = __v0; \
} \
- if (err == 0) \
- return (type) sys_result; \
- __set_errno(sys_result); \
- return (type)-1; \
-}
+ _sys_result; \
+})
-#define _syscall7(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f,gtype,g) \
-type name (atype a,btype b,ctype c,dtype d,etype e,ftype f,gtype g) \
-{ \
- long err; \
- long sys_result; \
- const unsigned long *constE = (void*)(unsigned long) e; \
- const unsigned long *constF = (void*)(unsigned long) f; \
- const unsigned long *constG = (void*)(unsigned long) g; \
+#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6) \
+({ \
+ long _sys_result; \
+ \
{ \
- register unsigned long __v0 asm("$2"); \
- register unsigned long __a0 asm("$4") = (unsigned long) a; \
- register unsigned long __a1 asm("$5") = (unsigned long) b; \
- register unsigned long __a2 asm("$6") = (unsigned long) c; \
- register unsigned long __a3 asm("$7") = (unsigned long) d; \
- __asm__ volatile ( \
- ".set noreorder\n\t" \
- "lw $2, %6\n\t" \
- "lw $8, %7\n\t" \
- "lw $9, %8\n\t" \
- "subu $29, 32\n\t" \
- "sw $2, 16($29)\n\t" \
- "sw $8, 20($29)\n\t" \
- "sw $9, 24($29)\n\t" \
- "li $2, %5\t\t\t# " #name "\n\t" \
+ register ARG_TYPE __v0 __asm__("$2") ncs_init; \
+ register ARG_TYPE __a0 __asm__("$4") = (ARG_TYPE) arg1; \
+ register ARG_TYPE __a1 __asm__("$5") = (ARG_TYPE) arg2; \
+ register ARG_TYPE __a2 __asm__("$6") = (ARG_TYPE) arg3; \
+ register ARG_TYPE __a3 __asm__("$7") = (ARG_TYPE) arg4; \
+ register ARG_TYPE __a4 __asm__("$8") = (ARG_TYPE) arg5; \
+ register ARG_TYPE __a5 __asm__("$9") = (ARG_TYPE) arg6; \
+ __asm__ __volatile__ ( \
+ ".set\tnoreorder\n\t" \
+ cs_init \
"syscall\n\t" \
- "addiu $29, 32\n\t" \
- ".set reorder" \
+ ".set\treorder" \
: "=r" (__v0), "+r" (__a3) \
- : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \
- "m" (constE), "m" (constF), "m" (constG) \
- : __SYSCALL_CLOBBERS); \
+ : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \
+ "r" (__a5) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
- sys_result = __v0; \
+ _sys_result = __v0; \
} \
- if (err == 0) \
- return (type) sys_result; \
- __set_errno(sys_result); \
- return (type)-1; \
-}
+ _sys_result; \
+})
+
+#define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "memory"
+
+#endif
#endif /* __ASSEMBLER__ */
#endif /* _BITS_SYSCALLS_H */
diff --git a/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h b/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h
index f8d954e3d..42a7c4526 100644
--- a/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h
@@ -17,9 +17,6 @@
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#undef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/mips/bits/wordsize.h b/libc/sysdeps/linux/mips/bits/wordsize.h
index ba643b60a..666c7ad07 100644
--- a/libc/sysdeps/linux/mips/bits/wordsize.h
+++ b/libc/sysdeps/linux/mips/bits/wordsize.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 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
@@ -16,4 +16,4 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define __WORDSIZE 32
+#define __WORDSIZE _MIPS_SZPTR