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/uts/common/fs/proc/prdata.h
          +++ new/usr/src/uts/common/fs/proc/prdata.h
↓ open down ↓ 21 lines elided ↑ open up ↑
  22   22   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  27   27  /*        All Rights Reserved   */
  28   28  
  29   29  /*
  30   30   * Copyright 2019 Joyent, Inc.
  31   31   * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
       32 + * Copyright 2023 Oxide Computer Company
  32   33   */
  33   34  
  34   35  #ifndef _SYS_PROC_PRDATA_H
  35   36  #define _SYS_PROC_PRDATA_H
  36   37  
  37   38  #include <sys/isa_defs.h>
  38   39  #include <sys/proc.h>
  39   40  #include <sys/vnode.h>
  40   41  #include <sys/prsystm.h>
  41   42  #include <sys/model.h>
↓ open down ↓ 360 lines elided ↑ open up ↑
 402  403  extern  size_t  prpdsize32(struct as *);
 403  404  extern  int     prpdread32(proc_t *, uint_t, struct uio *);
 404  405  extern  size_t  oprpdsize32(struct as *);
 405  406  extern  int     oprpdread32(struct as *, uint_t, struct uio *);
 406  407  #endif  /* _SYSCALL32_IMPL */
 407  408  
 408  409  extern  void    prpokethread(kthread_t *t);
 409  410  extern  int     prgetrvals(klwp_t *, long *, long *);
 410  411  extern  void    prgetprfpregs(klwp_t *, prfpregset_t *);
 411  412  extern  void    prsetprfpregs(klwp_t *, prfpregset_t *);
 412      -extern  void    prgetprxregs(klwp_t *, caddr_t);
 413      -extern  void    prsetprxregs(klwp_t *, caddr_t);
 414      -extern  int     prgetprxregsize(proc_t *);
 415  413  extern  int     prhasfp(void);
 416      -extern  int     prhasx(proc_t *);
 417  414  extern  caddr_t prgetstackbase(proc_t *);
 418  415  extern  caddr_t prgetpsaddr(proc_t *);
 419  416  extern  int     prisstep(klwp_t *);
 420  417  extern  void    prsvaddr(klwp_t *, caddr_t);
 421  418  extern  int     prfetchinstr(klwp_t *, ulong_t *);
 422  419  extern  ushort_t prgetpctcpu(uint64_t);
 423  420  
      421 +/*
      422 + * This set of routines is used by platforms to implement support for the
      423 + * 'xregs' or extended registers in /proc. Unlike other registers which
      424 + * generally have a well-defined value determined by the ABI that never changes,
      425 + * we expect these to change.
      426 + *
      427 + * An important thing to note is that you'll see we have moved away from a
      428 + * traditional version of a fixed size, non-opaque definition of the
      429 + * prxregset_t. This is because the size varies and we don't want applications
      430 + * to incorrectly bake a real definition in and cause problems where extending
      431 + * it becomes very hard to do (ala the prgregset_t and prfregset_t). This is a
      432 + * little more work for everyone implementing it, but it does ensure that we are
      433 + * generally in better shape.
      434 + *
      435 + * Here are the semantics of what these are required * to do and how the fit
      436 + * together:
      437 + *
      438 + *   o prhasx           Determine if the process in question supports the
      439 + *                      extended register sets. Note, this is may be a
      440 + *                      process-specific setting due to things like whether or
      441 + *                      not the FPU is enabled or other things.
      442 + *
      443 + *   o prgetxregsize    This returns the size of the actual xregs file for a
      444 + *                      given process. This may change between processes because
      445 + *                      not every process may have the same set of extended
      446 + *                      features enabled (e.g. AMX on x86).
      447 + *
      448 + *   o prwriteminxreg   This is used by the prwritectl() and related worlds to
      449 + *                      determine the minimum amount of data that much be
      450 + *                      present to determine if the actual size of a write is
      451 + *                      valid. If xregs is not supported, then this should
      452 + *                      return B_FALSE.
      453 + *
      454 + *   o prwritesizexreg  This is meant to indicate how much data is required to
      455 + *                      be copied in for a given xregs write. The base data will
      456 + *                      already be present from having called prwriteminxreg
      457 + *                      previously. If xregs are not supported this should
      458 + *                      return B_FALSE.
      459 + *
      460 + *                      There is a wrinkle in this which is not true of other
      461 + *                      callers. The data that we are given is not guaranteed to
      462 + *                      be aligned in the slightest due to the need to support
      463 + *                      both ILP32 and LP64!
      464 + *
      465 + *   o prgetprxregs     This is a request to fill in the xregs data. Right now
      466 + *                      the system guarantees that the buffer size is at least
      467 + *                      the result of the prgetprxregs() call for this process.
      468 + *                      Callers may assume that the process remains locked
      469 + *                      between the two so that the size doesn't change.
      470 + *
      471 + *   o prsetprxregs     This is a request to set the xregs data. The only
      472 + *                      assumption that should be made is that the validation of
      473 + *                      the size has been done in prvalidpcsxreg() as been
      474 + *                      performed. Users can and will potentially try to trick
      475 + *                      us with invalid values. Do not blindly apply this unless
      476 + *                      there is something that is impossible about that, but
      477 + *                      given that our recommendations for this are variable
      478 + *                      width data, that should not happen.
      479 + *
      480 + *                      If xregs are not supported this should return EINVAL.
      481 + *                      While yes other errnos may make more sense, that is what
      482 + *                      we have always returned in /proc for this case.
      483 + */
      484 +extern  int     prhasx(proc_t *);
      485 +extern  size_t  prgetprxregsize(proc_t *);
      486 +extern  void    prgetprxregs(klwp_t *, prxregset_t *);
      487 +extern  boolean_t prwriteminxreg(size_t *);
      488 +extern  boolean_t prwritesizexreg(const void *, size_t *);
      489 +extern  int     prsetprxregs(klwp_t *, prxregset_t *);
      490 +
 424  491  #endif  /* _KERNEL */
 425  492  
 426  493  #ifdef  __cplusplus
 427  494  }
 428  495  #endif
 429  496  
 430  497  #endif  /* _SYS_PROC_PRDATA_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX