summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/sysdeps/linux/mips/bits/stat.h10
-rw-r--r--libc/sysdeps/linux/mips/bits/syscalls.h27
-rw-r--r--libc/sysdeps/linux/mips/brk.c10
-rw-r--r--libc/sysdeps/linux/mips/pipe.S2
-rw-r--r--libc/sysdeps/linux/mips/sigaction.c8
5 files changed, 31 insertions, 26 deletions
diff --git a/libc/sysdeps/linux/mips/bits/stat.h b/libc/sysdeps/linux/mips/bits/stat.h
index cc077b8fc..bb4076f05 100644
--- a/libc/sysdeps/linux/mips/bits/stat.h
+++ b/libc/sysdeps/linux/mips/bits/stat.h
@@ -37,7 +37,7 @@
struct stat
{
__dev_t st_dev;
- long int st_pad1[3];
+ long int st_pad1[2];
#ifndef __USE_FILE_OFFSET64
__ino_t st_ino; /* File serial number. */
#else
@@ -49,12 +49,12 @@ struct stat
__gid_t st_gid; /* Group ID of the file's group.*/
__dev_t st_rdev; /* Device number, if device. */
#ifndef __USE_FILE_OFFSET64
- long int st_pad2[2];
+ long int st_pad2[1];
__off_t st_size; /* Size of file, in bytes. */
/* SVR4 added this extra long to allow for expansion of off_t. */
long int st_pad3;
#else
- long int st_pad2[3];
+ long int st_pad2[2];
__off64_t st_size; /* Size of file, in bytes. */
#endif
/*
@@ -81,14 +81,14 @@ struct stat
struct stat64
{
__dev_t st_dev;
- long int st_pad1[3];
+ long int st_pad1[2];
__ino64_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.*/
__dev_t st_rdev; /* Device number, if device. */
- long int st_pad2[3];
+ long int st_pad2[2];
__off64_t st_size; /* Size of file, in bytes. */
/*
* Actually this should be timestruc_t st_atime, st_mtime and
diff --git a/libc/sysdeps/linux/mips/bits/syscalls.h b/libc/sysdeps/linux/mips/bits/syscalls.h
index 09688dd1b..6c6c7da34 100644
--- a/libc/sysdeps/linux/mips/bits/syscalls.h
+++ b/libc/sysdeps/linux/mips/bits/syscalls.h
@@ -22,6 +22,9 @@
#ifndef __ASSEMBLER__
+#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "memory"
+
#define _syscall0(type,name) \
type name(void) \
{ \
@@ -37,8 +40,7 @@ type name(void) \
".set reorder" \
: "=r" (__v0), "=r" (__a3) \
: "i" (SYS_ify(name)) \
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
sys_result = __v0; \
} \
@@ -64,8 +66,7 @@ type name(atype a) \
".set reorder" \
: "=r" (__v0), "=r" (__a3) \
: "r" (__a0), "i" (SYS_ify(name)) \
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
sys_result = __v0; \
} \
@@ -92,8 +93,7 @@ type name(atype a,btype b) \
".set reorder" \
: "=r" (__v0), "=r" (__a3) \
: "r" (__a0), "r" (__a1), "i" (SYS_ify(name)) \
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
sys_result = __v0; \
} \
@@ -121,8 +121,7 @@ type name (atype a, btype b, ctype c) \
".set reorder" \
: "=r" (__v0), "=r" (__a3) \
: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) \
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
sys_result = __v0; \
} \
@@ -150,8 +149,7 @@ type name (atype a, btype b, ctype c, dtype d) \
".set reorder" \
: "=r" (__v0), "+r" (__a3) \
: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) \
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
sys_result = __v0; \
} \
@@ -185,8 +183,7 @@ type name (atype a,btype b,ctype c,dtype d,etype e) \
: "=r" (__v0), "+r" (__a3) \
: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \
"m" (constE) \
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
sys_result = __v0; \
} \
@@ -223,8 +220,7 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
: "=r" (__v0), "+r" (__a3) \
: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \
"m" (constE), "m" (constF) \
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
sys_result = __v0; \
} \
@@ -264,8 +260,7 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f,gtype g) \
: "=r" (__v0), "+r" (__a3) \
: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \
"m" (constE), "m" (constF), "m" (constG) \
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
sys_result = __v0; \
} \
diff --git a/libc/sysdeps/linux/mips/brk.c b/libc/sysdeps/linux/mips/brk.c
index c33111ed7..ba6765ca7 100644
--- a/libc/sysdeps/linux/mips/brk.c
+++ b/libc/sysdeps/linux/mips/brk.c
@@ -1,5 +1,5 @@
/* brk system call for Linux/MIPS.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 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
@@ -23,7 +23,7 @@
void *__curbrk = 0;
-int brk (void *addr)
+int attribute_hidden __brk (void *addr)
{
void *newbrk;
@@ -31,10 +31,11 @@ int brk (void *addr)
register long int res __asm__ ("$2");
asm ("move\t$4,%2\n\t"
+ "li\t%0,%1\n\t"
"syscall" /* Perform the system call. */
: "=r" (res)
- : "0" (__NR_brk), "r" (addr)
- : "$4", "$7");
+ : "I" (__NR_brk), "r" (addr)
+ : "$4", "$7", __SYSCALL_CLOBBERS);
newbrk = (void *) res;
}
__curbrk = newbrk;
@@ -47,3 +48,4 @@ int brk (void *addr)
return 0;
}
+strong_alias(__brk,brk)
diff --git a/libc/sysdeps/linux/mips/pipe.S b/libc/sysdeps/linux/mips/pipe.S
index 1936d7626..fb8f7ef7f 100644
--- a/libc/sysdeps/linux/mips/pipe.S
+++ b/libc/sysdeps/linux/mips/pipe.S
@@ -8,7 +8,6 @@
#include <asm/regdef.h>
.globl pipe
- .set pipe,__pipe
.globl __pipe
.hidden __pipe
.ent __pipe, 0
@@ -32,3 +31,4 @@ __pipe:
j ra
.end __pipe
.size __pipe,.-__pipe
+ .weak pipe; pipe = __pipe
diff --git a/libc/sysdeps/linux/mips/sigaction.c b/libc/sysdeps/linux/mips/sigaction.c
index b2982678b..085e25fe6 100644
--- a/libc/sysdeps/linux/mips/sigaction.c
+++ b/libc/sysdeps/linux/mips/sigaction.c
@@ -39,7 +39,11 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
if (act) {
kact.k_sa_handler = act->sa_handler;
+#ifdef IS_IN_libc
__memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
+#else
+ memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
+#endif
kact.sa_flags = act->sa_flags;
# ifdef HAVE_SA_RESTORER
# if _MIPS_SIM == _ABIO32
@@ -57,7 +61,11 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
if (oact && result >= 0) {
oact->sa_handler = koact.k_sa_handler;
+#ifdef IS_IN_libc
__memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask));
+#else
+ memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask));
+#endif
oact->sa_flags = koact.sa_flags;
# ifdef HAVE_SA_RESTORER
oact->sa_restorer = koact.sa_restorer;