summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/mips
AgeCommit message (Collapse)Author
2020-05-17mips: Do not include hi and lo in __SYSCALL_CLOBBERS for R6Romain Naour
From [1] "GCC 10 (PR 91233) won't silently allow registers that are not architecturally available to be present in the clobber list anymore, resulting in build failure for mips*r6 targets in form of: ... .../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target 146 | __asm__ volatile ( \ | ^~~~~~~ This is because base R6 ISA doesn't define hi and lo registers w/o DSP extension. This patch provides the alternative definitions of __SYSCALL_CLOBBERS for r6 targets that won't include those registers." [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8 Signed-off-by: Romain Naour <romain.naour@gmail.com> Cc: Waldemar Brodkorb <wbx@openadk.org>
2020-02-03csky: add statx conditionalsWaldemar Brodkorb
Similar to glibc commit https://sourceware.org/git/?p=glibc.git;a=commit;h=6bbfc5c09fc5b5e3d4a0cddbbd4e2e457767dae7 we need to handle Linux kernel change, which removed stat64 family from default syscall set. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de>
2019-10-30Make __syscall_error return long, as expected by syscall() callersCarlos Santos
The return type of syscall() is long so __syscall_error, which is jumped to by syscall handlers to stash an error number into errno, must return long too otherwhise it returs 4294967295L instead of -1L. For example, syscall for x86_64 is defined in libc/sysdeps/linux/x86_64/syscall.S as syscall: movq %rdi, %rax /* Syscall number -> rax. */ movq %rsi, %rdi /* shift arg1 - arg5. */ movq %rdx, %rsi movq %rcx, %rdx movq %r8, %r10 movq %r9, %r8 movq 8(%rsp),%r9 /* arg6 is on the stack. */ syscall /* Do the system call. */ cmpq $-4095, %rax /* Check %rax for error. */ jae __syscall_error /* Branch forward if it failed. */ ret /* Return to caller. */ In libc/sysdeps/linux/x86_64/__syscall_error.c, __syscall_error is defined as int __syscall_error(void) attribute_hidden; int __syscall_error(void) { register int err_no __asm__ ("%rcx"); __asm__ ("mov %rax, %rcx\n\t" "neg %rcx"); __set_errno(err_no); return -1; } So __syscall_error returns -1 as a 32-bit int in a 64-bit register, %rax (0x00000000ffffffff, whose decimal value is decimal 4294967295) and a test like this always returns false: if (syscall(number, ...) == -1) foo(); Fix the error by making __syscall_error return a long, like syscall(). The problem can be circumvented by the caller by coercing the returned value to int before comparing it to -1: if ((int) syscall(number, ...) == -1) foo(); The same problem probably occurs on other 64-bit systems but so far only x86_64 was tested, so this change must be considered experimental. Signed-off-by: Carlos Santos <unixmania@gmail.com>
2018-11-23Defined INLINE_SYSCALL_NOERR_NCS in mips/bits/syscalls.hVolodymyr Boyko
On Linux/MIPS (O32 ABI) for system call we have two result registers - v0 and a3. v0 contains actual syscall result on success or error number on fail, a3 set to 0/1 for indicating syscall success/fail. (if a3 == 1, v0 contains errno). Now as we can see from definition of handle_sys (arch/mips/kernel/scall32-o32.S), handler treats returned by syscall function (let's call "original") values in range [-EMAXERRNO; 0[ as -errno, a3 is set to 1 and final returned (to userspace) value is (-original). INLINE_SYSCALL_NOERR_NCS defined in mips/bits/syscalls.h will handle this behaviour. Signed-off-by: Volodymyr Boyko <boyko.cxx@gmail.com>
2018-02-03bits/mman.h: consolidate header fileWaldemar Brodkorb
Sync with GNU C library and consolidate duplicate non architecture specific defines. MAP_UNINITIALIZED is only defined to 0x4000000 and used by the Linux kernel when CONFIG_MMAP_ALLOW_UNINITIALIZED is enabled. CONFIG_MMAP_ALLOW_UNINITIALIZED is only available for nommu. See Documentation/nommu-mmap.txt.
2017-11-25statfs.h: add f_flagsWaldemar Brodkorb
Add missing member in struct statfs. It is used by xfsprogs (f.e. 4.13.1). Reported-by: Joshua Kinard <kumba@gentoo.org>
2017-11-22remove misleading comment about f_frsize fieldEugene Rudoy
It is supported both in the sense of being contained in mips version of statfs/statfs64 structs and also in the sense that it's filled by the corresponding kernel syscalls. It is UNsupported in that sense that it's value is the same as that of f_bsize (at least on older kernel versions, the oldest version tested is 2.6.13), s. [1] and [2] for details ([1] is the latest kernel version as of now, [2] is the oldest kernel version git history is available for). [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/fs/statfs.c?h=v4.14-rc7#n64 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/fs/open.c?h=v2.6.12-rc2#n41 Follow-up of 68de9946e914d8c30dcc6667a059ea59e5b74cac Signed-off-by: Eugene Rudoy <gene.devel@gmail.com> Signed-off-by: Ralf Friedl <Ralf.Friedl@online.de>
2017-11-03Define _STATFS_F_FRSIZE for MIPSWaldemar Brodkorb
After discussion on the busybox mailinglist. Reported-by: Ralf Friedl <Ralf.Friedl@online.de> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2017-07-28cleanup unused defines and includes from clone.SWaldemar Brodkorb
2017-06-21remove editor hints for viWaldemar Brodkorb
2017-06-08fcntl.h: fixup namespace for O_DIRECTORY/O_NOFOLLOW/O_CLOEXECWaldemar Brodkorb
Sync with GNU C library. Found while trying to compile linux-rdma to uClibc-ng. Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
2017-04-16libm: allow long double wrappers for all architecturesWaldemar Brodkorb
If you enable these wrappers, be sure you don't need long double precision on your embedded device, as these only enables long double warpper functions to the existing double math functions. Required to build some software as lvm2. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2017-02-18remove dead code in dlfcn.hWaldemar Brodkorb
2017-01-28remove PID cachingWaldemar Brodkorb
Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e and remove the PID caching. These simplifies the architecture specific assembly code. The run of the test suite found no regressions, it even solves some of the test failures for x86/x86_64/sparc. Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Vineet Gupta <Vineet.Gupta1@synopsys.com> Acked-by: Matthew Fortune <Matthew.Fortune@imgtec.com> Acked-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
2017-01-28mips: PROF is never defined, kill dead codeWaldemar Brodkorb
2017-01-05mips: sync with GNU libc, fix mips64r6 n32 compilationWaldemar Brodkorb
2016-12-26mips: use the common dirent.hWaldemar Brodkorb
2016-11-27remove UCLIBC_HAS_LFSWaldemar Brodkorb
2016-11-27mips: fix SIGILL problem with mips ISA r6Waldemar Brodkorb
2016-07-31deduplicate jmpbuf-unwind.hWaldemar Brodkorb
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
2016-07-17cleanup PTR_MANGLE/PTR_DEMANGLE supportWaldemar Brodkorb
As this is only implemented for a few architecture and not well tested, just remove it. Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
2016-07-17mips: add regdef.h glibc compatibility headerWaldemar Brodkorb
2016-01-31mips: fix clashing symbolsWaldemar Brodkorb
ISC bind9 uses ptrsize, better use something else. Reported-By: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2015-12-07add definitions for O_PATHWaldemar Brodkorb
Only alpha, hppa and sparc need non-default value.
2015-12-06mips: fix definition.Steve Ellcey
glibc [BZ# 16922] * sysdeps/mips/sys/asm.h (INT_SUB): Fix definition. (LONG_SUB): Ditto. (PTR_SUB): Ditto. glibc commit 5057ad3b50 Signed-off-by: Steve Ellcey <sellcey@mips.com> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2015-12-05remove __UCLIBC_ASM_GLOBAL_DIRECTIVE__Waldemar Brodkorb
.globl can be used for every architecture so remove the define. Sync with GNU C library.
2015-12-05remove __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__Waldemar Brodkorb
It's even no longer required for non-ported ppc64 architecture. Sync with GNU C library. This simplify the macros in include/libc-symbols.h.
2015-10-19mips: sync header with glibcWaldemar Brodkorb
Fixes following compile error, when UCLIBC_HAS_CONTEXT_FUNCS is enabled on a mips64 build: CC libc/sysdeps/linux/common/_exit.os libc/sysdeps/linux/mips/swapcontext.S: Assembler messages: libc/sysdeps/linux/mips/swapcontext.S:110: Error: Illegal operands `s.d fs6,(30*8+296)($4)' libc/sysdeps/linux/mips/swapcontext.S:111: Error: Illegal operands `s.d fs7,(31*8+296)($4)' libc/sysdeps/linux/mips/swapcontext.S:149: Error: Illegal operands `l.d fs6,(30*8+296)($2)' libc/sysdeps/linux/mips/swapcontext.S:150: Error: Illegal operands `l.d fs7,(31*8+296)($2)' Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-08-02fix MIPS N32 ABI Big Endian setjmp/longjmpmirabilos
access to the jmp_buf structure occasionally happens asymmetrically: fields defined in pointer size width (64 on N32) can be accessed as 32-bit words, but in that case, a̲l̲l̲ involved code must agree on that…
2015-06-10siginfo: add signal info for seccomp related SIGSYSDaniel Golle
uClibc doesn't define signal info for the SIGSYS signal which is issued in case of hitting a syscall prohibited by seccomp. This is sad as it makes debugging seccomp filter policies impossible on some architectures (at least ARM and PowerPC, maybe also others) which do not coincidentally set si_value.sival_int as the syscall number. To fix this, import the definitions and macros needed from glibc. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-29merge uClibc git masterWaldemar Brodkorb
2015-03-24mips: switch float_t to floatBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24libc: TIME64_COMPAT32 for sparc, mipsBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-14Add fix from OpenWrt for MIPS64 N64 ABIWaldemar Brodkorb
https://dev.openwrt.org/browser/trunk/toolchain/uClibc/patches-0.9.33.2/616-mips_fix_stat_time.patch When booting in Qemu you get for example failures from mdev -s otherwise.
2014-12-03mips: rename siginfo _timer membersBernhard Reutner-Fischer
Rename _timer[12] to si_tid and si_overrun to fix compilation of strace-4.9+ Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25fcntl.h: Define F_SETPIPE_SZ and F_GETPIPE_SZKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25mathinline.h: Use __extern_inlineBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-01Fix warnings in MIPS buildSteve Ellcey
This patch fixes the rest of the set-but-not-used warnings in the MIPS code by using attribute_unused and also fixes some conversion warnings by changing __arch_compare_and_exchange_xxx_[8|16]_int. Assigning __cmp (int type) to __prev (pointer type) generates a warning. Assigning zero to each separately avoids this warning without having to add a cast. Signed-off-by: Steve Ellcey <sellcey@mips.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-03-12libc: fix mips N64 pread/pwrite buildSteve Ellcey
Uclibc is not building for MIPS N64 because pread is trying to use the pread/pwrite system calls instead of pread64/pwrite64. This patch fixes the problem and was tested with LFS enabled and disabled. Signed-off-by: Steve Ellcey <sellcey@mips.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-15mips: Remove duplicate macro definitionsSteve Ellcey
The INLINE_SYSCALL, INTERNAL_SYSCALL*, and internal_syscall* macros are defined for MIPS in both libc/sysdeps/linux/mips/sysdep.h and libc/sysdeps/linux/mips/bits/syscalls.h. The macros are the same in both cases except that syscalls.h defines internal_syscalls[567] the same for N32 and N64 ABIs and has a different definition for O32. I believe that is correct. The sysdep.h header uses the O32 versions for N32 and has different definitions for N64. I think that is wrong and that N32 and N64 should share the same definition (modulo the type 'long' vs. 'long long' for the arguments. This setup (from sysdep.h) now agrees with what glibc has. I am not positive about which header (sysdep.h vs syscalls.h) is really the right one to have these definitions in but using sysdep.h seems to work for all my builds. Signed-off-by: Steve Ellcey <sellcey@mips.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-02libc: mips: Fix setjmp/longjmp for MIPS64 N64 ABIWaldemar Brodkorb
When booting a Linux system with qemu-system-mips64 the execution of $(pwd) in the ash shell triggers a segmentation fault. Ash uses setjmp/longjmp for exception handling. After looking at the glibc implementation, I found some differences, with this patch tries to resolve. Now the system boots up fine and no segmentation faults occur. The global pointer should be restored and the types for the register values should be wide enough. See: http://www.cygwin.com/ml/libc-alpha/2003-03/msg00363.html Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-02mips: silence 'set but not used' warningsSteve Ellcey
This patch uses 'attribute_unused' to clean up a number of warnings messages that are generated when doing a MIPS build. All of the changes are in MIPS specific files and there are no code changes other then adding the unused attribute where needed. Signed-off-by: Steve Ellcey <sellcey@mips.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-02libc: mips: Fix non-LFS buildSteve Ellcey
The MIPS build is failing when UCLIBC_HAS_LFS is set to "n" because posix_fadvise64.c is included in the build when it should not be. Signed-off-by: Steve Ellcey <sellcey@mips.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-24mips: silence _ABI* undef warningsBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-22libc: fix MIPS N64 forkWaldemar Brodkorb
fork() is broken for MIPS64 N64 ABI. You can check it with a simple C program statically linked with qemu-mips64 user emulation. Internally fork() is using the clone system call (at least with NPTL) with 5 arguments. See ./libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c. The calling conventions for MIPS N32 and N64 allow to use up to 8 registers for that. See http://en.wikipedia.org/wiki/Calling_convention#MIPS This is correctly implemented in libc/sysdeps/linux/mips/bits/syscalls.h, but not in libc/sysdeps/linux/mips/sysdep.h. fork.c uses the later one. It seems that fork() works fine for MIPS64 N32 with just using the stack like with the O32 case. There is a user of INLINE_SYSCALL with 7 arguments in libc/sysdeps/linux/common/sync_file_range.c for MIPS64 N32, so I decided to only use the macros for the MIPS64 N64 case. With this patch my uClibc based Linux system boots up fine in qemu-system-mips64. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08siginfo.h: __SIGEV_PAD_SIZE takes __WORDSIZE into accountVicente Olivert Riera
Make __SIGEV_PAD_SIZE to take __WORDSIZE into account for alpha, mips and ia64 arches. Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08siginfo.h: add a missing function member on ia64, mips and sparc archesVicente Olivert Riera
Add "__pid_t _tid" member which is used for some packages, like rt-test for instance, which fails with an error like this one: src/cyclictest/cyclictest.c:638:9: error: 'union <anonymous>' has no member named '_tid' Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20libc/sysdeps: commonize ret_ERRVALBaruch Siach
* Add a common ret_ERRVAL definition * Remove ret_ERRVAL from architectures using the common 'ret' * Add 'undef' to architectures that need a different return instruction * Add '#include <common/sysdep.h>' to cris and ia64 that were missing it Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-28MIPS: set _NSIG to 128, not 129. This matches glibc.Denys Vlasenko
Prompted by lkml discussion of a MIPS bug where sending signal 128 was found to be able to crash the machine :/ Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-07eventfd.h: Use new "bits/" scheme for arch-specific flagsHiroaki KAWAI
As in timerfd.h, eventfd.h needs arch-specific definition files. alpha, mips and sparc needs separate file, all the other arch will use common definition. This problem is already fixed in glibc. Also sanitize and provide bits for hppa. Make sure not to install the new bits/eventfd unless eventfd support is enabled. Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>