1 .\" 2 .\" This file and its contents are supplied under the terms of the 3 .\" Common Development and Distribution License ("CDDL"), version 1.0. 4 .\" You may only use this file in accordance with the terms of version 5 .\" 1.0 of the CDDL. 6 .\" 7 .\" A full copy of the text of the CDDL should have accompanied this 8 .\" source. A copy of the CDDL is also available via the Internet at 9 .\" http://www.illumos.org/license/CDDL. 10 .\" 11 .\" 12 .\" Copyright 2015 Joyent, Inc. 13 .\" 14 .Dd May 11, 2016 15 .Dt PLWP_GETREGS 3PROC 16 .Os 17 .Sh NAME 18 .Nm Plwp_getfpregs , 19 .Nm Plwp_setfpregs , 20 .Nm Plwp_getregs , 21 .Nm Plwp_setregs 22 .Nd get and set thread registers 23 .Sh SYNOPSIS 24 .Lb libproc 25 .In libproc.h 26 .Ft int 27 .Fo Plwp_getfpregs 28 .Fa "struct ps_prochandle *P" 29 .Fa "lwpid_t lwpid" 30 .Fa "prfpregset_t *fpregs" 31 .Fc 32 .Ft int 33 .Fo Plwp_setfpregs 34 .Fa "struct ps_prochandle *P" 35 .Fa "lwpid_t lwpid" 36 .Fa "const prfpregset_t fpregs" 37 .Fc 38 .Ft int 39 .Fo Plwp_getregs 40 .Fa "struct ps_prochandle *P" 41 .Fa "lwpid_t lwpid" 42 .Fa "prpregset_t *gregs" 43 .Fc 44 .Ft int 45 .Fo Plwp_setregs 46 .Fa "struct ps_prochandle *P" 47 .Fa "lwpid_t lwpid" 48 .Fa "const prpregset_t gregs" 49 .Fc 50 .Sh DESCRIPTION 51 The 52 .Fn Plwp_getregs , 53 .Fn Plwp_setregs , 54 .Fn Plwp_getfpregs , 55 and 56 .Fn Plwp_setfpregs 57 functions allow one to get and set the general purpose and floating 58 point registers from the thread 59 .Fa lwpid 60 in the process handle 61 .Fa P . 62 .Pp 63 The 64 .Fn Plwp_getfpregs 65 function updates the structure pointed to by 66 .Fa fpregs 67 with the state and values of the floating point registers of the thread 68 specified by 69 .Fa lwpid . 70 .Pp 71 The 72 .Fn Plwp_setfpregs 73 function updates the floating point registers of the thread specified by 74 .Fa lwpid 75 to the register state contained in 76 .Fa fpregs . 77 .Pp 78 The 79 .Fn Plwp_getregs 80 function updates the structure pointed to by 81 .Fa gregs 82 with the state and values of the general purpose registers of the thread 83 specified by 84 .Fa lwpid. 85 .Pp 86 The 87 .Fn Plwp_setregs 88 function updates the general purpose registers of the thread specified 89 by 90 .Fa lwpid 91 to the register state contained in 92 .Fa gregs . 93 .Pp 94 Processes must be stopped before obtaining the register state of 95 individual threads. 96 Processes may be stopped with 97 .Xr Pstop 3PROC . 98 The structures used for registers are described in 99 .Xr proc 4 100 and their defintions may be found in 101 .In sys/regset.h . 102 The definitions of these structures varies based on the architecture of 103 the system and the running process. 104 .Pp 105 One may not set the register values of a process that is not an active 106 process, e.g. a process handle that refers to a file or a core file. 107 .Sh RETURN VALUES 108 Upon successful completion, the 109 .Fn Plwp_getregs , 110 .Fn Plwp_setregs , 111 .Fn Plwp_getfpregs , 112 and 113 .Fn Plwp_setfpregs 114 functions return 115 .Sy 0 116 and obtain or set the register state. 117 Otherwise, 118 .Sy -1 119 is returned, 120 .Sy errno 121 is set to indicate the error, and the register state is not updated nor 122 are the data pointers changed. 123 .Sh ERRORS 124 For a full list of possible errors also see the 125 .Sy DIAGNOSTICS 126 section in 127 .Xr proc 4 . 128 .Pp 129 The 130 .Fn Plwp_getregs , 131 .Fn Plwp_setregs , 132 .Fn Plwp_getfpregs , 133 and 134 .Fn Plwp_setfpregs 135 will fail if: 136 .Bl -tag -width Er 137 .It Er EBUSY 138 The process handle 139 .Fa P 140 is not currently stopped. 141 .It Er ENOENT 142 There is no thread in 143 .Fa P 144 with id 145 .Fa lwpid . 146 .El 147 .Sh INTERFACE STABILITY 148 .Sy Uncommitted 149 .Sh MT-LEVEL 150 See 151 .Sy LOCKING 152 in 153 .Xr libproc 3LIB . 154 .Sh SEE ALSO 155 .Xr libproc 3LIB , 156 .Xr proc 4