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
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/man/man3proc/Plwp_getxregs.3proc
+++ new/usr/src/man/man3proc/Plwp_getxregs.3proc
1 1 .\"
2 2 .\" This file and its contents are supplied under the terms of the
|
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
3 3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 4 .\" You may only use this file in accordance with the terms of version
5 5 .\" 1.0 of the CDDL.
6 6 .\"
7 7 .\" A full copy of the text of the CDDL should have accompanied this
8 8 .\" source. A copy of the CDDL is also available via the Internet at
9 9 .\" http://www.illumos.org/license/CDDL.
10 10 .\"
11 11 .\"
12 12 .\" Copyright 2015 Joyent, Inc.
13 +.\" Copyright 2023 Oxide Computer Company
13 14 .\"
14 -.Dd May 11, 2016
15 +.Dd January 19, 2023
15 16 .Dt PLWP_GETXREGS 3PROC
16 17 .Os
17 18 .Sh NAME
18 19 .Nm Plwp_getxregs ,
19 -.Nm Plwp_setxregs
20 +.Nm Plwp_freexregs ,
21 +.Nm Plwp_setxregs ,
22 +.Nm Lgetxregs ,
23 +.Nm Lsetxregs
20 24 .Nd get and set extended register state
21 25 .Sh LIBRARY
22 26 .Lb libproc
23 27 .Sh SYNOPSIS
24 28 .In libproc.h
25 29 .Ft int
26 30 .Fo Plwp_getxregs
27 31 .Fa "struct ps_prochandle *P"
28 32 .Fa "lwpid_t lwpid"
33 +.Fa "prxregset_t **xregsp"
34 +.Fa "size_t *sizep"
35 +.Fc
36 +.Ft int
37 +.Fo Plwp_freexregs
38 +.Fa "struct ps_prochandle *P"
39 +.Fa "lwpid_t lwpid"
29 40 .Fa "prxregset_t *xregs"
41 +.Fa "size_t size"
30 42 .Fc
31 43 .Ft int
32 44 .Fo Plwp_setxregs
33 45 .Fa "struct ps_prochandle *P"
34 46 .Fa "lwpid_t lwpid"
35 47 .Fa "const prxregset_t *xregs"
36 48 .Fc
49 +.Ft int
50 +.Fo Lgetxregs
51 +.Fa "struct ps_lwphandle *L"
52 +.Fa "prxregset_t **xregsp"
53 +.Fa "size_t *sizep"
54 +.Fc
55 +.Ft int
56 +.Fo Lsetxregs
57 +.Fa "struct ps_lwphandle *L"
58 +.Fa "const prxregset_t *xregs"
59 +.Fc
37 60 .Sh DESCRIPTION
38 61 The
39 62 .Fn Plwp_getxregs
40 63 and
41 64 .Fn Plwp_setxregs
42 65 functions get and set the extended register state of the thread
43 66 .Fa lwpid
44 67 in the process handle
45 68 .Fa P .
46 69 .Pp
47 70 The extended register state is defined by the architecture.
48 71 These registers may refer to optional registers that have become common on the
49 -platform, but are not part of the standard ABI and thus not covered by
72 +platform, but are not part of the traditional ABI and thus not covered by
50 73 functions such as
51 74 .Xr Plwp_getregs 3PROC
52 75 and
53 76 .Xr Plwp_getfpregs 3PROC .
77 +Support for the extended registers varies based on the architecture and
78 +varies based on the specific system.
79 +For example, on x86 based CPUs the xregs functionality requires the x86
80 +xsave functionality to be supported.
54 81 .Pp
55 82 The
56 83 .Fn Plwp_getxregs
57 -function gets the extended register state information and places it into
58 -.Fa xregs .
59 -Where as the
84 +function gets the extended register state information, allocates the
85 +appropriate sized buffer for it, and places a pointer to that buffer
86 +into
87 +.Fa xregs
88 +and updates
89 +.Fa sizep
90 +to indicate the size of the allocated structure.
91 +Due to the fact that hardware has varying sized extended register sets,
92 +the exact size of the structure can vary between different running
93 +systems and core files.
94 +It is also possible that some processor extensions are enabled at
95 +process runtime, leading for this to further be different between
96 +different processes on the same system.
97 +As such, all of the different platform instantiations of the
98 +.Vt prxregset_t
99 +end up generally being opaque structures that can be cast to something
100 +more specific that also includes its size.
101 +.Pp
102 +The obtained
103 +.Vt prxregset_t
104 +in
105 +.Fa xregsp
106 +must be freed by the caller with the
107 +.Fn Plwp_freexregs
108 +function.
109 +.Pp
110 +The
60 111 .Fn Plwp_setxregs
61 112 function sets the extended register state information in
62 113 .Fa xregs
63 114 for the process handle
64 115 .Fa P .
65 116 .Pp
66 117 Processes must be stopped prior to obtaining the register state of
67 118 individual threads.
68 119 Processes may be stopped with
69 120 .Xr Pstop 3PROC .
70 121 .Pp
71 122 The
72 123 .Sy prxregset_t
73 124 structure is described in
74 125 .Xr proc 5 .
75 126 .Pp
76 127 One may not set the register values of a process that is not an active
77 128 process, e.g. a process handle that refers to a file or a core file.
129 +.Pp
130 +The
131 +.Fn Lgetxregs
132 +and
133 +.Fn Lsetxregs
134 +functions are equivalent to the
135 +.Fn Plwp_getxregs
136 +and
137 +.Fn Plwp_setxregs
138 +functions except that they operate on a specific thread identified by
139 +the handle
140 +.Fa L
141 +and only require that the thread in question be stopped.
142 +Data allocated with the
143 +.Fn Lgetxregs
144 +functions should be freed with the
145 +.Fn Plwp_freexregs
146 +function.
78 147 .Sh RETURN VALUES
79 148 Upon successful completion, the
80 149 .Fn Plwp_getxregs
81 150 and
82 151 .Fn Plwp_setxregs
83 152 functions return
84 153 .Sy 0
85 154 and get or set the register state.
86 155 Otherwise,
87 156 .Sy -1
88 157 is returned and
89 158 .Sy errno
90 159 is set to indicate the error.
91 160 .Sh ERRORS
92 161 For a full list of possible errors see the
93 162 .Sy DIAGNOSTICS
94 163 section in
95 164 .Xr proc 5 .
96 165 .Pp
|
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
97 166 The
98 167 .Fn Plwp_getxregs
99 168 and
100 169 .Fn Plwp_setxregs
101 170 function will fail if:
102 171 .Bl -tag -width Er
103 172 .It Er ENODATA
104 173 The process handle
105 174 .Fa P
106 175 does not have any extended register state information.
176 +This generally happens because the platform does not support it.
107 177 .It Er EBUSY
108 178 The process handle
109 179 .Fa P
110 180 refers to a live process and it is not stopped.
111 181 .It Er ENOENT
112 -The process handle
113 -.Fa P
114 -refers to a live process and there is no thread with id
115 -.Fa lwpid .
116 -.It Er EINVAL
117 -The process handle
118 -.Fa P
119 -refers to a core file and there is no thread with id
120 -.Fa lwpid .
182 +There is no thread with id
183 +.Fa lwpid
184 +in the process handle
185 +.Fa P .
121 186 .El
122 -.Sh ARCHITECTURE
123 187 The
124 -.Fn Plwp_getxregs
188 +.Fn Lgetxregs
125 189 and
126 -.Fn Plwp_setxregs
127 -functions are only available on
128 -.Sy SPARC
129 -platforms.
190 +.Fn Lsetxregs
191 +function will fail if:
192 +.Bl -tag -width Er
193 +.It Er ENODATA
194 +The thread handle
195 +.Fa L
196 +does not have any extended register state information.
197 +This generally happens because the platform does not support it.
198 +.It Er EBUSY
199 +The thread handle
200 +.Fa L
201 +refers to a live process and the thread is not stopped.
202 +.El
130 203 .Sh INTERFACE STABILITY
131 204 .Sy Uncommitted
132 205 .Sh MT-LEVEL
133 206 See
134 207 .Sy LOCKING
135 208 in
136 209 .Xr libproc 3LIB .
137 210 .Sh SEE ALSO
138 211 .Xr libproc 3LIB ,
139 212 .Xr Plwp_getfpregs 3PROC ,
140 213 .Xr Plwp_getregs 3PROC ,
141 214 .Xr Plwp_setfpregs 3PROC ,
142 215 .Xr Plwp_setregs 3PROC ,
143 216 .Xr Pstop 3PROC ,
144 217 .Xr proc 5
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX