1. 11 4月, 2019 4 次提交
    • R
      implement inline 5- and 6-argument syscalls for mips · dcb18bea
      Rich Felker 提交于
      the OABI passes these on the stack, using the convention that their
      position on the stack is as if the first four arguments (in registers)
      also had stack slots. originally this was deemed too awkward to do
      inline, falling back to external __syscall, but it's not that bad and
      now that external __syscall is being removed, it's necessary.
      dcb18bea
    • R
      use inline syscalls for powerpc (32-bit) · 6aeb9c67
      Rich Felker 提交于
      the inline syscall code is copied directly from powerpc64. the extent
      of register clobber specifiers may be excessive on both; if that turns
      out to be the case it can be fixed later.
      6aeb9c67
    • R
      remove cruft for supposedly-buggy clang from or1k & microblaze syscall_arch · f76d51a1
      Rich Felker 提交于
      it was never demonstrated to me that this workaround was needed, and
      seems likely that, if there ever was any clang version for which it
      was needed, it's old enough to be unusably buggy in other ways. if it
      turns out some compilers actually can't do the register allocation
      right, we'll need to replace this with inline shuffling code, since
      the external __syscall dependency is being removed.
      f76d51a1
    • R
      overhaul i386 syscall mechanism not to depend on external asm source · 22e5bbd0
      Rich Felker 提交于
      this is the first part of a series of patches intended to make
      __syscall fully self-contained in the object file produced using
      syscall.h, which will make it possible for crt1 code to perform
      syscalls.
      
      the (confusingly named) i386 __vsyscall mechanism, which this commit
      removes, was introduced before the presence of a valid thread pointer
      was mandatory; back then the thread pointer was setup lazily only if
      threads were used. the intent was to be able to perform syscalls using
      the kernel's fast entry point in the VDSO, which can use the sysenter
      (Intel) or syscall (AMD) instruction instead of int $128, but without
      inlining an access to the __syscall global at the point of each
      syscall, which would incur a significant size cost from PIC setup
      everywhere. the mechanism also shuffled registers/calling convention
      around to avoid spills of call-saved registers, and to avoid
      allocating ebx or ebp via asm constraints, since there are plenty of
      broken-but-supported compiler versions which are incapable of
      allocating ebx with -fPIC or ebp with -fno-omit-frame-pointer.
      
      the new mechanism preserves the properties of avoiding spills and
      avoiding allocation of ebx/ebp in constraints, but does it inline,
      using some fairly simple register shuffling, and uses a field of the
      thread structure rather than global data for the vdso-provided syscall
      code address.
      
      for now, the external __syscall function is refactored not to use the
      old __vsyscall so it can be kept, but the intent is to remove it too.
      22e5bbd0
  2. 14 3月, 2019 7 次提交
  3. 13 3月, 2019 1 次提交
    • J
      fix POSIX_FADV_DONTNEED/_NOREUSE on s390x · 4b125dd4
      Jonathan Neuschäfer 提交于
      On s390x, POSIX_FADV_DONTNEED and POSIX_FADV_NOREUSE have different
      values than on all other architectures that Linux supports.
      
      Handle this difference by wrapping their definitions in
      include/fcntl.h in #ifdef, so that arch/s390x/bits/fcntl.h can
      override them.
      4b125dd4
  4. 08 2月, 2019 1 次提交
  5. 10 12月, 2018 1 次提交
  6. 17 10月, 2018 2 次提交
  7. 02 10月, 2018 1 次提交
    • R
      add TLSDESC support for 32-bit arm · 0beb9dfb
      Rich Felker 提交于
      unlike other asm where the baseline ISA is used, these functions are
      hot paths and use ISA-level specializations.
      
      call-clobbered vfp registers are saved before calling __tls_get_new,
      since there is no guarantee it won't use them. while setjmp/longjmp
      have to use hwcap to decide whether to the fpu is in use, since
      application code could be using vfp registers even if libc was
      compiled as pure softfloat, __tls_get_new is part of libc and can be
      assumed not to have access to vfp registers if tlsdesc.S does not.
      thus it suffices just to check the predefined preprocessor macros. the
      check for __ARM_PCS_VFP is redundant; !__SOFTFP__ must always be true
      if the target ISA level includes fpu instructions/registers.
      0beb9dfb
  8. 21 9月, 2018 1 次提交
  9. 14 9月, 2018 1 次提交
    • R
      fix broken atomic store on powerpc[64] · 12817793
      Rich Felker 提交于
      in our memory model, all atomics are supposed to be full barriers;
      stores are not release-only. this is important because store is used
      as an unlock operation in places where it needs to acquire the waiter
      count to determine if a futex wake is needed. at least in the
      malloc-internal locks, but possibly elsewhere, soft deadlocks from
      missing futex wake (breakable by poking the threads to restart the
      syscall, e.g. by attaching a tracer) were reported to occur.
      
      once the malloc lock is replaced with Jens Gustedt's new lock
      implementation (see commit 47d0bcd4),
      malloc will not be affected by the issue, but it's not clear that
      other uses won't be. reducing the strength of the ordering properties
      required from a_store would require a thorough analysis of how it's
      used.
      
      to fix the problem, I'm removing the powerpc[64]-specific a_store
      definition; now, the top-level atomic.h will implement a_store using
      a_barrier on both sides of the store.
      
      it's not clear to me yet whether there might be issues with the other
      atomics. it's possible that a_post_llsc needs to be replaced with a
      full barrier to guarantee the formal semanics we want, but either way
      I think the difference is unlikely to impact the way we use them.
      12817793
  10. 13 9月, 2018 1 次提交
    • R
      apply hidden visibility to sigreturn code fragments · b6e59cd9
      Rich Felker 提交于
      these were overlooked in the declarations overhaul work because they
      are not properly declared, and the current framework even allows their
      declared types to vary by arch. at some point this should be cleaned
      up, but I'm not sure what the right way would be.
      b6e59cd9
  11. 06 9月, 2018 1 次提交
    • R
      define and use internal macros for hidden visibility, weak refs · 9b95fd09
      Rich Felker 提交于
      this cleans up what had become widespread direct inline use of "GNU C"
      style attributes directly in the source, and lowers the barrier to
      increased use of hidden visibility, which will be useful to recovering
      some of the efficiency lost when the protected visibility hack was
      dropped in commit dc2f368e, especially
      on archs where the PLT ABI is costly.
      9b95fd09
  12. 30 8月, 2018 1 次提交
    • R
      fix async thread cancellation on sh-fdpic · 35cd7c09
      Rich Felker 提交于
      if __cp_cancel was reached via __syscall_cp, r12 will necessarily
      still contain a GOT pointer (for libc.so or for the static-linked main
      program) valid for entering __cancel. however, in the case of async
      cancellation, r12 may contain any scratch value; it's not necessarily
      even a valid GOT pointer for the code that was interrupted.
      
      unlike in commit 0ec49dab where the
      corresponding issue was fixed for powerpc64, there is fundamentally no
      way for fdpic code to recompute its GOT pointer. so a new mechanism is
      introduced for cancel_handler to write a GOT register value into the
      interrupted context on archs where it is needed.
      35cd7c09
  13. 20 7月, 2018 1 次提交
    • M
      move inclusion of linux headers for kd.h, soundcard.h, vt.h to bits · f2c6dbe2
      midipix 提交于
      maintainer's note: while musl does not use the linux kernel headers,
      it does provide these three sys/* headers which do nothing but include
      the corresponding linux/* headers, since the sys/* versions are the
      ones documented for application use (and they arguably provide
      interfaces that are not linux-specific but common to other unices).
      these headers should probably not be provided by libc (rather by a
      separate package), but as long as they are, use the bits header
      framework as an aid to out-of-tree ports of musl for non-linux systems
      that want to implement them in some other way.
      f2c6dbe2
  14. 18 7月, 2018 1 次提交
    • S
      add support for arch-specific ptrace command macros · df6d9450
      Szabolcs Nagy 提交于
      sys/ptrace.h is target specific, use bits/ptrace.h to add target
      specific macro definitions.
      
      these macros are kept in the generic sys/ptrace.h even though some
      targets don't support them:
      
      PTRACE_GETREGS
      PTRACE_SETREGS
      PTRACE_GETFPREGS
      PTRACE_SETFPREGS
      PTRACE_GETFPXREGS
      PTRACE_SETFPXREGS
      
      so no macro definition got removed in this patch on any target. only
      s390x has a numerically conflicting macro definition (PTRACE_SINGLEBLOCK).
      
      the PT_ aliases follow glibc headers, otherwise the definitions come
      from linux uapi headers except ones that are skipped in glibc and
      there is no real kernel support (s390x PTRACE_*_AREA) or need special
      type definitions (mips PTRACE_*_WATCH_*) or only relevant for linux
      2.4 compatibility (PTRACE_OLDSETOPTIONS).
      df6d9450
  15. 27 6月, 2018 3 次提交
  16. 21 6月, 2018 1 次提交
  17. 20 6月, 2018 7 次提交
    • R
      work around broken kernel struct ipc_perm on some big endian archs · 0cd2be23
      Rich Felker 提交于
      the mode member of struct ipc_perm is specified by POSIX to have type
      mode_t, which is uniformly defined as unsigned int. however, Linux
      defines it with type __kernel_mode_t, and defines __kernel_mode_t as
      unsigned short on some archs. since there is a subsequent padding
      field, treating it as a 32-bit unsigned int works on little endian
      archs, but the order is backwards on big endian archs with the
      erroneous definition.
      
      since multiple archs are affected, remedy the situation with fixup
      code in the affected functions (shmctl, semctl, and msgctl) rather
      than repeating the same shims in syscall_arch.h for every affected
      arch.
      0cd2be23
    • S
      s390x: add kexec_file_load syscall number from linux v4.17 · 7ea235b1
      Szabolcs Nagy 提交于
      new in linux commit 71406883fd35794d573b3085433c41d0a3bf6c21
      7ea235b1
    • S
      mips: add HWCAP_ flags from linux v4.17 · 1177f61d
      Szabolcs Nagy 提交于
      new in linux commit 256211f2b0b251e532d1899b115e374feb16fa7a
      1177f61d
    • S
      aarch64: add HWCAP_ flags from linux v4.17 · f3b6690a
      Szabolcs Nagy 提交于
      hwcaps for armv8.4, new in linux commit
      7206dc93a58fb76421c4411eefa3c003337bcb2d
      f3b6690a
    • S
      powerpc: add pkey syscall numbers from linux v4.16 · 90ac71d8
      Szabolcs Nagy 提交于
      add pkey_mprotect, pkey_alloc, pkey_free syscall numbers,
      new in linux commits 3350eb2ea127978319ced883523d828046af4045
      and 9499ec1b5e82321829e1c1510bcc37edc20b6f38
      90ac71d8
    • S
      aarch64: add HWCAP_ASIMDFHM from linux v4.16 · a697a1c9
      Szabolcs Nagy 提交于
      armv8.4 fp mul instructions.
      added in commit 3b3b681097fae73b7f5dcdd42db6cfdf32943d4c
      a697a1c9
    • R
      add m68k port · f81e44a0
      Rich Felker 提交于
      three ABIs are supported: the default with 68881 80-bit fpu format and
      results returned in floating point registers, softfloat-only with the
      same format, and coldfire fpu with IEEE single/double only. only the
      first is tested at all, and only under qemu which has fpu emulation
      bugs.
      
      basic functionality smoke tests have been performed for the most
      common arch-specific breakage via libc-test and qemu user-level
      emulation. some sysvipc failures remain, but are shared with other big
      endian archs and will be fixed separately.
      f81e44a0
  18. 03 6月, 2018 1 次提交
    • S
      fix TLS layout of TLS variant I when there is a gap above TP · 610c5a85
      Szabolcs Nagy 提交于
      In TLS variant I the TLS is above TP (or above a fixed offset from TP)
      but on some targets there is a reserved gap above TP before TLS starts.
      
      This matters for the local-exec tls access model when the offsets of
      TLS variables from the TP are hard coded by the linker into the
      executable, so the libc must compute these offsets the same way as the
      linker.  The tls offset of the main module has to be
      
      	alignup(GAP_ABOVE_TP, main_tls_align).
      
      If there is no TLS in the main module then the gap can be ignored
      since musl does not use it and the tls access models of shared
      libraries are not affected.
      
      The previous setup only worked if (tls_align & -GAP_ABOVE_TP) == 0
      (i.e. TLS did not require large alignment) because the gap was
      treated as a fixed offset from TP.  Now the TP points at the end
      of the pthread struct (which is aligned) and there is a gap above
      it (which may also need alignment).
      
      The fix required changing TP_ADJ and __pthread_self on affected
      targets (aarch64, arm and sh) and in the tlsdesc asm the offset to
      access the dtv changed too.
      610c5a85
  19. 02 5月, 2018 1 次提交
    • R
      work around arm gcc's rejection of r7 asm constraints in thumb mode · e3c682ab
      Rich Felker 提交于
      in thumb mode, r7 is the ABI frame pointer register, and unless frame
      pointer is disabled, gcc insists on treating it as a fixed register,
      refusing to spill it to satisfy constraints. unfortunately, r7 is also
      used in the syscall ABI for passing the syscall number.
      
      up til now we just treated this as a requirement to disable frame
      pointer when generating code as thumb, but it turns out gcc forcibly
      enables frame pointer, and the fixed register constraint that goes
      with it, for functions which contain VLAs. this produces an
      unacceptable arch-specific constraint that (non-arm-specific) source
      files making syscalls cannot use VLAs.
      
      as a workaround, avoid r7 register constraints when producing thumb
      code and instead save/restore r7 in a temp register as part of the asm
      block. at some point we may want/need to support armv6-m/thumb1, so
      the asm has been tweaked to be thumb1-compatible while also
      near-optimal for thumb2: it allows the temp and/or syscall number to
      be in high registers (necessary since r0-r5 may all be used for
      syscalll args) and in thumb2 mode allows the syscall number to be an
      8-bit immediate.
      e3c682ab
  20. 20 4月, 2018 3 次提交