12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28
29 /*
30 * Copyright 2019 Joyent, Inc.
31 * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
32 */
33
34 #ifndef _SYS_PROC_PRDATA_H
35 #define _SYS_PROC_PRDATA_H
36
37 #include <sys/isa_defs.h>
38 #include <sys/proc.h>
39 #include <sys/vnode.h>
40 #include <sys/prsystm.h>
41 #include <sys/model.h>
42 #include <sys/poll.h>
43 #include <sys/list.h>
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49 /*
50 * Test for thread being stopped, not on an event of interest,
51 * but with a directed stop in effect.
392 * Machine-dependent routines (defined in prmachdep.c).
393 */
394 extern void prgetprregs(klwp_t *, prgregset_t);
395 extern void prsetprregs(klwp_t *, prgregset_t, int);
396
397 #if defined(_SYSCALL32_IMPL)
398 extern void prgetprregs32(klwp_t *, prgregset32_t);
399 extern void prgregset_32ton(klwp_t *, prgregset32_t, prgregset_t);
400 extern void prgetprfpregs32(klwp_t *, prfpregset32_t *);
401 extern void prsetprfpregs32(klwp_t *, prfpregset32_t *);
402 extern size_t prpdsize32(struct as *);
403 extern int prpdread32(proc_t *, uint_t, struct uio *);
404 extern size_t oprpdsize32(struct as *);
405 extern int oprpdread32(struct as *, uint_t, struct uio *);
406 #endif /* _SYSCALL32_IMPL */
407
408 extern void prpokethread(kthread_t *t);
409 extern int prgetrvals(klwp_t *, long *, long *);
410 extern void prgetprfpregs(klwp_t *, prfpregset_t *);
411 extern void prsetprfpregs(klwp_t *, prfpregset_t *);
412 extern void prgetprxregs(klwp_t *, caddr_t);
413 extern void prsetprxregs(klwp_t *, caddr_t);
414 extern int prgetprxregsize(proc_t *);
415 extern int prhasfp(void);
416 extern int prhasx(proc_t *);
417 extern caddr_t prgetstackbase(proc_t *);
418 extern caddr_t prgetpsaddr(proc_t *);
419 extern int prisstep(klwp_t *);
420 extern void prsvaddr(klwp_t *, caddr_t);
421 extern int prfetchinstr(klwp_t *, ulong_t *);
422 extern ushort_t prgetpctcpu(uint64_t);
423
424 #endif /* _KERNEL */
425
426 #ifdef __cplusplus
427 }
428 #endif
429
430 #endif /* _SYS_PROC_PRDATA_H */
|
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28
29 /*
30 * Copyright 2019 Joyent, Inc.
31 * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
32 * Copyright 2023 Oxide Computer Company
33 */
34
35 #ifndef _SYS_PROC_PRDATA_H
36 #define _SYS_PROC_PRDATA_H
37
38 #include <sys/isa_defs.h>
39 #include <sys/proc.h>
40 #include <sys/vnode.h>
41 #include <sys/prsystm.h>
42 #include <sys/model.h>
43 #include <sys/poll.h>
44 #include <sys/list.h>
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 /*
51 * Test for thread being stopped, not on an event of interest,
52 * but with a directed stop in effect.
393 * Machine-dependent routines (defined in prmachdep.c).
394 */
395 extern void prgetprregs(klwp_t *, prgregset_t);
396 extern void prsetprregs(klwp_t *, prgregset_t, int);
397
398 #if defined(_SYSCALL32_IMPL)
399 extern void prgetprregs32(klwp_t *, prgregset32_t);
400 extern void prgregset_32ton(klwp_t *, prgregset32_t, prgregset_t);
401 extern void prgetprfpregs32(klwp_t *, prfpregset32_t *);
402 extern void prsetprfpregs32(klwp_t *, prfpregset32_t *);
403 extern size_t prpdsize32(struct as *);
404 extern int prpdread32(proc_t *, uint_t, struct uio *);
405 extern size_t oprpdsize32(struct as *);
406 extern int oprpdread32(struct as *, uint_t, struct uio *);
407 #endif /* _SYSCALL32_IMPL */
408
409 extern void prpokethread(kthread_t *t);
410 extern int prgetrvals(klwp_t *, long *, long *);
411 extern void prgetprfpregs(klwp_t *, prfpregset_t *);
412 extern void prsetprfpregs(klwp_t *, prfpregset_t *);
413 extern int prhasfp(void);
414 extern caddr_t prgetstackbase(proc_t *);
415 extern caddr_t prgetpsaddr(proc_t *);
416 extern int prisstep(klwp_t *);
417 extern void prsvaddr(klwp_t *, caddr_t);
418 extern int prfetchinstr(klwp_t *, ulong_t *);
419 extern ushort_t prgetpctcpu(uint64_t);
420
421 /*
422 * This set of routines is used by platforms to implement support for the
423 * 'xregs' or extended registers in /proc. Unlike other registers which
424 * generally have a well-defined value determined by the ABI that never changes,
425 * we expect these to change.
426 *
427 * An important thing to note is that you'll see we have moved away from a
428 * traditional version of a fixed size, non-opaque definition of the
429 * prxregset_t. This is because the size varies and we don't want applications
430 * to incorrectly bake a real definition in and cause problems where extending
431 * it becomes very hard to do (ala the prgregset_t and prfregset_t). This is a
432 * little more work for everyone implementing it, but it does ensure that we are
433 * generally in better shape.
434 *
435 * Here are the semantics of what these are required * to do and how the fit
436 * together:
437 *
438 * o prhasx Determine if the process in question supports the
439 * extended register sets. Note, this is may be a
440 * process-specific setting due to things like whether or
441 * not the FPU is enabled or other things.
442 *
443 * o prgetxregsize This returns the size of the actual xregs file for a
444 * given process. This may change between processes because
445 * not every process may have the same set of extended
446 * features enabled (e.g. AMX on x86).
447 *
448 * o prwriteminxreg This is used by the prwritectl() and related worlds to
449 * determine the minimum amount of data that much be
450 * present to determine if the actual size of a write is
451 * valid. If xregs is not supported, then this should
452 * return B_FALSE.
453 *
454 * o prwritesizexreg This is meant to indicate how much data is required to
455 * be copied in for a given xregs write. The base data will
456 * already be present from having called prwriteminxreg
457 * previously. If xregs are not supported this should
458 * return B_FALSE.
459 *
460 * There is a wrinkle in this which is not true of other
461 * callers. The data that we are given is not guaranteed to
462 * be aligned in the slightest due to the need to support
463 * both ILP32 and LP64!
464 *
465 * o prgetprxregs This is a request to fill in the xregs data. Right now
466 * the system guarantees that the buffer size is at least
467 * the result of the prgetprxregs() call for this process.
468 * Callers may assume that the process remains locked
469 * between the two so that the size doesn't change.
470 *
471 * o prsetprxregs This is a request to set the xregs data. The only
472 * assumption that should be made is that the validation of
473 * the size has been done in prvalidpcsxreg() as been
474 * performed. Users can and will potentially try to trick
475 * us with invalid values. Do not blindly apply this unless
476 * there is something that is impossible about that, but
477 * given that our recommendations for this are variable
478 * width data, that should not happen.
479 *
480 * If xregs are not supported this should return EINVAL.
481 * While yes other errnos may make more sense, that is what
482 * we have always returned in /proc for this case.
483 */
484 extern int prhasx(proc_t *);
485 extern size_t prgetprxregsize(proc_t *);
486 extern void prgetprxregs(klwp_t *, prxregset_t *);
487 extern boolean_t prwriteminxreg(size_t *);
488 extern boolean_t prwritesizexreg(const void *, size_t *);
489 extern int prsetprxregs(klwp_t *, prxregset_t *);
490
491 #endif /* _KERNEL */
492
493 #ifdef __cplusplus
494 }
495 #endif
496
497 #endif /* _SYS_PROC_PRDATA_H */
|