Print this page
15254 %ymm registers not restored after signal handler
15367 x86 getfpregs() summons corrupting %xmm ghosts
15333 want x86 /proc xregs support (libc_db, libproc, mdb, etc.)
15336 want libc functions for extended ucontext_t
15334 want ps_lwphandle-specific reg routines
15328 FPU_CW_INIT mistreats reserved bit
15335 i86pc fpu_subr.c isn't really platform-specific
15332 setcontext(2) isn't actually noreturn
15331 need <sys/stdalign.h>
Change-Id: I7060aa86042dfb989f77fc3323c065ea2eafa9ad
Conflicts:
    usr/src/uts/common/fs/proc/prcontrol.c
    usr/src/uts/intel/os/archdep.c
    usr/src/uts/intel/sys/ucontext.h
    usr/src/uts/intel/syscall/getcontext.c
        
*** 23,33 ****
   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
   * Copyright 2019 Joyent, Inc.
   * Copyright (c) 2017 by Delphix. All rights reserved.
   * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
   * Copyright 2022 MNX Cloud, Inc.
!  * Copyright 2022 Oxide Computer Company
   */
  
  /*      Copyright (c) 1984,      1986, 1987, 1988, 1989 AT&T    */
  /*        All Rights Reserved   */
  
--- 23,33 ----
   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
   * Copyright 2019 Joyent, Inc.
   * Copyright (c) 2017 by Delphix. All rights reserved.
   * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
   * Copyright 2022 MNX Cloud, Inc.
!  * Copyright 2023 Oxide Computer Company
   */
  
  /*      Copyright (c) 1984,      1986, 1987, 1988, 1989 AT&T    */
  /*        All Rights Reserved   */
  
*** 1735,1762 ****
  
  /* ARGSUSED */
  static int
  pr_read_xregs(prnode_t *pnp, uio_t *uiop, cred_t *cr)
  {
- #if defined(__sparc)
          proc_t *p;
          kthread_t *t;
          int error;
!         char *xreg;
          size_t size;
  
          ASSERT(pnp->pr_type == PR_XREGS);
  
-         xreg = kmem_zalloc(sizeof (prxregset_t), KM_SLEEP);
- 
          if ((error = prlock(pnp, ZNO)) != 0)
!                 goto out;
  
          p = pnp->pr_common->prc_proc;
          t = pnp->pr_common->prc_thread;
  
!         size = prhasx(p)? prgetprxregsize(p) : 0;
          if (uiop->uio_offset >= size) {
                  prunlock(pnp);
                  goto out;
          }
  
--- 1735,1782 ----
  
  /* ARGSUSED */
  static int
  pr_read_xregs(prnode_t *pnp, uio_t *uiop, cred_t *cr)
  {
          proc_t *p;
          kthread_t *t;
          int error;
!         void *xreg;
          size_t size;
  
          ASSERT(pnp->pr_type == PR_XREGS);
  
          if ((error = prlock(pnp, ZNO)) != 0)
!                 return (error);
  
          p = pnp->pr_common->prc_proc;
          t = pnp->pr_common->prc_thread;
  
!         /*
!          * While we would prefer to do the allocation with holding the process
!          * this way, we can only determine this size while holding the process
!          * as the hold guarantees us:
!          *
!          *  o That the process in question actualy exists.
!          *  o That the process in question cannot change the set of FPU features
!          *    it has enabled.
!          *
!          * We will drop p_lock across the allocation call itself. This should be
!          * safe as the enabled feature set should not change while the process
!          * is locked (e.g. enabling extending FPU state like AMX on x86 should
!          * require the process to be locked).
!          */
!         size = prhasx(p) ? prgetprxregsize(p) : 0;
!         if (size == 0) {
!                 prunlock(pnp);
!                 return (0);
!         }
!         mutex_exit(&p->p_lock);
!         xreg = kmem_zalloc(size, KM_SLEEP);
!         mutex_enter(&p->p_lock);
!         ASSERT3U(size, ==, prgetprxregsize(p));
! 
          if (uiop->uio_offset >= size) {
                  prunlock(pnp);
                  goto out;
          }
  
*** 1766,1780 ****
          mutex_enter(&p->p_lock);
          prunlock(pnp);
  
          error = pr_uioread(xreg, size, uiop);
  out:
!         kmem_free(xreg, sizeof (prxregset_t));
          return (error);
- #else
-         return (0);
- #endif
  }
  
  static int
  pr_read_spymaster(prnode_t *pnp, uio_t *uiop, cred_t *cr)
  {
--- 1786,1797 ----
          mutex_enter(&p->p_lock);
          prunlock(pnp);
  
          error = pr_uioread(xreg, size, uiop);
  out:
!         kmem_free(xreg, size);
          return (error);
  }
  
  static int
  pr_read_spymaster(prnode_t *pnp, uio_t *uiop, cred_t *cr)
  {