1. 28 Apr, 2019 5 commits
  2. 15 Apr, 2019 1 commit
  3. 12 Apr, 2019 1 commit
  4. 11 Apr, 2019 1 commit
  5. 09 Apr, 2019 1 commit
  6. 06 Apr, 2019 1 commit
  7. 05 Apr, 2019 13 commits
    • Bobby Bingham's avatar
      ppc32/64: rewrite get/set/swapcontext in assembly · 2610c7fa
      Bobby Bingham authored
      getcontext cannot be correctly implemented in C.
      
      If this calls another function, as it does to call syscall, it needs to
      first spill its return address to the stack.  If, after getcontext returns,
      its caller then calls other functions, this saved return address can be
      clobbered.  When the context saved by getcontext is later restored, the
      (now clobbered) return address will be reloaded from the stack, and the
      second return from getcontext will return to the wrong location.
      
      Because the powerpc swapcontext syscall allows either the old context or
      new context pointers to be null, it is usable for implementing all of
      get/set/swapcontext.
      
      We therefore rewrite swapcontext in assembly, and get/setcontext as simple
      assembly function wrappers around swapcontext.
      
      The one piece we keep in C is the code to check the return value of the
      system call and to set errno.  This code was actually unnecessary before --
      libc does this within syscall.  However, now that the system call is made
      directly in assembly, bypassing libc, it is truly necessary.  Because errno
      is thread-local and the details of how to set it can vary by libc, this
      code remains written in C.
      2610c7fa
    • Bobby Bingham's avatar
      ppc32/64: update copyright · 90ff6330
      Bobby Bingham authored
      90ff6330
    • Bobby Bingham's avatar
      ppc32/64: remove unused includes · 29eac425
      Bobby Bingham authored
      29eac425
    • Bobby Bingham's avatar
      ppc64: remove unnecessary parentheses · edf69879
      Bobby Bingham authored
      edf69879
    • Bobby Bingham's avatar
      ppc32/64: correct signature of function parameter to makecontext · 40d07758
      Bobby Bingham authored
      Because makecontext can pass a set of integer arguments to the provided
      function, it is incorrect to require that this function accept no
      parameters.
      40d07758
    • Bobby Bingham's avatar
      ppc64: fix incorrect position of parameters within stack frame · a00a05ce
      Bobby Bingham authored
      On PPC64, there are 4 register-sized stack slots below the parameter save
      area, which is different from the 2 stack slots on PPC32.
      a00a05ce
    • Bobby Bingham's avatar
      ppc64: fix makecontext with more than 8 parameters · 8ea5f548
      Bobby Bingham authored
      The ELFv2 ABI used on PPC64 differs from the ELFv1 ABI used on PPC32 here.
      On PPC64, once there are any parameters that need to be passed on the
      stack, space needs to be reserved on the stack to pass all parameters.
      Parameters 0-7 are still only passed by register, but if the callee needs
      to spill them, it can use the stack space reserved for the corresponding
      parameter to do so.
      8ea5f548
    • Bobby Bingham's avatar
      ppc32/64: simplify storage of stack parameters · 55168fcb
      Bobby Bingham authored
      The switch statement is simpler as an if/else, and removing the argp
      variable makes the code more symmetric between the register and stack
      parameter cases.
      55168fcb
    • Bobby Bingham's avatar
      ppc32/64: don't store uc_link on the stack · b500b054
      Bobby Bingham authored
      This was previously stored either in the CR (ppc64) or LR (ppc32) save
      area of the stack, or to one of the parameter save slots.
      
      In either case, the saved value was unused.  This value is also passed
      to __start_context via r31, so there's no need to pass it on the stack.
      b500b054
    • Bobby Bingham's avatar
      ppc32/64: fix back chain pointer · b9bd4045
      Bobby Bingham authored
      The ABI states that sp[0] should point to the previous stack frame, or be
      zero if there is no previous stack frame.  makecontext previously set this
      slot to point to the __start_context function, rather than to a valid
      stack frame.
      b9bd4045
    • Bobby Bingham's avatar
      ppc32: fix stack alignment · b6a9b5e2
      Bobby Bingham authored
      The stack should be 16-byte aligned, not 8 mod 16.
      b6a9b5e2
    • Bobby Bingham's avatar
      cb59e7ee
    • Bobby Bingham's avatar
      94216c60
  8. 19 Jul, 2018 2 commits
  9. 18 Jul, 2018 1 commit
  10. 15 Feb, 2018 7 commits
  11. 14 Feb, 2018 5 commits
  12. 06 Feb, 2018 2 commits