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/man/man3proc/Plwp_getregs.3proc
          +++ new/usr/src/man/man3proc/Plwp_getregs.3proc
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3  .\" Common Development and Distribution License ("CDDL"), version 1.0.
   4    4  .\" You may only use this file in accordance with the terms of version
   5    5  .\" 1.0 of the CDDL.
   6    6  .\"
   7    7  .\" A full copy of the text of the CDDL should have accompanied this
   8    8  .\" source.  A copy of the CDDL is also available via the Internet at
   9    9  .\" http://www.illumos.org/license/CDDL.
  10   10  .\"
  11   11  .\"
  12   12  .\" Copyright 2015 Joyent, Inc.
       13 +.\" Copyright 2023 Oxide Computer Company
  13   14  .\"
  14      -.Dd May 02, 2020
       15 +.Dd January 19, 2023
  15   16  .Dt PLWP_GETREGS 3PROC
  16   17  .Os
  17   18  .Sh NAME
  18   19  .Nm Plwp_getfpregs ,
  19   20  .Nm Plwp_setfpregs ,
  20   21  .Nm Plwp_getregs ,
  21      -.Nm Plwp_setregs
       22 +.Nm Plwp_setregs ,
       23 +.Nm Lgetfpregs ,
       24 +.Nm Lsetfpregs ,
       25 +.Nm Lgetregs ,
       26 +.Nm Lsetregs
  22   27  .Nd get and set thread registers
  23   28  .Sh LIBRARY
  24   29  .Lb libproc
  25   30  .Sh SYNOPSIS
  26   31  .In libproc.h
  27   32  .Ft int
  28   33  .Fo Plwp_getfpregs
  29   34  .Fa "struct ps_prochandle *P"
  30   35  .Fa "lwpid_t lwpid"
  31   36  .Fa "prfpregset_t *fpregs"
↓ open down ↓ 9 lines elided ↑ open up ↑
  41   46  .Fa "struct ps_prochandle *P"
  42   47  .Fa "lwpid_t lwpid"
  43   48  .Fa "prgregset_t gregs"
  44   49  .Fc
  45   50  .Ft int
  46   51  .Fo Plwp_setregs
  47   52  .Fa "struct ps_prochandle *P"
  48   53  .Fa "lwpid_t lwpid"
  49   54  .Fa "const prgregset_t gregs"
  50   55  .Fc
       56 +.Ft int
       57 +.Fo Lgetfpregs
       58 +.Fa "struct ps_lwphandle *L"
       59 +.Fa "prfpregset_t *fpregs"
       60 +.Fc
       61 +.Ft int
       62 +.Fo Lsetfpregs
       63 +.Fa "struct ps_lwphandle *L"
       64 +.Fa "const prfpregset_t *fpregs"
       65 +.Fc
       66 +.Ft int
       67 +.Fo Lgetregs
       68 +.Fa "struct ps_lwphandle *L"
       69 +.Fa "prgregset_t gregs"
       70 +.Fc
       71 +.Ft int
       72 +.Fo Lsetregs
       73 +.Fa "struct ps_lwphandle *L"
       74 +.Fa "const prgregset_t gregs"
       75 +.Fc
  51   76  .Sh DESCRIPTION
  52   77  The
  53   78  .Fn Plwp_getregs ,
  54   79  .Fn Plwp_setregs ,
  55   80  .Fn Plwp_getfpregs ,
  56   81  and
  57   82  .Fn Plwp_setfpregs
  58   83  functions allow one to get and set the general purpose and floating
  59   84  point registers from the thread
  60   85  .Fa lwpid
↓ open down ↓ 37 lines elided ↑ open up ↑
  98  123  .Xr Pstop 3PROC .
  99  124  The structures used for registers are described in
 100  125  .Xr proc 5
 101  126  and their definitions may be found in
 102  127  .In procfs.h .
 103  128  The definitions of these structures varies based on the architecture of
 104  129  the system and the running process.
 105  130  .Pp
 106  131  One may not set the register values of a process that is not an active
 107  132  process, e.g. a process handle that refers to a file or a core file.
      133 +.Pp
      134 +The
      135 +.Fn Lgetfpregs ,
      136 +.Fn Lsetfpregs ,
      137 +.Fn Lgetregs ,
      138 +and
      139 +.Fn Lsetregs
      140 +functions behave in a same way as the corresponding process-handle
      141 +specific functions, with the following differences:
      142 +.Bl -dash
      143 +.It
      144 +Rather than take a specified thread id via
      145 +.Fa lwpid ,
      146 +they operate on the thread that the thread-handle,
      147 +.Fa L ,
      148 +refers to.
      149 +.It
      150 +The process-handle functions will require that the entire process is
      151 +stopped before performing a set operation.
      152 +In these cases, only the specific thread identified by the handle
      153 +.Fa L
      154 +must be stopped through a call to
      155 +.Xr Lstop 3PROC
      156 +or similar.
      157 +Note, a suspended thread
      158 +.Po
      159 +.Xr thr_suspend 3C
      160 +.Pc
      161 +is not considered stopped for these purposes.
      162 +.El
 108  163  .Sh RETURN VALUES
 109  164  Upon successful completion, the
 110  165  .Fn Plwp_getregs ,
 111  166  .Fn Plwp_setregs ,
 112  167  .Fn Plwp_getfpregs ,
      168 +.Fn Plwp_setfpregs ,
      169 +.Fn Lgetfpregs ,
      170 +.Fn Lsetfpregs ,
      171 +.Fn Lgetregs ,
 113  172  and
 114      -.Fn Plwp_setfpregs
      173 +.Fn Lsetregs
 115  174  functions return
 116  175  .Sy 0
 117  176  and obtain or set the register state.
 118  177  Otherwise,
 119  178  .Sy -1
 120  179  is returned,
 121      -.Sy errno
      180 +.Va errno
 122  181  is set to indicate the error, and the register state is not updated nor
 123  182  are the data pointers changed.
 124  183  .Sh ERRORS
      184 +The implementations of these functions may use standard system and
      185 +library calls that can fail.
 125  186  For a full list of possible errors also see the
 126  187  .Sy DIAGNOSTICS
 127  188  section in
 128  189  .Xr proc 5 .
 129  190  .Pp
 130  191  The
 131  192  .Fn Plwp_getregs ,
 132  193  .Fn Plwp_setregs ,
 133  194  .Fn Plwp_getfpregs ,
 134  195  and
↓ open down ↓ 3 lines elided ↑ open up ↑
 138  199  .It Er EBUSY
 139  200  The process handle
 140  201  .Fa P
 141  202  is not currently stopped.
 142  203  .It Er ENOENT
 143  204  There is no thread in
 144  205  .Fa P
 145  206  with id
 146  207  .Fa lwpid .
 147  208  .El
      209 +The
      210 +.Fn Lgetfpregs ,
      211 +.Fn Lsetfpregs ,
      212 +.Fn Lgetregs ,
      213 +and
      214 +.Fn Lsetregs
      215 +will fail if:
      216 +.Bl -tag -width Er
      217 +.It Er EBUSY
      218 +The thread handle
      219 +.Fa L
      220 +is not currently stopped.
      221 +.El
 148  222  .Sh INTERFACE STABILITY
 149  223  .Sy Uncommitted
 150  224  .Sh MT-LEVEL
 151  225  See
 152  226  .Sy LOCKING
 153  227  in
 154  228  .Xr libproc 3LIB .
 155  229  .Sh SEE ALSO
 156  230  .Xr libproc 3LIB ,
 157  231  .Xr proc 5
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX