This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Here is another MIPS patch. I didn't check if the MAP_BASE_ADDR change would break the old binaries compiled with the IRIX ABI since all my MIPS binaries are compiled with the SVR4 ABI. H.J. ---- 2001-05-26 H.J. Lu <hjl@gnu.org> * sysdeps/mips/dl-machine.h (MAP_BASE_ADDR): Commented out. * sysdeps/mips/rtld-ldscript.in: Removed. * sysdeps/mips/rtld-parms: Likewise. * sysdeps/mips/mips64/rtld-parms: Likewise. * sysdeps/mips/mipsel/rtld-parms: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Change sigsuspend to s_sigsuspend. Add s_mmap2. * sysdeps/mips/atomicity.h: New file. * sysdeps/unix/sysv/linux/mips/getsysstats.c: New file. Index: sysdeps/mips/dl-machine.h =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/dl-machine.h,v retrieving revision 1.1.1.11 diff -u -p -r1.1.1.11 dl-machine.h --- sysdeps/mips/dl-machine.h 2001/02/22 22:21:42 1.1.1.11 +++ sysdeps/mips/dl-machine.h 2001/05/27 07:38:00 @@ -61,6 +61,10 @@ in l_info array. */ #define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM) +#if 0 +/* We no longer do that since we switched to the SVR4 MIP ABI in + binutils. */ + /* * MIPS libraries are usually linked to a non-zero base address. We * subtract the base address from the address where we map the object @@ -76,6 +80,7 @@ (l)->l_info[DT_MIPS(BASE_ADDRESS)]->d_un.d_ptr : 0) #else #define MAP_BASE_ADDR(l) 0x5ffe0000 +#endif #endif /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in Index: sysdeps/mips/rtld-ldscript.in =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/rtld-ldscript.in,v retrieving revision 1.1.1.2 diff -u -p -r1.1.1.2 rtld-ldscript.in --- sysdeps/mips/rtld-ldscript.in 2001/05/27 06:52:15 1.1.1.2 +++ sysdeps/mips/rtld-ldscript.in 2001/05/27 07:38:00 @@ -1,105 +0,0 @@ -OUTPUT_ARCH(@@rtld-arch@@) -ENTRY(@@rtld-entry@@) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = @@rtld-base@@; - .reginfo : { *(.reginfo) } - .dynamic : { *(.dynamic) } - .dynstr : { *(.dynstr) } - .dynsym : { *(.dynsym) } - .hash : { *(.hash) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .rodata : { *(.rodata) } - .rodata1 : { *(.rodata1) } - .init : { *(.init) } =0 - .text : - { - *(.text) - *(.stub) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - } =0 - .fini : { *(.fini) } =0 - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. It would - be more correct to do this: - . = 0x10000000; - The current expression does not correctly handle the case of a - text segment ending precisely at the end of a page; it causes the - data segment to skip a page. The above expression does not have - this problem, but it will currently (2/95) cause BFD to allocate - a single segment, combining both text and data, for this case. - This will prevent the text segment from being shared among - multiple executions of the program; I think that is more - important than losing a page of the virtual address space (note - that no actual memory is lost; the page which is skipped can not - be referenced). */ - . += 0x10000; - .data : - { - *(.data) - CONSTRUCTORS - } - .data1 : { *(.data1) } - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - _gp = ALIGN(16) + 0x7ff0; - .got : - { - *(.got.plt) *(.got) - } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - .sbss : { *(.sbss) *(.scommon) } - .bss : - { - *(.dynbss) - *(.bss) - *(COMMON) - } - /* The normal linker scripts created by the binutils doesn't have the - symbols end and _end which breaks ld.so's dl-minimal.c. */ - _end = . ; - PROVIDE (end = .); - /* These are needed for ELF backends which have not yet been - converted to the new style linker. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - /* DWARF debug sections. - Symbols in the .debug DWARF section are relative to the beginning of the - section so we begin .debug at 0. It's not clear yet what needs to happen - for the others. */ - .debug 0 : { *(.debug) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } - /* These must appear regardless of . */ - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -} Index: sysdeps/mips/rtld-parms =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/rtld-parms,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 rtld-parms --- sysdeps/mips/rtld-parms 2000/05/21 21:11:43 1.1.1.1 +++ sysdeps/mips/rtld-parms 2001/05/27 07:38:00 @@ -1,15 +0,0 @@ -ifndef rtld-wordsize -rtld-wordsize = 32 -endif -ifndef rtld-oformat -rtld-oformat = elf$(rtld-wordsize)-bigmips -endif -ifndef rtld-arch -rtld-arch = mips -endif -ifndef rtld-entry -rtld-entry = __start -endif -ifndef rtld-base -rtld-base = 0x0fb60000 + SIZEOF_HEADERS -endif Index: sysdeps/mips/mips64/rtld-parms =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/mips64/rtld-parms,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 rtld-parms --- sysdeps/mips/mips64/rtld-parms 2000/05/21 21:11:43 1.1.1.1 +++ sysdeps/mips/mips64/rtld-parms 2001/05/27 07:38:00 @@ -1,3 +0,0 @@ -ifndef rtld-wordsize -rtld-wordsize = 64 -endif Index: sysdeps/mips/mipsel/rtld-parms =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/mipsel/rtld-parms,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 rtld-parms --- sysdeps/mips/mipsel/rtld-parms 2000/05/21 21:11:43 1.1.1.1 +++ sysdeps/mips/mipsel/rtld-parms 2001/05/27 07:38:00 @@ -1,3 +0,0 @@ -ifndef rtld-oformat -rtld-oformat = elf32-littlemips -endif Index: sysdeps/unix/sysv/linux/mips/syscalls.list =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/mips/syscalls.list,v retrieving revision 1.1.1.7 diff -u -p -r1.1.1.7 syscalls.list --- sysdeps/unix/sysv/linux/mips/syscalls.list 2001/01/21 01:11:42 1.1.1.7 +++ sysdeps/unix/sysv/linux/mips/syscalls.list 2001/05/27 07:38:00 @@ -8,7 +8,7 @@ cachectl - cachectl i:pii __cachectl cac cacheflush - cacheflush i:pii _flush_cache cacheflush sysmips - sysmips i:iiii __sysmips sysmips -sigsuspend - sigsuspend i:p __sigsuspend sigsuspend +s_sigsuspend sigsuspend sigsuspend i:p __syscall_sigsuspend # # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper; @@ -61,6 +61,7 @@ getresgid - getresgid i:ppp getresgid getresuid - getresuid i:ppp getresuid s_ipc msgget ipc i:iiiip __syscall_ipc s_lstat64 lxstat64 lstat64 i:sp __syscall_lstat64 +s_mmap2 mmap64 mmap2 b:aniiii __syscall_mmap2 s_poll poll poll i:pii __syscall_poll s_pread64 pread64 pread i:ibniii __syscall_pread s_putpmsg putpmsg putpmsg i:ippii __syscall_putpmsg --- /dev/null Fri Mar 23 20:37:44 2001 +++ sysdeps/mips/atomicity.h Sun May 27 00:38:00 2001 @@ -0,0 +1,128 @@ +/* Low-level functions for atomic operations. Mips version. + + Copyright (C) 2001 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _MIPS_ATOMICITY_H +#define _MIPS_ATOMICITY_H 1 + +#include <sgidefs.h> +#include <inttypes.h> + +#if (_MIPS_ISA >= _MIPS_ISA_MIPS2) + +static inline int +__attribute__ ((unused)) +exchange_and_add (volatile uint32_t *mem, int val) +{ + int result, tmp; + + __asm__ __volatile__ + ("/* Inline exchange & add */\n\t" + "1:\n\t" + "ll %0,%3\n\t" + "addu %1,%4,%0\n\t" + "sc %1,%2\n\t" + "beqz %1,1b\n\t" + "/* End exchange & add */" + : "=&r"(result), "=&r"(tmp), "=m"(*mem) + : "m" (*mem), "r"(val) + : "memory"); + + return result; +} + +static inline void +__attribute__ ((unused)) +atomic_add (volatile uint32_t *mem, int val) +{ + int result; + + __asm__ __volatile__ + ("/* Inline atomic add */\n\t" + "1:\n\t" + "ll %0,%2\n\t" + "addu %0,%3,%0\n\t" + "sc %0,%1\n\t" + "beqz %0,1b\n\t" + "/* End atomic add */" + : "=&r"(result), "=m"(*mem) + : "m" (*mem), "r"(val) + : "memory"); +} + +static inline int +__attribute__ ((unused)) +compare_and_swap (volatile long int *p, long int oldval, long int newval) +{ + long int ret; + + __asm__ __volatile__ + ("/* Inline compare & swap */\n\t" + "1:\n\t" + "ll %0,%4\n\t" + ".set push\n" + ".set noreorder\n\t" + "bne %0,%2,2f\n\t" + "move %0,%3\n\t" + ".set pop\n\t" + "sc %0,%1\n\t" + "beqz %0,1b\n" + "2:\n\t" + "/* End compare & swap */" + : "=&r" (ret), "=m" (*p) + : "r" (oldval), "r" (newval), "m" (*p) + : "memory"); + + return ret; +} + +#else /* (_MIPS_ISA >= _MIPS_ISA_MIPS2) */ + +#warning MIPS I atomicity functions are not atomic + +static inline int +__attribute__ ((unused)) +exchange_and_add (volatile uint32_t *mem, int val) +{ + int result = *mem; + *mem += val; + return result; +} + +static inline void +__attribute__ ((unused)) +atomic_add (volatile uint32_t *mem, int val) +{ + *mem += val; +} + +static inline int +__attribute__ ((unused)) +compare_and_swap (volatile long int *p, long int oldval, long int newval) +{ + if (*p != oldval) + return 0; + + *p = newval; + return 1; +} + +#endif /* !(_MIPS_ISA >= _MIPS_ISA_MIPS2) */ + +#endif /* atomicity.h */ --- /dev/null Fri Mar 23 20:37:44 2001 +++ sysdeps/unix/sysv/linux/mips/getsysstats.c Sun May 27 00:38:00 2001 @@ -0,0 +1,36 @@ +/* Determine various system internal values, Linux/MIPS version. + Copyright (C) 2001 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + +/* We need to define a special parser for /proc/cpuinfo. */ +#define GET_NPROCS_PARSER(FP, BUFFER, RESULT) \ + do \ + { \ + (RESULT) = 0; \ + /* Read all lines and count the lines starting with the string \ + "cpu model". We don't have to fear extremely long lines since \ + the kernel will not generate them. 8192 bytes are really \ + enough. */ \ + while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL) \ + if (strncmp (BUFFER, "cpu model", 9) == 0) \ + ++(RESULT); \ + } \ + while (0) + +#include <sysdeps/unix/sysv/linux/getsysstats.c>
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |