1 .\"
   2 .\"  Copyright (c) 1998 Sun Microsystems, Inc.  All Rights Reserved
   3 .\" 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.
   4 .\" 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.
   5 .\" 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]
   6 .\" Copyright 2023 Oxide Computer Company
   7 .Dd January 23, 2023
   8 .Dt TD_THR_GETGREGS 3C_DB
   9 .Os
  10 .Sh NAME
  11 .Nm td_thr_getgregs ,
  12 .Nm td_thr_setgregs ,
  13 .Nm td_thr_getfpregs ,
  14 .Nm td_thr_setfpregs ,
  15 .Nm td_thr_getxregsize ,
  16 .Nm td_thr_getxregs ,
  17 .Nm td_thr_setxregs
  18 .Nd reading and writing thread registers in libc_db
  19 .Sh LIBRARY
  20 .Lb libc_db
  21 .Sh SYNOPSIS
  22 .In proc_service.h
  23 .In thread_db.h
  24 .Ft td_err_e
  25 .Fo td_thr_getgregs
  26 .Fa "const td_thrhandle_t *th_p"
  27 .Fa "prgregset_t gregset"
  28 .Fc
  29 .Ft td_err_e
  30 .Fo td_thr_setgregs
  31 .Fa "const td_thrhandle_t *th_p"
  32 .Fa "prgregset_t gregset"
  33 .Fc
  34 .Ft td_err_e
  35 .Fo td_thr_getfpregs
  36 .Fa "const td_thrhandle_t *th_p"
  37 .Fa "prfpregset_t *fpregset"
  38 .Fc
  39 .Ft td_err_e
  40 .Fo td_thr_setfpregs
  41 .Fa "const td_thrhandle_t *th_p"
  42 .Fa "prfpregset_t *fpregset"
  43 .Fc
  44 .Ft td_err_e
  45 .Fo td_thr_getxregsize
  46 .Fa "const td_thrhandle_t *th_p"
  47 .Fa "int *xregsize"
  48 .Fc
  49 .Ft td_err_e
  50 .Fo td_thr_getxregs
  51 .Fa "const td_thrhandle_t *th_p"
  52 .Fa "prxregset_t *xregset"
  53 .Fc
  54 .Ft td_err_e
  55 .Fo td_thr_setxregs
  56 .Fa "const td_thrhandle_t *th_p"
  57 .Fa "prxregset_t *xregset"
  58 .Fc
  59 .Sh DESCRIPTION
  60 These functions read and write the register sets associated with thread
  61 .Fa th_p .
  62 The
  63 .Fn td_thr_getgregs
  64 and
  65 .Fn td_thr_setgregs
  66 functions get and set, respectively, the general registers of thread
  67 .Fa th_p .
  68 The
  69 .Fn td_thr_getfpregs
  70 and
  71 .Fn td_thr_setfpregs
  72 functions get and set, respectively, the thread's floating point register set.
  73 .Pp
  74 The
  75 .Fn td_thr_getxregsize
  76 function returns in
  77 .Fa *xregsize
  78 the size of the
  79 architecture-dependent extra state registers.
  80 The
  81 .Fn td_thr_getxregs
  82 and
  83 .Fn td_thr_setxregs
  84 functions get and set, respectively, those extra state registers.
  85 The buffer passed to
  86 .Fn td_thr_getxregs
  87 must be at least the size indicated by
  88 .Fn td_thr_getxregsize .
  89 This size must not be assumed and may change between processes.
  90 Failure to do so, will result in the system overwriting memory.
  91 Not all platforms implement extended registers.
  92 When they are not implemented, these functions return
  93 .Dv TD_NOXREGS .
  94 .Sh RETURN VALUES
  95 The
  96 .Fn td_thr_getgregs ,
  97 .Fn td_thr_setgregs ,
  98 .Fn td_thr_getfpregs ,
  99 .Fn td_thr_setfpregs ,
 100 .Fn td_thr_getxregsize ,
 101 .Fn td_thr_getxregs ,
 102 and
 103 .Fn td_thr_setxregs
 104 functions return one of the following values:
 105 .Bl -tag -width Ds
 106 .It Dv TD_OK
 107 The call completed successfully.
 108 .It Dv TD_BADTH
 109 An invalid thread handle was passed in.
 110 .It Dv TD_DBERR
 111 A call to one of the imported interface routines failed.
 112 .It Dv TD_NOFPREGS
 113 Floating point registers could not be read or written because the architecture
 114 does not have such registers.
 115 .It Dv TD_NOXREGS
 116 Architecture-dependent extra state registers could not be read or written,
 117 because the architecture does not have such registers.
 118 .It Dv TD_ERR
 119 A
 120 .Sy libc_db
 121 internal error occurred.
 122 .El
 123 .Sh MT-LEVEL
 124 .Sy Safe
 125 .Sh SEE ALSO
 126 .Xr libc_db 3LIB ,
 127 .Xr attributes 7