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
        
*** 24,33 ****
--- 24,34 ----
   * Use is subject to license terms.
   */
  
  /*
   * Copyright (c) 2014, Joyent, Inc. All rights reserved.
+  * Copyright 2023 Oxide Computer Company
   */
  
  #include <stdio.h>
  #include <stdlib.h>
  #include <stddef.h>
*** 1987,1997 ****
  #pragma weak td_thr_getxregsize = __td_thr_getxregsize
  /* ARGSUSED */
  td_err_e
  __td_thr_getxregsize(td_thrhandle_t *th_p, int *xregsize)
  {
- #if defined(__sparc)
          struct ps_prochandle *ph_p;
          td_err_e return_val;
  
          if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
                  return (return_val);
--- 1988,1997 ----
*** 2001,2046 ****
          }
  
          if (ps_lgetxregsize(ph_p, thr_to_lwpid(th_p), xregsize) != PS_OK)
                  return_val = TD_DBERR;
  
          (void) ps_pcontinue(ph_p);
          ph_unlock(th_p->th_ta_p);
          return (return_val);
- #else   /* __sparc */
-         return (TD_NOXREGS);
- #endif  /* __sparc */
  }
  
  /*
   * Get a thread's extra state register set.
   */
  #pragma weak td_thr_getxregs = __td_thr_getxregs
- /* ARGSUSED */
  td_err_e
  __td_thr_getxregs(td_thrhandle_t *th_p, void *xregset)
  {
- #if defined(__sparc)
          struct ps_prochandle *ph_p;
          td_err_e return_val;
  
          if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
                  return (return_val);
          if (ps_pstop(ph_p) != PS_OK) {
                  ph_unlock(th_p->th_ta_p);
                  return (TD_DBERR);
          }
  
!         if (ps_lgetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset) != PS_OK)
                  return_val = TD_DBERR;
  
          (void) ps_pcontinue(ph_p);
          ph_unlock(th_p->th_ta_p);
          return (return_val);
- #else   /* __sparc */
-         return (TD_NOXREGS);
- #endif  /* __sparc */
  }
  
  /*
   * Set a thread's extra state register set.
   */
--- 2001,2045 ----
          }
  
          if (ps_lgetxregsize(ph_p, thr_to_lwpid(th_p), xregsize) != PS_OK)
                  return_val = TD_DBERR;
  
+         if (*xregsize == 0)
+                 return_val = TD_NOXREGS;
+ 
          (void) ps_pcontinue(ph_p);
          ph_unlock(th_p->th_ta_p);
          return (return_val);
  }
  
  /*
   * Get a thread's extra state register set.
   */
  #pragma weak td_thr_getxregs = __td_thr_getxregs
  td_err_e
  __td_thr_getxregs(td_thrhandle_t *th_p, void *xregset)
  {
          struct ps_prochandle *ph_p;
          td_err_e return_val;
+         ps_err_e ps_err;
  
          if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
                  return (return_val);
          if (ps_pstop(ph_p) != PS_OK) {
                  ph_unlock(th_p->th_ta_p);
                  return (TD_DBERR);
          }
  
!         ps_err = ps_lgetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset);
!         if (ps_err == PS_NOXREGS)
!                 return_val = TD_NOXREGS;
!         else if (ps_err != PS_OK)
                  return_val = TD_DBERR;
  
          (void) ps_pcontinue(ph_p);
          ph_unlock(th_p->th_ta_p);
          return (return_val);
  }
  
  /*
   * Set a thread's extra state register set.
   */
*** 2047,2057 ****
  #pragma weak td_thr_setxregs = __td_thr_setxregs
  /* ARGSUSED */
  td_err_e
  __td_thr_setxregs(td_thrhandle_t *th_p, const void *xregset)
  {
- #if defined(__sparc)
          struct ps_prochandle *ph_p;
          td_err_e return_val;
  
          if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
                  return (return_val);
--- 2046,2055 ----
*** 2064,2076 ****
                  return_val = TD_DBERR;
  
          (void) ps_pcontinue(ph_p);
          ph_unlock(th_p->th_ta_p);
          return (return_val);
- #else   /* __sparc */
-         return (TD_NOXREGS);
- #endif  /* __sparc */
  }
  
  struct searcher {
          psaddr_t        addr;
          int             status;
--- 2062,2071 ----