From 6428ce3cdad3d587fb77f2f1d0d7036f780fa9e0 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Fri, 3 Mar 2006 01:06:48 +0000 Subject: [PATCH] * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (INTERNAL_SYSCALL): Update internal_syscall##nr invocation. (INTERNAL_SYSCALL_NCS): New. (internal_syscall0, internal_syscall1, internal_syscall2, internal_syscall3, internal_syscall4, internal_syscall5, internal_syscall6): Take ncs_init, cs_init, and input arguments. Use them. Correct types for registers. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (INTERNAL_SYSCALL): Update internal_syscall##nr invocation. (INTERNAL_SYSCALL_NCS): New. (internal_syscall0, internal_syscall1, internal_syscall2, internal_syscall3, internal_syscall4, internal_syscall5, internal_syscall6): Take ncs_init, cs_init, and input arguments. Use them. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list: Remove recvfrom and sendto. Mark lseek, msgrcv, and msgsnd as cancellation points. * sysdeps/mips/dl-machine.h (elf_machine_rel): Remove unused "value". Use Elf(Addr) for TLS relocation targets. * sysdeps/unix/sysv/linux/mips/mips64/Makefile: New file. * sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h (lll_futex_wait, lll_futex_timed_wait, lll_futex_wake, lll_futex_requeue): Cast futexp to long for n64. * sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h: New file. --- ChangeLog.mips | 27 +++ sysdeps/mips/dl-machine.h | 12 +- sysdeps/unix/sysv/linux/mips/mips64/Makefile | 9 + sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h | 72 ++++---- sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h | 72 ++++---- .../sysv/linux/mips/mips64/nptl/sysdep-cancel.h | 183 +++++++++++++++++++++ sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 10 +- sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h | 10 +- 8 files changed, 309 insertions(+), 86 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/Makefile create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h diff --git a/ChangeLog.mips b/ChangeLog.mips index 2881533..66ff73c 100644 --- a/ChangeLog.mips +++ b/ChangeLog.mips @@ -1,3 +1,30 @@ +2006-03-02 Daniel Jacobowitz + + * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h + (INTERNAL_SYSCALL): Update internal_syscall##nr invocation. + (INTERNAL_SYSCALL_NCS): New. + (internal_syscall0, internal_syscall1, internal_syscall2, + internal_syscall3, internal_syscall4, internal_syscall5, + internal_syscall6): Take ncs_init, cs_init, and input arguments. + Use them. Correct types for registers. + * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h + (INTERNAL_SYSCALL): Update internal_syscall##nr invocation. + (INTERNAL_SYSCALL_NCS): New. + (internal_syscall0, internal_syscall1, internal_syscall2, + internal_syscall3, internal_syscall4, internal_syscall5, + internal_syscall6): Take ncs_init, cs_init, and input arguments. + Use them. + * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list: Remove + recvfrom and sendto. Mark lseek, msgrcv, and msgsnd as cancellation + points. + * sysdeps/mips/dl-machine.h (elf_machine_rel): Remove unused "value". + Use Elf(Addr) for TLS relocation targets. + * sysdeps/unix/sysv/linux/mips/mips64/Makefile: New file. + * sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h (lll_futex_wait, + lll_futex_timed_wait, lll_futex_wake, lll_futex_requeue): Cast + futexp to long for n64. + * sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h: New file. + 2006-02-20 Roland McGrath * sysdeps/mips/shlib-versions: New file. diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index c04609f..b912184 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. MIPS version. - Copyright (C) 1996-2001, 2002, 2003, 2004, 2005 + Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kazumoto Kojima . @@ -336,28 +336,24 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, # endif { struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; - - if (sym) - value += sym->st_value; switch (r_type) { case R_MIPS_TLS_DTPMOD64: case R_MIPS_TLS_DTPMOD32: if (sym_map) - *(ElfW(Word) *)reloc_addr = sym_map->l_tls_modid; + *(ElfW(Addr) *)reloc_addr = sym_map->l_tls_modid; break; case R_MIPS_TLS_DTPREL64: case R_MIPS_TLS_DTPREL32: - *(ElfW(Word) *)reloc_addr += TLS_DTPREL_VALUE (sym); + *(ElfW(Addr) *)reloc_addr += TLS_DTPREL_VALUE (sym); break; case R_MIPS_TLS_TPREL32: case R_MIPS_TLS_TPREL64: CHECK_STATIC_TLS (map, sym_map); - *(ElfW(Word) *)reloc_addr += TLS_TPREL_VALUE (sym_map, sym); + *(ElfW(Addr) *)reloc_addr += TLS_TPREL_VALUE (sym_map, sym); break; } diff --git a/sysdeps/unix/sysv/linux/mips/mips64/Makefile b/sysdeps/unix/sysv/linux/mips/mips64/Makefile new file mode 100644 index 0000000..0a37c5b --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/mips64/Makefile @@ -0,0 +1,9 @@ +ifeq ($(subdir),socket) +CFLAGS-recv.c += -fexceptions +CFLAGS-send.c += -fexceptions +endif + +ifeq ($(subdir),nptl) +CFLAGS-recv.c += -fexceptions +CFLAGS-send.c += -fexceptions +endif diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h index e601366..247d4ff 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2003, 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 @@ -66,22 +67,28 @@ #define INTERNAL_SYSCALL_ERRNO(val, err) (val) #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args) +#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) -#define internal_syscall0(name, err, dummy...) \ +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ + internal_syscall##nr (= number, , "r" (__v0), err, args) + +#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \ ({ \ long _sys_result; \ \ { \ - register long __v0 asm("$2"); \ - register long __a3 asm("$7"); \ + register long long __v0 asm("$2") ncs_init; \ + register long long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %2\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set reorder" \ : "=r" (__v0), "=r" (__a3) \ - : "i" (SYS_ify(name)) \ + : input \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -89,21 +96,21 @@ _sys_result; \ }) -#define internal_syscall1(name, err, arg1) \ +#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \ ({ \ long _sys_result; \ \ { \ - register long long __v0 asm("$2"); \ + register long long __v0 asm("$2") ncs_init; \ register long long __a0 asm("$4") = (long long) arg1; \ register long long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %3\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set reorder" \ : "=r" (__v0), "=r" (__a3) \ - : "r" (__a0), "i" (SYS_ify(name)) \ + : input, "r" (__a0) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -111,22 +118,22 @@ _sys_result; \ }) -#define internal_syscall2(name, err, arg1, arg2) \ +#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \ ({ \ long _sys_result; \ \ { \ - register long long __v0 asm("$2"); \ + register long long __v0 asm("$2") ncs_init; \ register long long __a0 asm("$4") = (long long) arg1; \ register long long __a1 asm("$5") = (long long) arg2; \ register long long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %4\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "=r" (__a3) \ - : "r" (__a0), "r" (__a1), "i" (SYS_ify(name)) \ + : input, "r" (__a0), "r" (__a1) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -134,23 +141,23 @@ _sys_result; \ }) -#define internal_syscall3(name, err, arg1, arg2, arg3) \ +#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3) \ ({ \ long _sys_result; \ \ { \ - register long long __v0 asm("$2"); \ + register long long __v0 asm("$2") ncs_init; \ register long long __a0 asm("$4") = (long long) arg1; \ register long long __a1 asm("$5") = (long long) arg2; \ register long long __a2 asm("$6") = (long long) arg3; \ register long long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %5\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "=r" (__a3) \ - : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) \ + : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -158,23 +165,23 @@ _sys_result; \ }) -#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) \ +#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4) \ ({ \ long _sys_result; \ \ { \ - register long long __v0 asm("$2"); \ + register long long __v0 asm("$2") ncs_init; \ register long long __a0 asm("$4") = (long long) arg1; \ register long long __a1 asm("$5") = (long long) arg2; \ register long long __a2 asm("$6") = (long long) arg3; \ register long long __a3 asm("$7") = (long long) arg4; \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %5\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "+r" (__a3) \ - : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) \ + : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -182,12 +189,12 @@ _sys_result; \ }) -#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) \ +#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5) \ ({ \ long _sys_result; \ \ { \ - register long long __v0 asm("$2"); \ + register long long __v0 asm("$2") ncs_init; \ register long long __a0 asm("$4") = (long long) arg1; \ register long long __a1 asm("$5") = (long long) arg2; \ register long long __a2 asm("$6") = (long long) arg3; \ @@ -195,12 +202,11 @@ register long long __a4 asm("$8") = (long long) arg5; \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %5\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "+r" (__a3) \ - : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \ - "r" (__a4) \ + : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -208,12 +214,12 @@ _sys_result; \ }) -#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\ +#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6) \ ({ \ long _sys_result; \ \ { \ - register long long __v0 asm("$2"); \ + register long long __v0 asm("$2") ncs_init; \ register long long __a0 asm("$4") = (long long) arg1; \ register long long __a1 asm("$5") = (long long) arg2; \ register long long __a2 asm("$6") = (long long) arg3; \ @@ -222,12 +228,12 @@ register long long __a5 asm("$9") = (long long) arg6; \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %5\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "+r" (__a3) \ - : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \ - "r" (__a4), "r" (__a5) \ + : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \ + "r" (__a5) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h index dc0a1a0..c238822 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2003, 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 @@ -66,22 +67,28 @@ #define INTERNAL_SYSCALL_ERRNO(val, err) (val) #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args) +#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) -#define internal_syscall0(name, err, dummy...) \ +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ + internal_syscall##nr (= number, , "r" (__v0), err, args) + +#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \ ({ \ long _sys_result; \ \ { \ - register long __v0 asm("$2"); \ - register long __a3 asm("$7"); \ + register long __v0 asm("$2") ncs_init; \ + register long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %2\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set reorder" \ : "=r" (__v0), "=r" (__a3) \ - : "i" (SYS_ify(name)) \ + : input \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -89,21 +96,21 @@ _sys_result; \ }) -#define internal_syscall1(name, err, arg1) \ +#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \ ({ \ long _sys_result; \ \ { \ - register long __v0 asm("$2"); \ + register long __v0 asm("$2") ncs_init; \ register long __a0 asm("$4") = (long) arg1; \ register long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %3\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set reorder" \ : "=r" (__v0), "=r" (__a3) \ - : "r" (__a0), "i" (SYS_ify(name)) \ + : input, "r" (__a0) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -111,22 +118,22 @@ _sys_result; \ }) -#define internal_syscall2(name, err, arg1, arg2) \ +#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \ ({ \ long _sys_result; \ \ { \ - register long __v0 asm("$2"); \ + register long __v0 asm("$2") ncs_init; \ register long __a0 asm("$4") = (long) arg1; \ register long __a1 asm("$5") = (long) arg2; \ register long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %4\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "=r" (__a3) \ - : "r" (__a0), "r" (__a1), "i" (SYS_ify(name)) \ + : input, "r" (__a0), "r" (__a1) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -134,23 +141,23 @@ _sys_result; \ }) -#define internal_syscall3(name, err, arg1, arg2, arg3) \ +#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3) \ ({ \ long _sys_result; \ \ { \ - register long __v0 asm("$2"); \ + 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"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %5\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "=r" (__a3) \ - : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) \ + : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -158,23 +165,23 @@ _sys_result; \ }) -#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) \ +#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4) \ ({ \ long _sys_result; \ \ { \ - register long __v0 asm("$2"); \ + 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" \ - "li\t$2, %5\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "+r" (__a3) \ - : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) \ + : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -182,12 +189,12 @@ _sys_result; \ }) -#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) \ +#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5) \ ({ \ long _sys_result; \ \ { \ - register long __v0 asm("$2"); \ + 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; \ @@ -195,12 +202,11 @@ register long __a4 asm("$8") = (long) arg5; \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %5\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "+r" (__a3) \ - : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \ - "r" (__a4) \ + : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -208,12 +214,12 @@ _sys_result; \ }) -#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\ +#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6) \ ({ \ long _sys_result; \ \ { \ - register long __v0 asm("$2"); \ + 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; \ @@ -222,12 +228,12 @@ register long __a5 asm("$9") = (long) arg6; \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ - "li\t$2, %5\t\t\t# " #name "\n\t" \ + cs_init \ "syscall\n\t" \ ".set\treorder" \ : "=r" (__v0), "+r" (__a3) \ - : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \ - "r" (__a4), "r" (__a5) \ + : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \ + "r" (__a5) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h new file mode 100644 index 0000000..e184c91 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h @@ -0,0 +1,183 @@ +/* Copyright (C) 2003, 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 + 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. */ + +#include +#include +#include +#ifndef __ASSEMBLER__ +# include +#endif +#include + +/* Gas will put the initial save of $gp into the CIE, because it appears to + happen before any instructions. So we use cfi_same_value instead of + cfi_restore. */ + +#ifdef HAVE_ASM_CFI_DIRECTIVES +# define cfi_same_value .cfi_same_value +#else +# define cfi_same_value +#endif + +#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt + +#ifdef __PIC__ +# undef PSEUDO +# define PSEUDO(name, syscall_name, args) \ + .align 2; \ + L(pseudo_start): \ + cfi_startproc; \ + cfi_adjust_cfa_offset (STKSPACE); \ + cfi_rel_offset (gp, STKOFF_GP); \ + 99: PTR_LA t9,__syscall_error; \ + /* manual cpreturn */ \ + REG_L gp, STKOFF_GP(sp); \ + cfi_same_value (gp); \ + RESTORESTK; \ + jr t9; \ + .type __##syscall_name##_nocancel, @function; \ + .globl __##syscall_name##_nocancel; \ + __##syscall_name##_nocancel: \ + SAVESTK; \ + .cpsetup t9, STKOFF_GP, name; \ + cfi_rel_offset (gp, STKOFF_GP); \ + li v0, SYS_ify(syscall_name); \ + syscall; \ + bne a3, zero, SYSCALL_ERROR_LABEL; \ + /* manual cpreturn */ \ + REG_L gp, STKOFF_GP(sp); \ + cfi_same_value (gp); \ + RESTORESTK; \ + ret; \ + .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \ + ENTRY (name) \ + SAVESTK; \ + .cpsetup t9, STKOFF_GP, name; \ + cfi_rel_offset (gp, STKOFF_GP); \ + SINGLE_THREAD_P(v1); \ + bne zero, v1, L(pseudo_cancel); \ + .set noreorder; \ + li v0, SYS_ify(syscall_name); \ + syscall; \ + .set reorder; \ + bne a3, zero, SYSCALL_ERROR_LABEL; \ + /* manual cpreturn */ \ + REG_L gp, STKOFF_GP(sp); \ + cfi_same_value (gp); \ + RESTORESTK; \ + ret; \ + L(pseudo_cancel): \ + cfi_adjust_cfa_offset (STKSPACE); \ + cfi_rel_offset (gp, STKOFF_GP); \ + REG_S ra, STKOFF_RA(sp); \ + cfi_rel_offset (ra, STKOFF_RA); \ + PUSHARGS_##args; /* save syscall args */ \ + CENABLE; \ + REG_S v0, STKOFF_SVMSK(sp); /* save mask */ \ + POPARGS_##args; /* restore syscall args */ \ + .set noreorder; \ + li v0, SYS_ify (syscall_name); \ + syscall; \ + .set reorder; \ + REG_S v0, STKOFF_SC_V0(sp); /* save syscall result */ \ + REG_S a3, STKOFF_SC_ERR(sp); /* save syscall error flag */ \ + REG_L a0, STKOFF_SVMSK(sp); /* pass mask as arg1 */ \ + CDISABLE; \ + REG_L a3, STKOFF_SC_ERR(sp); /* restore syscall error flag */ \ + REG_L ra, STKOFF_RA(sp); /* restore return address */ \ + REG_L v0, STKOFF_SC_V0(sp); /* restore syscall result */ \ + bne a3, zero, SYSCALL_ERROR_LABEL; \ + /* manual cpreturn */ \ + REG_L gp, STKOFF_GP(sp); \ + cfi_same_value (gp); \ + RESTORESTK; \ + L(pseudo_end): + + +# undef PSEUDO_END +# define PSEUDO_END(sym) cfi_endproc; .end sym; .size sym,.-sym + +#endif + +# define PUSHARGS_0 /* nothing to do */ +# define PUSHARGS_1 PUSHARGS_0 REG_S a0, STKOFF_A0(sp); cfi_rel_offset (a0, STKOFF_A0); +# define PUSHARGS_2 PUSHARGS_1 REG_S a1, STKOFF_A1(sp); cfi_rel_offset (a1, STKOFF_A1); +# define PUSHARGS_3 PUSHARGS_2 REG_S a2, STKOFF_A2(sp); cfi_rel_offset (a2, STKOFF_A2); +# define PUSHARGS_4 PUSHARGS_3 REG_S a3, STKOFF_A3(sp); cfi_rel_offset (a3, STKOFF_A3); +# define PUSHARGS_5 PUSHARGS_4 REG_S a4, STKOFF_A4(sp); cfi_rel_offset (a3, STKOFF_A4); +# define PUSHARGS_6 PUSHARGS_5 REG_S a5, STKOFF_A5(sp); cfi_rel_offset (a3, STKOFF_A5); + +# define POPARGS_0 /* nothing to do */ +# define POPARGS_1 POPARGS_0 REG_L a0, STKOFF_A0(sp); +# define POPARGS_2 POPARGS_1 REG_L a1, STKOFF_A1(sp); +# define POPARGS_3 POPARGS_2 REG_L a2, STKOFF_A2(sp); +# define POPARGS_4 POPARGS_3 REG_L a3, STKOFF_A3(sp); +# define POPARGS_5 POPARGS_4 REG_L a4, STKOFF_A4(sp); +# define POPARGS_6 POPARGS_5 REG_L a5, STKOFF_A5(sp); + +/* Save an even number of slots. Should be 0 if an even number of slots + are used below, or SZREG if an odd number are used. */ +# define STK_PAD SZREG + +/* Place values that we are more likely to use later in this sequence, i.e. + closer to the SP at function entry. If you do that, the are more + likely to already be in your d-cache. */ +# define STKOFF_A5 (STK_PAD) +# define STKOFF_A4 (STKOFF_A5 + SZREG) +# define STKOFF_A3 (STKOFF_A4 + SZREG) +# define STKOFF_A2 (STKOFF_A3 + SZREG) /* MT and more args. */ +# define STKOFF_A1 (STKOFF_A2 + SZREG) /* MT and 2 args. */ +# define STKOFF_A0 (STKOFF_A1 + SZREG) /* MT and 1 arg. */ +# define STKOFF_RA (STKOFF_A0 + SZREG) /* Used if MT. */ +# define STKOFF_SC_V0 (STKOFF_RA + SZREG) /* Used if MT. */ +# define STKOFF_SC_ERR (STKOFF_SC_V0 + SZREG) /* Used if MT. */ +# define STKOFF_SVMSK (STKOFF_SC_ERR + SZREG) /* Used if MT. */ +# define STKOFF_GP (STKOFF_SVMSK + SZREG) /* Always used. */ + +# define STKSPACE (STKOFF_GP + SZREG) +# define SAVESTK PTR_SUBU sp, STKSPACE; cfi_adjust_cfa_offset(STKSPACE) +# define RESTORESTK PTR_ADDU sp, STKSPACE; cfi_adjust_cfa_offset(-STKSPACE) + +# ifdef IS_IN_libpthread +# define CENABLE PTR_LA t9, __pthread_enable_asynccancel; jalr t9 +# define CDISABLE PTR_LA t9, __pthread_disable_asynccancel; jalr t9 +# elif defined IS_IN_librt +# define CENABLE PTR_LA t9, __librt_enable_asynccancel; jalr t9 +# define CDISABLE PTR_LA t9, __librt_disable_asynccancel; jalr t9 +# else +# define CENABLE PTR_LA t9, __libc_enable_asynccancel; jalr t9 +# define CDISABLE PTR_LA t9, __libc_disable_asynccancel; jalr t9 +# endif + +# ifndef __ASSEMBLER__ +# define SINGLE_THREAD_P \ + __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ + header.multiple_threads) \ + == 0, 1) +# else +# define SINGLE_THREAD_P(reg) \ + READ_THREAD_POINTER(reg); \ + lw reg, MULTIPLE_THREADS_OFFSET(reg) +#endif + +#elif !defined __ASSEMBLER__ + +# define SINGLE_THREAD_P 1 +# define NO_CANCELLATION 1 + +#endif diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list index b0d79ff..0d1657d 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list +++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list @@ -1,16 +1,12 @@ # File name Caller Syscall name Args Strong name Weak names -lseek - lseek i:iii __libc_lseek __lseek lseek __llseek llseek __libc_lseek64 __lseek64 lseek64 - -# proper socket implementations: -recvfrom - recvfrom i:ibniBN __libc_recvfrom __recvfrom recvfrom -sendto - sendto i:ibnibn __libc_sendto __sendto sendto +lseek - lseek Ci:iii __libc_lseek __lseek lseek __llseek llseek __libc_lseek64 __lseek64 lseek64 # semaphore and shm system calls msgctl - msgctl i:iip __msgctl msgctl msgget - msgget i:ii __msgget msgget -msgrcv - msgrcv i:ibnii __msgrcv msgrcv -msgsnd - msgsnd i:ibni __msgsnd msgsnd +msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv +msgsnd - msgsnd Ci:ibni __msgsnd msgsnd shmat - shmat i:ipi __shmat shmat shmctl - shmctl i:iip __shmctl shmctl shmdt - shmdt i:s __shmdt shmdt diff --git a/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h b/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h index 7edb287..5e3dd48 100644 --- a/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2003, 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 @@ -39,7 +39,7 @@ INTERNAL_SYSCALL_DECL (__err); \ long int __ret; \ __ret = INTERNAL_SYSCALL (futex, __err, 4, \ - (futexp), FUTEX_WAIT, (val), 0); \ + (long) (futexp), FUTEX_WAIT, (val), 0); \ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ }) @@ -48,7 +48,7 @@ INTERNAL_SYSCALL_DECL (__err); \ long int __ret; \ __ret = INTERNAL_SYSCALL (futex, __err, 4, \ - (futexp), FUTEX_WAIT, (val), (timespec)); \ + (long) (futexp), FUTEX_WAIT, (val), (timespec));\ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ }) @@ -57,7 +57,7 @@ INTERNAL_SYSCALL_DECL (__err); \ long int __ret; \ __ret = INTERNAL_SYSCALL (futex, __err, 4, \ - (futexp), FUTEX_WAKE, (nr), 0); \ + (long) (futexp), FUTEX_WAKE, (nr), 0); \ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ }) @@ -67,7 +67,7 @@ INTERNAL_SYSCALL_DECL (__err); \ long int __ret; \ __ret = INTERNAL_SYSCALL (futex, __err, 6, \ - (futexp), FUTEX_CMP_REQUEUE, (nr_wake), \ + (long) (futexp), FUTEX_CMP_REQUEUE, (nr_wake), \ (nr_move), (mutex), (val)); \ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ }) -- 2.7.4