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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc_db/common/thread_db.c
          +++ new/usr/src/lib/libc_db/common/thread_db.c
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*
  28   28   * Copyright (c) 2014, Joyent, Inc. All rights reserved.
       29 + * Copyright 2023 Oxide Computer Company
  29   30   */
  30   31  
  31   32  #include <stdio.h>
  32   33  #include <stdlib.h>
  33   34  #include <stddef.h>
  34   35  #include <unistd.h>
  35   36  #include <thr_uberdata.h>
  36   37  #include <thread_db.h>
  37   38  #include <libc_int.h>
  38   39  
↓ open down ↓ 1943 lines elided ↑ open up ↑
1982 1983  
1983 1984  /*
1984 1985   * Get the size of the extra state register set for this architecture.
1985 1986   * Currently unused by dbx.
1986 1987   */
1987 1988  #pragma weak td_thr_getxregsize = __td_thr_getxregsize
1988 1989  /* ARGSUSED */
1989 1990  td_err_e
1990 1991  __td_thr_getxregsize(td_thrhandle_t *th_p, int *xregsize)
1991 1992  {
1992      -#if defined(__sparc)
1993 1993          struct ps_prochandle *ph_p;
1994 1994          td_err_e return_val;
1995 1995  
1996 1996          if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
1997 1997                  return (return_val);
1998 1998          if (ps_pstop(ph_p) != PS_OK) {
1999 1999                  ph_unlock(th_p->th_ta_p);
2000 2000                  return (TD_DBERR);
2001 2001          }
2002 2002  
2003 2003          if (ps_lgetxregsize(ph_p, thr_to_lwpid(th_p), xregsize) != PS_OK)
2004 2004                  return_val = TD_DBERR;
2005 2005  
     2006 +        if (*xregsize == 0)
     2007 +                return_val = TD_NOXREGS;
     2008 +
2006 2009          (void) ps_pcontinue(ph_p);
2007 2010          ph_unlock(th_p->th_ta_p);
2008 2011          return (return_val);
2009      -#else   /* __sparc */
2010      -        return (TD_NOXREGS);
2011      -#endif  /* __sparc */
2012 2012  }
2013 2013  
2014 2014  /*
2015 2015   * Get a thread's extra state register set.
2016 2016   */
2017 2017  #pragma weak td_thr_getxregs = __td_thr_getxregs
2018      -/* ARGSUSED */
2019 2018  td_err_e
2020 2019  __td_thr_getxregs(td_thrhandle_t *th_p, void *xregset)
2021 2020  {
2022      -#if defined(__sparc)
2023 2021          struct ps_prochandle *ph_p;
2024 2022          td_err_e return_val;
     2023 +        ps_err_e ps_err;
2025 2024  
2026 2025          if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
2027 2026                  return (return_val);
2028 2027          if (ps_pstop(ph_p) != PS_OK) {
2029 2028                  ph_unlock(th_p->th_ta_p);
2030 2029                  return (TD_DBERR);
2031 2030          }
2032 2031  
2033      -        if (ps_lgetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset) != PS_OK)
     2032 +        ps_err = ps_lgetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset);
     2033 +        if (ps_err == PS_NOXREGS)
     2034 +                return_val = TD_NOXREGS;
     2035 +        else if (ps_err != PS_OK)
2034 2036                  return_val = TD_DBERR;
2035 2037  
2036 2038          (void) ps_pcontinue(ph_p);
2037 2039          ph_unlock(th_p->th_ta_p);
2038 2040          return (return_val);
2039      -#else   /* __sparc */
2040      -        return (TD_NOXREGS);
2041      -#endif  /* __sparc */
2042 2041  }
2043 2042  
2044 2043  /*
2045 2044   * Set a thread's extra state register set.
2046 2045   */
2047 2046  #pragma weak td_thr_setxregs = __td_thr_setxregs
2048 2047  /* ARGSUSED */
2049 2048  td_err_e
2050 2049  __td_thr_setxregs(td_thrhandle_t *th_p, const void *xregset)
2051 2050  {
2052      -#if defined(__sparc)
2053 2051          struct ps_prochandle *ph_p;
2054 2052          td_err_e return_val;
2055 2053  
2056 2054          if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
2057 2055                  return (return_val);
2058 2056          if (ps_pstop(ph_p) != PS_OK) {
2059 2057                  ph_unlock(th_p->th_ta_p);
2060 2058                  return (TD_DBERR);
2061 2059          }
2062 2060  
2063 2061          if (ps_lsetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset) != PS_OK)
2064 2062                  return_val = TD_DBERR;
2065 2063  
2066 2064          (void) ps_pcontinue(ph_p);
2067 2065          ph_unlock(th_p->th_ta_p);
2068 2066          return (return_val);
2069      -#else   /* __sparc */
2070      -        return (TD_NOXREGS);
2071      -#endif  /* __sparc */
2072 2067  }
2073 2068  
2074 2069  struct searcher {
2075 2070          psaddr_t        addr;
2076 2071          int             status;
2077 2072  };
2078 2073  
2079 2074  /*
2080 2075   * Check the struct thread address in *th_p again first
2081 2076   * value in "data".  If value in data is found, set second value
↓ open down ↓ 1001 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX