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
        
*** 8,26 ****
  .\" source.  A copy of the CDDL is also available via the Internet at
  .\" http://www.illumos.org/license/CDDL.
  .\"
  .\"
  .\" Copyright 2015 Joyent, Inc.
  .\"
! .Dd May 02, 2020
  .Dt PLWP_GETREGS 3PROC
  .Os
  .Sh NAME
  .Nm Plwp_getfpregs ,
  .Nm Plwp_setfpregs ,
  .Nm Plwp_getregs ,
! .Nm Plwp_setregs
  .Nd get and set thread registers
  .Sh LIBRARY
  .Lb libproc
  .Sh SYNOPSIS
  .In libproc.h
--- 8,31 ----
  .\" source.  A copy of the CDDL is also available via the Internet at
  .\" http://www.illumos.org/license/CDDL.
  .\"
  .\"
  .\" Copyright 2015 Joyent, Inc.
+ .\" Copyright 2023 Oxide Computer Company
  .\"
! .Dd January 19, 2023
  .Dt PLWP_GETREGS 3PROC
  .Os
  .Sh NAME
  .Nm Plwp_getfpregs ,
  .Nm Plwp_setfpregs ,
  .Nm Plwp_getregs ,
! .Nm Plwp_setregs ,
! .Nm Lgetfpregs ,
! .Nm Lsetfpregs ,
! .Nm Lgetregs ,
! .Nm Lsetregs
  .Nd get and set thread registers
  .Sh LIBRARY
  .Lb libproc
  .Sh SYNOPSIS
  .In libproc.h
*** 46,55 ****
--- 51,80 ----
  .Fo Plwp_setregs
  .Fa "struct ps_prochandle *P"
  .Fa "lwpid_t lwpid"
  .Fa "const prgregset_t gregs"
  .Fc
+ .Ft int
+ .Fo Lgetfpregs
+ .Fa "struct ps_lwphandle *L"
+ .Fa "prfpregset_t *fpregs"
+ .Fc
+ .Ft int
+ .Fo Lsetfpregs
+ .Fa "struct ps_lwphandle *L"
+ .Fa "const prfpregset_t *fpregs"
+ .Fc
+ .Ft int
+ .Fo Lgetregs
+ .Fa "struct ps_lwphandle *L"
+ .Fa "prgregset_t gregs"
+ .Fc
+ .Ft int
+ .Fo Lsetregs
+ .Fa "struct ps_lwphandle *L"
+ .Fa "const prgregset_t gregs"
+ .Fc
  .Sh DESCRIPTION
  The
  .Fn Plwp_getregs ,
  .Fn Plwp_setregs ,
  .Fn Plwp_getfpregs ,
*** 103,129 ****
  The definitions of these structures varies based on the architecture of
  the system and the running process.
  .Pp
  One may not set the register values of a process that is not an active
  process, e.g. a process handle that refers to a file or a core file.
  .Sh RETURN VALUES
  Upon successful completion, the
  .Fn Plwp_getregs ,
  .Fn Plwp_setregs ,
  .Fn Plwp_getfpregs ,
  and
! .Fn Plwp_setfpregs
  functions return
  .Sy 0
  and obtain or set the register state.
  Otherwise,
  .Sy -1
  is returned,
! .Sy errno
  is set to indicate the error, and the register state is not updated nor
  are the data pointers changed.
  .Sh ERRORS
  For a full list of possible errors also see the
  .Sy DIAGNOSTICS
  section in
  .Xr proc 5 .
  .Pp
--- 128,190 ----
  The definitions of these structures varies based on the architecture of
  the system and the running process.
  .Pp
  One may not set the register values of a process that is not an active
  process, e.g. a process handle that refers to a file or a core file.
+ .Pp
+ The
+ .Fn Lgetfpregs ,
+ .Fn Lsetfpregs ,
+ .Fn Lgetregs ,
+ and
+ .Fn Lsetregs
+ functions behave in a same way as the corresponding process-handle
+ specific functions, with the following differences:
+ .Bl -dash
+ .It
+ Rather than take a specified thread id via
+ .Fa lwpid ,
+ they operate on the thread that the thread-handle,
+ .Fa L ,
+ refers to.
+ .It
+ The process-handle functions will require that the entire process is
+ stopped before performing a set operation.
+ In these cases, only the specific thread identified by the handle
+ .Fa L
+ must be stopped through a call to
+ .Xr Lstop 3PROC
+ or similar.
+ Note, a suspended thread
+ .Po
+ .Xr thr_suspend 3C
+ .Pc
+ is not considered stopped for these purposes.
+ .El
  .Sh RETURN VALUES
  Upon successful completion, the
  .Fn Plwp_getregs ,
  .Fn Plwp_setregs ,
  .Fn Plwp_getfpregs ,
+ .Fn Plwp_setfpregs ,
+ .Fn Lgetfpregs ,
+ .Fn Lsetfpregs ,
+ .Fn Lgetregs ,
  and
! .Fn Lsetregs
  functions return
  .Sy 0
  and obtain or set the register state.
  Otherwise,
  .Sy -1
  is returned,
! .Va errno
  is set to indicate the error, and the register state is not updated nor
  are the data pointers changed.
  .Sh ERRORS
+ The implementations of these functions may use standard system and
+ library calls that can fail.
  For a full list of possible errors also see the
  .Sy DIAGNOSTICS
  section in
  .Xr proc 5 .
  .Pp
*** 143,152 ****
--- 204,226 ----
  There is no thread in
  .Fa P
  with id
  .Fa lwpid .
  .El
+ The
+ .Fn Lgetfpregs ,
+ .Fn Lsetfpregs ,
+ .Fn Lgetregs ,
+ and
+ .Fn Lsetregs
+ will fail if:
+ .Bl -tag -width Er
+ .It Er EBUSY
+ The thread handle
+ .Fa L
+ is not currently stopped.
+ .El
  .Sh INTERFACE STABILITY
  .Sy Uncommitted
  .Sh MT-LEVEL
  See
  .Sy LOCKING