xref: /illumos-gate/usr/src/man/man3proc/ps_lgetregs.3proc (revision 9164a50bf932130cbb5097a16f6986873ce0e6e5)
te
Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
Copyright 2023 Oxide Computer Company
PS_LGETREGS 3PROC "January 23, 2023"
NAME
ps_lgetregs, ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs, ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs - routines that access the target process register in libthread_db
SYNOPSIS
#include <proc_service.h>

ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid,
 prgregset_t gregset);

ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid,
 static prgregset_t gregset);

ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lid,
 prfpregset_t *fpregs);

ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid,
 static prfpregset_t *fpregs);

ps_err_e ps_lgetxregsize(struct ps_prochandle *ph, lwpid_t lid,
 int *xregsize);

ps_err_e ps_lgetxregs(struct ps_prochandle *ph, lwpid_t lid,
 caddr_t xregset);

ps_err_e ps_lsetxregs(struct ps_prochandle *ph, lwpid_t lid,
 caddr_t xregset);
DESCRIPTION
ps_lgetregs(), ps_lsetregs(), ps_lgetfpregs(), ps_lsetfpregs(), ps_lgetxregsize(), ps_lgetxregs(), ps_lsetxregs() read and write register sets from lightweight processes (LWPs) within the target process identified by ph. ps_lgetregs() gets the general registers of the LWP identified by lid, and ps_lsetregs() sets them. ps_lgetfpregs() gets the LWP's floating point register set, while ps_lsetfpregs() sets it.

ps_lgetxregsize(), ps_lgetxregs(), and ps_lsetxregs() are used to get and set the extended register set. Support for an extended register set depends on both the instruction-set architecture and the specific CPU (e.g. while x86 supports xregs, their availability depends on the CPU's support for the xsave feature set). On platforms without support for these, controlling processes will still need to define them; however, they are allowed to simply return errors.

ps_lgetxregsize() returns in *xregsize the size of the architecture-dependent extra state registers. ps_lgetxregs() gets the extra state registers, and ps_lsetxregs() sets them. When getting the registers, the size of xregset must be at least the size returned by ps_lgetxregsize().

RETURN VALUES
PS_OK

The call returned successfully.

PS_NOFREGS

Floating point registers are neither available for this architecture nor for this process.

PS_NOXREGS

Extra state registers are not available on this architecture.

PS_ERR

The function did not return successfully.

ATTRIBUTES
See attributes(7) for description of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE
MT Level Safe
SEE ALSO
libc_db (3LIB), proc_service (3PROC), attributes (7), threads (7)