1 PLWP_GETREGS(3PROC)    Process Control Library Functions   PLWP_GETREGS(3PROC)
   2 
   3 NAME
   4      Plwp_getfpregs, Plwp_setfpregs, Plwp_getregs, Plwp_setregs, Lgetfpregs,
   5      Lsetfpregs, Lgetregs, Lsetregs - get and set thread registers
   6 
   7 LIBRARY
   8      Process Control Library (libproc, -lproc)
   9 
  10 SYNOPSIS
  11      #include <libproc.h>
  12 
  13      int
  14      Plwp_getfpregs(struct ps_prochandle *P, lwpid_t lwpid,
  15          prfpregset_t *fpregs);
  16 
  17      int
  18      Plwp_setfpregs(struct ps_prochandle *P, lwpid_t lwpid,
  19          const prfpregset_t fpregs);
  20 
  21      int
  22      Plwp_getregs(struct ps_prochandle *P, lwpid_t lwpid, prgregset_t gregs);
  23 
  24      int
  25      Plwp_setregs(struct ps_prochandle *P, lwpid_t lwpid,
  26          const prgregset_t gregs);
  27 
  28      int
  29      Lgetfpregs(struct ps_lwphandle *L, prfpregset_t *fpregs);
  30 
  31      int
  32      Lsetfpregs(struct ps_lwphandle *L, const prfpregset_t *fpregs);
  33 
  34      int
  35      Lgetregs(struct ps_lwphandle *L, prgregset_t gregs);
  36 
  37      int
  38      Lsetregs(struct ps_lwphandle *L, const prgregset_t gregs);
  39 
  40 DESCRIPTION
  41      The Plwp_getregs(), Plwp_setregs(), Plwp_getfpregs(), and
  42      Plwp_setfpregs() functions allow one to get and set the general purpose
  43      and floating point registers from the thread lwpid in the process handle
  44      P.
  45 
  46      The Plwp_getfpregs() function updates the structure pointed to by fpregs
  47      with the state and values of the floating point registers of the thread
  48      specified by lwpid.
  49 
  50      The Plwp_setfpregs() function updates the floating point registers of the
  51      thread specified by lwpid to the register state contained in fpregs.
  52 
  53      The Plwp_getregs() function updates the structure pointed to by gregs
  54      with the state and values of the general purpose registers of the thread
  55      specified by lwpid.
  56 
  57      The Plwp_setregs() function updates the general purpose registers of the
  58      thread specified by lwpid to the register state contained in gregs.
  59 
  60      Processes must be stopped before obtaining the register state of
  61      individual threads.  Processes may be stopped with Pstop(3PROC).  The
  62      structures used for registers are described in proc(5) and their
  63      definitions may be found in <procfs.h>.  The definitions of these
  64      structures varies based on the architecture of the system and the running
  65      process.
  66 
  67      One may not set the register values of a process that is not an active
  68      process, e.g. a process handle that refers to a file or a core file.
  69 
  70      The Lgetfpregs(), Lsetfpregs(), Lgetregs(), and Lsetregs() functions
  71      behave in a same way as the corresponding process-handle specific
  72      functions, with the following differences:
  73 
  74      -   Rather than take a specified thread id via lwpid, they operate on the
  75          thread that the thread-handle, L, refers to.
  76 
  77      -   The process-handle functions will require that the entire process is
  78          stopped before performing a set operation.  In these cases, only the
  79          specific thread identified by the handle L must be stopped through a
  80          call to Lstop(3PROC) or similar.  Note, a suspended thread
  81          (thr_suspend(3C)) is not considered stopped for these purposes.
  82 
  83 RETURN VALUES
  84      Upon successful completion, the Plwp_getregs(), Plwp_setregs(),
  85      Plwp_getfpregs(), Plwp_setfpregs(), Lgetfpregs(), Lsetfpregs(),
  86      Lgetregs(), and Lsetregs() functions return 0 and obtain or set the
  87      register state.  Otherwise, -1 is returned, errno is set to indicate the
  88      error, and the register state is not updated nor are the data pointers
  89      changed.
  90 
  91 ERRORS
  92      The implementations of these functions may use standard system and
  93      library calls that can fail.  For a full list of possible errors also see
  94      the DIAGNOSTICS section in proc(5).
  95 
  96      The Plwp_getregs(), Plwp_setregs(), Plwp_getfpregs(), and
  97      Plwp_setfpregs() will fail if:
  98 
  99      EBUSY              The process handle P is not currently stopped.
 100 
 101      ENOENT             There is no thread in P with id lwpid.
 102      The Lgetfpregs(), Lsetfpregs(), Lgetregs(), and Lsetregs() will fail if:
 103 
 104      EBUSY              The thread handle L is not currently stopped.
 105 
 106 INTERFACE STABILITY
 107      Uncommitted
 108 
 109 MT-LEVEL
 110      See LOCKING in libproc(3LIB).
 111 
 112 SEE ALSO
 113      libproc(3LIB), proc(5)
 114 
 115 illumos                        January 19, 2023                        illumos