PLWP_GETREGS(3PROC) Process Control Library Functions PLWP_GETREGS(3PROC)

Plwp_getfpregs, Plwp_setfpregs, Plwp_getregs, Plwp_setregs, Lgetfpregs, Lsetfpregs, Lgetregs, Lsetregsget and set thread registers

Process Control Library (libproc, -lproc)

#include <libproc.h>

int
Plwp_getfpregs(struct ps_prochandle *P, lwpid_t lwpid, prfpregset_t *fpregs);

int
Plwp_setfpregs(struct ps_prochandle *P, lwpid_t lwpid, const prfpregset_t fpregs);

int
Plwp_getregs(struct ps_prochandle *P, lwpid_t lwpid, prgregset_t gregs);

int
Plwp_setregs(struct ps_prochandle *P, lwpid_t lwpid, const prgregset_t gregs);

int
Lgetfpregs(struct ps_lwphandle *L, prfpregset_t *fpregs);

int
Lsetfpregs(struct ps_lwphandle *L, const prfpregset_t *fpregs);

int
Lgetregs(struct ps_lwphandle *L, prgregset_t gregs);

int
Lsetregs(struct ps_lwphandle *L, const prgregset_t gregs);

The (), Plwp_setregs(), Plwp_getfpregs(), and Plwp_setfpregs() functions allow one to get and set the general purpose and floating point registers from the thread lwpid in the process handle P.

The () function updates the structure pointed to by fpregs with the state and values of the floating point registers of the thread specified by lwpid.

The () function updates the floating point registers of the thread specified by lwpid to the register state contained in fpregs.

The () function updates the structure pointed to by gregs with the state and values of the general purpose registers of the thread specified by lwpid.

The () function updates the general purpose registers of the thread specified by lwpid to the register state contained in gregs.

Processes must be stopped before obtaining the register state of individual threads. Processes may be stopped with Pstop(3PROC). The structures used for registers are described in proc(5) and their definitions may be found in <procfs.h>. The definitions of these structures varies based on the architecture of the system and the running process.

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.

The (), (), (), and () functions behave in a same way as the corresponding process-handle specific functions, with the following differences:

Upon successful completion, the Plwp_getregs(), Plwp_setregs(), Plwp_getfpregs(), Plwp_setfpregs(), Lgetfpregs(), Lsetfpregs(), Lgetregs(), and Lsetregs() functions return and obtain or set the register state. Otherwise, is returned, errno is set to indicate the error, and the register state is not updated nor are the data pointers changed.

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 section in proc(5).

The Plwp_getregs(), Plwp_setregs(), Plwp_getfpregs(), and Plwp_setfpregs() will fail if:

The process handle P is not currently stopped.
There is no thread in P with id lwpid.
The Lgetfpregs(), Lsetfpregs(), Lgetregs(), and Lsetregs() will fail if:
The thread handle L is not currently stopped.

See in libproc(3LIB).

libproc(3LIB), proc(5)

January 19, 2023 OmniOS