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


   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 




  27 #ifndef _SYS_PROCFS_ISA_H
  28 #define _SYS_PROCFS_ISA_H
  29 
  30 /*
  31  * Instruction Set Architecture specific component of <sys/procfs.h>
  32  * i386 version
  33  */
  34 
  35 #include <sys/regset.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 /*
  42  * Possible values of pr_dmodel.
  43  * This isn't isa-specific, but it needs to be defined here for other reasons.
  44  */
  45 #define PR_MODEL_UNKNOWN 0
  46 #define PR_MODEL_ILP32  1       /* process data model is ILP32 */


  95  * The following defines are for portability (see <sys/regset.h>).
  96  */
  97 #define R_PC    REG_RIP
  98 #define R_PS    REG_RFL
  99 #define R_SP    REG_RSP
 100 #define R_FP    REG_RBP
 101 #define R_R0    REG_RAX
 102 #define R_R1    REG_RDX
 103 #elif defined(__i386)
 104 /*
 105  * The following defines are for portability (see <sys/regset.h>).
 106  */
 107 #define R_PC    EIP
 108 #define R_PS    EFL
 109 #define R_SP    UESP
 110 #define R_FP    EBP
 111 #define R_R0    EAX
 112 #define R_R1    EDX
 113 #endif
 114 







































































































































 115 #ifdef  __cplusplus
 116 }
 117 #endif
 118 
 119 #endif  /* _SYS_PROCFS_ISA_H */


   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright 2023 Oxide Computer Company
  29  */
  30 
  31 #ifndef _SYS_PROCFS_ISA_H
  32 #define _SYS_PROCFS_ISA_H
  33 
  34 /*
  35  * Instruction Set Architecture specific component of <sys/procfs.h>
  36  * i386 version
  37  */
  38 
  39 #include <sys/regset.h>
  40 
  41 #ifdef  __cplusplus
  42 extern "C" {
  43 #endif
  44 
  45 /*
  46  * Possible values of pr_dmodel.
  47  * This isn't isa-specific, but it needs to be defined here for other reasons.
  48  */
  49 #define PR_MODEL_UNKNOWN 0
  50 #define PR_MODEL_ILP32  1       /* process data model is ILP32 */


  99  * The following defines are for portability (see <sys/regset.h>).
 100  */
 101 #define R_PC    REG_RIP
 102 #define R_PS    REG_RFL
 103 #define R_SP    REG_RSP
 104 #define R_FP    REG_RBP
 105 #define R_R0    REG_RAX
 106 #define R_R1    REG_RDX
 107 #elif defined(__i386)
 108 /*
 109  * The following defines are for portability (see <sys/regset.h>).
 110  */
 111 #define R_PC    EIP
 112 #define R_PS    EFL
 113 #define R_SP    UESP
 114 #define R_FP    EBP
 115 #define R_R0    EAX
 116 #define R_R1    EDX
 117 #endif
 118 
 119 /*
 120  * The x86 xregs structure is a blob of data that contains a header with several
 121  * descriptors that describe the region of additional data that corresponds to
 122  * it. Effectively this looks like:
 123  *
 124  * 0  +-----------------+
 125  *    | prxregset_hdr_t |
 126  *    +-----------------+
 127  *    | Info 0 (XCR)    |-------+
 128  *    +-----------------+       |
 129  *    | Info 1 (XSAVE)  |----------+
 130  *    +-----------------+       |  |
 131  *           ...                |  |
 132  *    +-----------------+       |  |
 133  *    | Info n (Hi ZMM) |-------------+
 134  *    +-----------------+       |  |  |
 135  *    +-----------------+       |  |  |
 136  *    | prxregset_xcr_t |<------+  |  |
 137  *    +-----------------+          |  |
 138  *    +-------------------+        |  |
 139  *    | prxregset_xsave_t |<-------+  |
 140  *    |                   |           |
 141  *    | XMM + xsave       |           |
 142  *    +-------------------+           |
 143  *           ...                      |
 144  *    +---------------------+         |
 145  *    | prxregset_hi_zmm_t  |<--------+
 146  *    |                     |
 147  *    | 1 KiB %zmm16-%zmm31 |
 148  *    +---------------------+
 149  *
 150  * The actual structure size will vary based on the CPU features present. For
 151  * more information, see proc(5). When adding structures, please make sure all
 152  * structures are multiples of 16 bytes (0x10) so as to ensure alignment.
 153  */
 154 typedef struct prxregset prxregset_t;
 155 
 156 #define PRX_INFO_XCR    0x01
 157 #define PRX_INFO_XSAVE  0x02
 158 #define PRX_INFO_YMM    0x03
 159 #define PRX_INFO_OPMASK 0x04
 160 #define PRX_INFO_ZMM    0x05
 161 #define PRX_INFO_HI_ZMM 0x06
 162 
 163 typedef struct prxregset_info {
 164         uint32_t pri_type;
 165         uint32_t pri_flags;
 166         uint32_t pri_size;
 167         uint32_t pri_offset;
 168 } prxregset_info_t;
 169 
 170 #define PR_TYPE_XSAVE   0x01
 171 
 172 typedef struct prxregset_hdr {
 173         uint32_t        pr_type;
 174         uint32_t        pr_size;
 175         uint32_t        pr_flags;
 176         uint32_t        pr_pad[4];
 177         uint32_t        pr_ninfo;
 178 #if defined(_STDC_C99) || defined(__C99FEATURES__)
 179         prxregset_info_t pr_info[];
 180 #endif
 181 } prxregset_hdr_t;
 182 
 183 typedef struct prxregset_xcr {
 184         uint64_t        prx_xcr_xcr0;
 185         uint64_t        prx_xcr_xfd;
 186         uint64_t        prx_xcr_pad[2];
 187 } prxregset_xcr_t;
 188 
 189 typedef struct prxregset_xsave {
 190         uint16_t        prx_fx_fcw;
 191         uint16_t        prx_fx_fsw;
 192         uint16_t        prx_fx_fctw;    /* compressed tag word */
 193         uint16_t        prx_fx_fop;
 194 #if defined(__amd64)
 195         uint64_t        prx_fx_rip;
 196         uint64_t        prx_fx_rdp;
 197 #else
 198         uint32_t        prx_fx_eip;
 199         uint16_t        prx_fx_cs;
 200         uint16_t        __prx_fx_ign0;
 201         uint32_t        prx_fx_dp;
 202         uint16_t        prx_fx_ds;
 203         uint16_t        __prx_fx_ign1;
 204 #endif
 205         uint32_t        prx_fx_mxcsr;
 206         uint32_t        prx_fx_mxcsr_mask;
 207         union {
 208                 uint16_t prx_fpr_16[5]; /* 80-bits of x87 state */
 209                 u_longlong_t prx_fpr_mmx;       /* 64-bit mmx register */
 210                 uint32_t _prx__fpr_pad[4];      /* (pad out to 128-bits) */
 211         } fx_st[8];
 212 #if defined(__amd64)
 213         upad128_t       prx_fx_xmm[16]; /* 128-bit registers */
 214         upad128_t       __prx_fx_ign2[6];
 215 #else
 216         upad128_t       prx_fx_xmm[8];  /* 128-bit registers */
 217         upad128_t       __prx_fx_ign2[14];
 218 #endif
 219         uint64_t        prx_xsh_xstate_bv;
 220         uint64_t        prx_xsh_xcomp_bv;
 221         uint64_t        prx_xsh_reserved[6];
 222 } prxregset_xsave_t;
 223 
 224 typedef struct prxregset_ymm {
 225 #if defined(__amd64)
 226         upad128_t       prx_ymm[16];
 227 #else
 228         upad128_t       prx_ymm[8];
 229         upad128_t       prx_rsvd[8];
 230 #endif
 231 } prxregset_ymm_t;
 232 
 233 typedef struct prxregset_opmask {
 234         uint64_t        prx_opmask[8];
 235 } prxregset_opmask_t;
 236 
 237 typedef struct prxregset_zmm {
 238 #if defined(__amd64)
 239         upad256_t       prx_zmm[16];
 240 #else
 241         upad256_t       prx_zmm[8];
 242         upad256_t       prx_rsvd[8];
 243 #endif
 244 } prxregset_zmm_t;
 245 
 246 typedef struct prxregset_hi_zmm {
 247 #if defined(__amd64)
 248         upad512_t       prx_hi_zmm[16];
 249 #else
 250         upad512_t       prx_rsvd[16];
 251 #endif
 252 } prxregset_hi_zmm_t;
 253 
 254 #ifdef  __cplusplus
 255 }
 256 #endif
 257 
 258 #endif  /* _SYS_PROCFS_ISA_H */