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
        
*** 26,36 ****
  /*
   * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
   * Copyright 2018 Joyent, Inc.
   * Copyright (c) 2013 by Delphix. All rights reserved.
   * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
!  * Copyright 2021 Oxide Computer Company
   */
  
  #define _STRUCTURED_PROC        1
  
  #include <assert.h>
--- 26,36 ----
  /*
   * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
   * Copyright 2018 Joyent, Inc.
   * Copyright (c) 2013 by Delphix. All rights reserved.
   * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
!  * Copyright 2023 Oxide Computer Company
   */
  
  #define _STRUCTURED_PROC        1
  
  #include <assert.h>
*** 441,460 ****
                      sizeof (prfpregset32_t), pgc->pgc_doff) != 0)
                          return (1);
  #endif  /* _LP64 */
          }
  
- #ifdef sparc
-         {
-                 prxregset_t xregs;
-                 if (Plwp_getxregs(P, lsp->pr_lwpid, &xregs) == 0 &&
-                     write_note(pgc->pgc_fd, NT_PRXREG, &xregs,
-                     sizeof (prxregset_t), pgc->pgc_doff) != 0)
-                         return (1);
-         }
- #endif  /* sparc */
- 
          return (0);
  }
  
  static int
  new_per_lwp(void *data, const lwpstatus_t *lsp, const lwpsinfo_t *lip)
--- 441,450 ----
*** 493,536 ****
                      sizeof (lwpstatus32_t), pgc->pgc_doff) != 0)
                          return (1);
  #endif  /* _LP64 */
          }
  
- #ifdef sparc
          {
!                 prxregset_t xregs;
!                 gwindows_t gwins;
                  size_t size;
  
!                 if (Plwp_getxregs(P, lsp->pr_lwpid, &xregs) == 0) {
!                         if (write_note(pgc->pgc_fd, NT_PRXREG, &xregs,
!                             sizeof (prxregset_t), pgc->pgc_doff) != 0)
!                                 return (1);
!                 }
! 
!                 if (Plwp_getgwindows(P, lsp->pr_lwpid, &gwins) == 0 &&
!                     gwins.wbcnt > 0) {
!                         size = sizeof (gwins) - sizeof (gwins.wbuf) +
!                             gwins.wbcnt * sizeof (gwins.wbuf[0]);
! 
!                         if (write_note(pgc->pgc_fd, NT_GWINDOWS, &gwins, size,
                              pgc->pgc_doff) != 0)
                                  return (1);
-                 }
  
          }
- #ifdef __sparcv9
-         if (P->status.pr_dmodel == PR_MODEL_LP64) {
-                 asrset_t asrs;
-                 if (Plwp_getasrs(P, lsp->pr_lwpid, asrs) == 0) {
-                         if (write_note(pgc->pgc_fd, NT_ASRS, &asrs,
-                             sizeof (asrset_t), pgc->pgc_doff) != 0)
-                                 return (1);
                  }
-         }
- #endif  /* __sparcv9 */
- #endif  /* sparc */
  
          if (Plwp_getname(P, lsp->pr_lwpid, name.pr_lwpname,
              sizeof (name.pr_lwpname)) == 0) {
                  name.pr_lwpid = lsp->pr_lwpid;
                  if (write_note(pgc->pgc_fd, NT_LWPNAME, &name,
--- 483,511 ----
                      sizeof (lwpstatus32_t), pgc->pgc_doff) != 0)
                          return (1);
  #endif  /* _LP64 */
          }
  
          {
!                 prxregset_t *xregs;
                  size_t size;
  
!                 /*
!                  * While historically this function was only present on some
!                  * architectures (despite the presence of the empty file
!                  * elsewhere), if we call this on a platform without support
!                  * it'll now fail and thus is no longer subject to
!                  * platform-specific ifdefs.
!                  */
!                 if (Plwp_getxregs(P, lsp->pr_lwpid, &xregs, &size) == 0) {
!                         if (write_note(pgc->pgc_fd, NT_PRXREG, xregs, size,
                              pgc->pgc_doff) != 0)
                                  return (1);
  
+                         Plwp_freexregs(P, xregs, size);
                  }
          }
  
          if (Plwp_getname(P, lsp->pr_lwpid, name.pr_lwpname,
              sizeof (name.pr_lwpname)) == 0) {
                  name.pr_lwpid = lsp->pr_lwpid;
                  if (write_note(pgc->pgc_fd, NT_LWPNAME, &name,