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/uts/intel/sys/procfs_isa.h
          +++ new/usr/src/uts/intel/sys/procfs_isa.h
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
  23   23   * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
       27 +/*
       28 + * Copyright 2023 Oxide Computer Company
       29 + */
       30 +
  27   31  #ifndef _SYS_PROCFS_ISA_H
  28   32  #define _SYS_PROCFS_ISA_H
  29   33  
  30   34  /*
  31   35   * Instruction Set Architecture specific component of <sys/procfs.h>
  32   36   * i386 version
  33   37   */
  34   38  
  35   39  #include <sys/regset.h>
  36   40  
↓ open down ↓ 68 lines elided ↑ open up ↑
 105  109   * The following defines are for portability (see <sys/regset.h>).
 106  110   */
 107  111  #define R_PC    EIP
 108  112  #define R_PS    EFL
 109  113  #define R_SP    UESP
 110  114  #define R_FP    EBP
 111  115  #define R_R0    EAX
 112  116  #define R_R1    EDX
 113  117  #endif
 114  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 +
 115  254  #ifdef  __cplusplus
 116  255  }
 117  256  #endif
 118  257  
 119  258  #endif  /* _SYS_PROCFS_ISA_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX