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/libproc/common/Pgcore.c
          +++ new/usr/src/lib/libproc/common/Pgcore.c
↓ open down ↓ 20 lines elided ↑ open up ↑
  21   21  
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  /*
  27   27   * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  28   28   * Copyright 2018 Joyent, Inc.
  29   29   * Copyright (c) 2013 by Delphix. All rights reserved.
  30   30   * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  31      - * Copyright 2021 Oxide Computer Company
       31 + * Copyright 2023 Oxide Computer Company
  32   32   */
  33   33  
  34   34  #define _STRUCTURED_PROC        1
  35   35  
  36   36  #include <assert.h>
  37   37  #include <stdlib.h>
  38   38  #include <ctype.h>
  39   39  #include <string.h>
  40   40  #include <strings.h>
  41   41  #include <errno.h>
↓ open down ↓ 394 lines elided ↑ open up ↑
 436  436                  if (write_note(pgc->pgc_fd, NT_PRSTATUS, &pr32,
 437  437                      sizeof (prstatus32_t), pgc->pgc_doff) != 0)
 438  438                          return (1);
 439  439                  prfpregset_n_to_32(&lsp->pr_fpreg, &pf32);
 440  440                  if (write_note(pgc->pgc_fd, NT_PRFPREG, &pf32,
 441  441                      sizeof (prfpregset32_t), pgc->pgc_doff) != 0)
 442  442                          return (1);
 443  443  #endif  /* _LP64 */
 444  444          }
 445  445  
 446      -#ifdef sparc
 447      -        {
 448      -                prxregset_t xregs;
 449      -                if (Plwp_getxregs(P, lsp->pr_lwpid, &xregs) == 0 &&
 450      -                    write_note(pgc->pgc_fd, NT_PRXREG, &xregs,
 451      -                    sizeof (prxregset_t), pgc->pgc_doff) != 0)
 452      -                        return (1);
 453      -        }
 454      -#endif  /* sparc */
 455      -
 456  446          return (0);
 457  447  }
 458  448  
 459  449  static int
 460  450  new_per_lwp(void *data, const lwpstatus_t *lsp, const lwpsinfo_t *lip)
 461  451  {
 462  452          pgcore_t *pgc = data;
 463  453          struct ps_prochandle *P = pgc->P;
 464  454          prlwpname_t name = { 0, "" };
 465  455          psinfo_t ps;
↓ open down ↓ 22 lines elided ↑ open up ↑
 488  478                          return (1);
 489  479                  if (lsp == NULL)
 490  480                          return (0);
 491  481                  lwpstatus_n_to_32(lsp, &ls32);
 492  482                  if (write_note(pgc->pgc_fd, NT_LWPSTATUS, &ls32,
 493  483                      sizeof (lwpstatus32_t), pgc->pgc_doff) != 0)
 494  484                          return (1);
 495  485  #endif  /* _LP64 */
 496  486          }
 497  487  
 498      -#ifdef sparc
 499  488          {
 500      -                prxregset_t xregs;
 501      -                gwindows_t gwins;
      489 +                prxregset_t *xregs;
 502  490                  size_t size;
 503  491  
 504      -                if (Plwp_getxregs(P, lsp->pr_lwpid, &xregs) == 0) {
 505      -                        if (write_note(pgc->pgc_fd, NT_PRXREG, &xregs,
 506      -                            sizeof (prxregset_t), pgc->pgc_doff) != 0)
 507      -                                return (1);
 508      -                }
 509      -
 510      -                if (Plwp_getgwindows(P, lsp->pr_lwpid, &gwins) == 0 &&
 511      -                    gwins.wbcnt > 0) {
 512      -                        size = sizeof (gwins) - sizeof (gwins.wbuf) +
 513      -                            gwins.wbcnt * sizeof (gwins.wbuf[0]);
 514      -
 515      -                        if (write_note(pgc->pgc_fd, NT_GWINDOWS, &gwins, size,
      492 +                /*
      493 +                 * While historically this function was only present on some
      494 +                 * architectures (despite the presence of the empty file
      495 +                 * elsewhere), if we call this on a platform without support
      496 +                 * it'll now fail and thus is no longer subject to
      497 +                 * platform-specific ifdefs.
      498 +                 */
      499 +                if (Plwp_getxregs(P, lsp->pr_lwpid, &xregs, &size) == 0) {
      500 +                        if (write_note(pgc->pgc_fd, NT_PRXREG, xregs, size,
 516  501                              pgc->pgc_doff) != 0)
 517  502                                  return (1);
 518      -                }
 519  503  
 520      -        }
 521      -#ifdef __sparcv9
 522      -        if (P->status.pr_dmodel == PR_MODEL_LP64) {
 523      -                asrset_t asrs;
 524      -                if (Plwp_getasrs(P, lsp->pr_lwpid, asrs) == 0) {
 525      -                        if (write_note(pgc->pgc_fd, NT_ASRS, &asrs,
 526      -                            sizeof (asrset_t), pgc->pgc_doff) != 0)
 527      -                                return (1);
      504 +                        Plwp_freexregs(P, xregs, size);
 528  505                  }
 529  506          }
 530      -#endif  /* __sparcv9 */
 531      -#endif  /* sparc */
 532  507  
 533  508          if (Plwp_getname(P, lsp->pr_lwpid, name.pr_lwpname,
 534  509              sizeof (name.pr_lwpname)) == 0) {
 535  510                  name.pr_lwpid = lsp->pr_lwpid;
 536  511                  if (write_note(pgc->pgc_fd, NT_LWPNAME, &name,
 537  512                      sizeof (name), pgc->pgc_doff) != 0)
 538  513                          return (1);
 539  514          }
 540  515  
 541  516          if (!(lsp->pr_flags & PR_AGENT))
↓ open down ↓ 1225 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX