1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   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 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 /*
  33  * Instruction Set Architecture specific component of <sys/procfs.h>
  34  * i386 version
  35  */
  36 
  37 #include <sys/regset.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 /*
  44  * Possible values of pr_dmodel.
  45  * This isn't isa-specific, but it needs to be defined here for other reasons.
  46  */
  47 #define PR_MODEL_UNKNOWN 0
  48 #define PR_MODEL_ILP32  1       /* process data model is ILP32 */
  49 #define PR_MODEL_LP64   2       /* process data model is LP64 */
  50 
  51 /*
  52  * To determine whether application is running native.
  53  */
  54 #if defined(_LP64)
  55 #define PR_MODEL_NATIVE PR_MODEL_LP64
  56 #elif defined(_ILP32)
  57 #define PR_MODEL_NATIVE PR_MODEL_ILP32
  58 #else
  59 #error "No DATAMODEL_NATIVE specified"
  60 #endif  /* _LP64 || _ILP32 */
  61 
  62 #if defined(__i386) || defined(__amd64)
  63 /*
  64  * Holds one i386 or amd64 instruction
  65  */
  66 typedef uchar_t instr_t;
  67 #endif
  68 
  69 #define NPRGREG         _NGREG
  70 #define prgreg_t        greg_t
  71 #define prgregset_t     gregset_t
  72 #define prfpregset      fpu
  73 #define prfpregset_t    fpregset_t
  74 
  75 #if defined(_SYSCALL32)
  76 /*
  77  * kernel view of the ia32 register set
  78  */
  79 typedef uchar_t         instr32_t;
  80 #if defined(__amd64)
  81 #define NPRGREG32       _NGREG32
  82 #define prgreg32_t      greg32_t
  83 #define prgregset32_t   gregset32_t
  84 #define prfpregset32    fpu32
  85 #define prfpregset32_t  fpregset32_t
  86 #else
  87 #define NPRGREG32       _NGREG
  88 #define prgreg32_t      greg_t
  89 #define prgregset32_t   gregset_t
  90 #define prfpregset32    fpu
  91 #define prfpregset32_t  fpregset_t
  92 #endif
  93 #endif  /* _SYSCALL32 */
  94 
  95 #if defined(__amd64)
  96 /*
  97  * The following defines are for portability (see <sys/regset.h>).
  98  */
  99 #define R_PC    REG_RIP
 100 #define R_PS    REG_RFL
 101 #define R_SP    REG_RSP
 102 #define R_FP    REG_RBP
 103 #define R_R0    REG_RAX
 104 #define R_R1    REG_RDX
 105 #elif defined(__i386)
 106 /*
 107  * The following defines are for portability (see <sys/regset.h>).
 108  */
 109 #define R_PC    EIP
 110 #define R_PS    EFL
 111 #define R_SP    UESP
 112 #define R_FP    EBP
 113 #define R_R0    EAX
 114 #define R_R1    EDX
 115 #endif
 116 
 117 #ifdef  __cplusplus
 118 }
 119 #endif
 120 
 121 #endif  /* _SYS_PROCFS_ISA_H */