17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright (c) 1996-1998 by Sun Microsystems, Inc. 247c478bd9Sstevel@tonic-gate * All rights reserved. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_PROCFS_ISA_H 287c478bd9Sstevel@tonic-gate #define _SYS_PROCFS_ISA_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate /* 317c478bd9Sstevel@tonic-gate * Instruction Set Architecture specific component of <sys/procfs.h> 327c478bd9Sstevel@tonic-gate * sparc v8/v9 version 337c478bd9Sstevel@tonic-gate */ 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/regset.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 387c478bd9Sstevel@tonic-gate extern "C" { 397c478bd9Sstevel@tonic-gate #endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * Possible values of pr_dmodel. 437c478bd9Sstevel@tonic-gate * This isn't isa-specific, but it needs to be defined here for other reasons. 447c478bd9Sstevel@tonic-gate */ 457c478bd9Sstevel@tonic-gate #define PR_MODEL_UNKNOWN 0 467c478bd9Sstevel@tonic-gate #define PR_MODEL_ILP32 1 /* process data model is ILP32 */ 477c478bd9Sstevel@tonic-gate #define PR_MODEL_LP64 2 /* process data model is LP64 */ 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* 507c478bd9Sstevel@tonic-gate * To determine whether application is running native. 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate #if defined(_LP64) 537c478bd9Sstevel@tonic-gate #define PR_MODEL_NATIVE PR_MODEL_LP64 547c478bd9Sstevel@tonic-gate #elif defined(_ILP32) 557c478bd9Sstevel@tonic-gate #define PR_MODEL_NATIVE PR_MODEL_ILP32 567c478bd9Sstevel@tonic-gate #else 577c478bd9Sstevel@tonic-gate #error "No DATAMODEL_NATIVE specified" 587c478bd9Sstevel@tonic-gate #endif /* _LP64 || _ILP32 */ 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate /* 617c478bd9Sstevel@tonic-gate * Holds one sparc instruction, for both ILP32 and LP64. 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate typedef uint32_t instr_t; 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* 667c478bd9Sstevel@tonic-gate * General register access (sparc). 677c478bd9Sstevel@tonic-gate * Don't confuse definitions here with definitions in <sys/regset.h>. 687c478bd9Sstevel@tonic-gate * Registers are 32 bits for ILP32, 64 bits for LP64. 697c478bd9Sstevel@tonic-gate */ 707c478bd9Sstevel@tonic-gate #define NPRGREG 38 717c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx) 727c478bd9Sstevel@tonic-gate typedef long prgreg_t; 737c478bd9Sstevel@tonic-gate #else 747c478bd9Sstevel@tonic-gate typedef int prgreg_t; 757c478bd9Sstevel@tonic-gate #endif 767c478bd9Sstevel@tonic-gate typedef prgreg_t prgregset_t[NPRGREG]; 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate #define R_G0 0 797c478bd9Sstevel@tonic-gate #define R_G1 1 807c478bd9Sstevel@tonic-gate #define R_G2 2 817c478bd9Sstevel@tonic-gate #define R_G3 3 827c478bd9Sstevel@tonic-gate #define R_G4 4 837c478bd9Sstevel@tonic-gate #define R_G5 5 847c478bd9Sstevel@tonic-gate #define R_G6 6 857c478bd9Sstevel@tonic-gate #define R_G7 7 867c478bd9Sstevel@tonic-gate #define R_O0 8 877c478bd9Sstevel@tonic-gate #define R_O1 9 887c478bd9Sstevel@tonic-gate #define R_O2 10 897c478bd9Sstevel@tonic-gate #define R_O3 11 907c478bd9Sstevel@tonic-gate #define R_O4 12 917c478bd9Sstevel@tonic-gate #define R_O5 13 927c478bd9Sstevel@tonic-gate #define R_O6 14 937c478bd9Sstevel@tonic-gate #define R_O7 15 947c478bd9Sstevel@tonic-gate #define R_L0 16 957c478bd9Sstevel@tonic-gate #define R_L1 17 967c478bd9Sstevel@tonic-gate #define R_L2 18 977c478bd9Sstevel@tonic-gate #define R_L3 19 987c478bd9Sstevel@tonic-gate #define R_L4 20 997c478bd9Sstevel@tonic-gate #define R_L5 21 1007c478bd9Sstevel@tonic-gate #define R_L6 22 1017c478bd9Sstevel@tonic-gate #define R_L7 23 1027c478bd9Sstevel@tonic-gate #define R_I0 24 1037c478bd9Sstevel@tonic-gate #define R_I1 25 1047c478bd9Sstevel@tonic-gate #define R_I2 26 1057c478bd9Sstevel@tonic-gate #define R_I3 27 1067c478bd9Sstevel@tonic-gate #define R_I4 28 1077c478bd9Sstevel@tonic-gate #define R_I5 29 1087c478bd9Sstevel@tonic-gate #define R_I6 30 1097c478bd9Sstevel@tonic-gate #define R_I7 31 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate #ifdef __sparcv9 1127c478bd9Sstevel@tonic-gate #define R_CCR 32 /* v9 condition code register */ 1137c478bd9Sstevel@tonic-gate #else 1147c478bd9Sstevel@tonic-gate #define R_PSR 32 /* v7/v8 processor status register */ 1157c478bd9Sstevel@tonic-gate #endif 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #define R_PC 33 1187c478bd9Sstevel@tonic-gate #define R_nPC 34 1197c478bd9Sstevel@tonic-gate #define R_Y 35 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate #ifdef __sparcv9 1227c478bd9Sstevel@tonic-gate #define R_ASI 36 1237c478bd9Sstevel@tonic-gate #define R_FPRS 37 1247c478bd9Sstevel@tonic-gate #else 1257c478bd9Sstevel@tonic-gate #define R_WIM 36 1267c478bd9Sstevel@tonic-gate #define R_TBR 37 1277c478bd9Sstevel@tonic-gate #endif 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* 1307c478bd9Sstevel@tonic-gate * The following defines are for portability. 1317c478bd9Sstevel@tonic-gate */ 1327c478bd9Sstevel@tonic-gate #ifdef __sparcv9 1337c478bd9Sstevel@tonic-gate #define R_PS R_CCR 1347c478bd9Sstevel@tonic-gate #else 1357c478bd9Sstevel@tonic-gate #define R_PS R_PSR 1367c478bd9Sstevel@tonic-gate #endif 1377c478bd9Sstevel@tonic-gate #define R_SP R_O6 1387c478bd9Sstevel@tonic-gate #define R_FP R_I6 1397c478bd9Sstevel@tonic-gate #define R_R0 R_O0 1407c478bd9Sstevel@tonic-gate #define R_R1 R_O1 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 1437c478bd9Sstevel@tonic-gate /* 1447c478bd9Sstevel@tonic-gate * kernel view of the _ILP32 register set 1457c478bd9Sstevel@tonic-gate */ 1467c478bd9Sstevel@tonic-gate typedef int32_t prgreg32_t; 1477c478bd9Sstevel@tonic-gate typedef prgreg32_t prgregset32_t[NPRGREG]; 1487c478bd9Sstevel@tonic-gate #define R_PSR 32 1497c478bd9Sstevel@tonic-gate #define R_WIM 36 1507c478bd9Sstevel@tonic-gate #define R_TBR 37 1517c478bd9Sstevel@tonic-gate #endif 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate /* 1547c478bd9Sstevel@tonic-gate * Floating-point register access (sparc FPU). 1557c478bd9Sstevel@tonic-gate * See <sys/regset.h> for details of interpretation. 1567c478bd9Sstevel@tonic-gate */ 1577c478bd9Sstevel@tonic-gate #ifdef __sparcv9 1587c478bd9Sstevel@tonic-gate typedef struct prfpregset { 1597c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 1607c478bd9Sstevel@tonic-gate uint32_t pr_regs[32]; /* 32 singles */ 1617c478bd9Sstevel@tonic-gate double pr_dregs[32]; /* 32 doubles */ 1627c478bd9Sstevel@tonic-gate long double pr_qregs[16]; /* 16 quads */ 1637c478bd9Sstevel@tonic-gate } pr_fr; 1647c478bd9Sstevel@tonic-gate uint64_t pr_filler; 1657c478bd9Sstevel@tonic-gate uint64_t pr_fsr; /* FPU status register */ 1667c478bd9Sstevel@tonic-gate uint8_t pr_qcnt; /* # of entries in saved FQ */ 1677c478bd9Sstevel@tonic-gate uint8_t pr_q_entrysize; /* # of bytes per FQ entry */ 1687c478bd9Sstevel@tonic-gate uint8_t pr_en; /* flag signifying fpu in use */ 1697c478bd9Sstevel@tonic-gate char pr_pad[13]; /* ensure sizeof(prfpregset)%16 == 0 */ 170*c5a5e6f4SGordon Ross struct _fq pr_q[16]; /* contains the FQ array */ 1717c478bd9Sstevel@tonic-gate } prfpregset_t; 1727c478bd9Sstevel@tonic-gate #else 1737c478bd9Sstevel@tonic-gate typedef struct prfpregset { 1747c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 1757c478bd9Sstevel@tonic-gate uint32_t pr_regs[32]; /* 32 singles */ 1767c478bd9Sstevel@tonic-gate double pr_dregs[16]; /* 16 doubles */ 1777c478bd9Sstevel@tonic-gate } pr_fr; 1787c478bd9Sstevel@tonic-gate uint32_t pr_filler; 1797c478bd9Sstevel@tonic-gate uint32_t pr_fsr; /* FPU status register */ 1807c478bd9Sstevel@tonic-gate uint8_t pr_qcnt; /* # of entries in saved FQ */ 1817c478bd9Sstevel@tonic-gate uint8_t pr_q_entrysize; /* # of bytes per FQ entry */ 1827c478bd9Sstevel@tonic-gate uint8_t pr_en; /* flag signifying fpu in use */ 183*c5a5e6f4SGordon Ross struct _fq pr_q[32]; /* contains the FQ array */ 1847c478bd9Sstevel@tonic-gate } prfpregset_t; 1857c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 1887c478bd9Sstevel@tonic-gate /* 1897c478bd9Sstevel@tonic-gate * kernel view of the _ILP32 floating point register set 1907c478bd9Sstevel@tonic-gate */ 1917c478bd9Sstevel@tonic-gate typedef struct prfpregset32 { 1927c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 1937c478bd9Sstevel@tonic-gate uint32_t pr_regs[32]; /* 32 singles */ 1947c478bd9Sstevel@tonic-gate double pr_dregs[16]; /* 16 doubles */ 1957c478bd9Sstevel@tonic-gate } pr_fr; 1967c478bd9Sstevel@tonic-gate uint32_t pr_filler; 1977c478bd9Sstevel@tonic-gate uint32_t pr_fsr; /* FPU status register */ 1987c478bd9Sstevel@tonic-gate uint8_t pr_qcnt; /* # of entries in saved FQ */ 1997c478bd9Sstevel@tonic-gate uint8_t pr_q_entrysize; /* # of bytes per FQ entry */ 2007c478bd9Sstevel@tonic-gate uint8_t pr_en; /* flag signifying fpu in use */ 2017c478bd9Sstevel@tonic-gate struct fq32 pr_q[32]; /* contains the FQ array */ 2027c478bd9Sstevel@tonic-gate } prfpregset32_t; 2037c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate /* 2067c478bd9Sstevel@tonic-gate * Extra register access 2077c478bd9Sstevel@tonic-gate */ 2087c478bd9Sstevel@tonic-gate 2097c478bd9Sstevel@tonic-gate #define XR_G0 0 2107c478bd9Sstevel@tonic-gate #define XR_G1 1 2117c478bd9Sstevel@tonic-gate #define XR_G2 2 2127c478bd9Sstevel@tonic-gate #define XR_G3 3 2137c478bd9Sstevel@tonic-gate #define XR_G4 4 2147c478bd9Sstevel@tonic-gate #define XR_G5 5 2157c478bd9Sstevel@tonic-gate #define XR_G6 6 2167c478bd9Sstevel@tonic-gate #define XR_G7 7 2177c478bd9Sstevel@tonic-gate #define NPRXGREG 8 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate #define XR_O0 0 2207c478bd9Sstevel@tonic-gate #define XR_O1 1 2217c478bd9Sstevel@tonic-gate #define XR_O2 2 2227c478bd9Sstevel@tonic-gate #define XR_O3 3 2237c478bd9Sstevel@tonic-gate #define XR_O4 4 2247c478bd9Sstevel@tonic-gate #define XR_O5 5 2257c478bd9Sstevel@tonic-gate #define XR_O6 6 2267c478bd9Sstevel@tonic-gate #define XR_O7 7 2277c478bd9Sstevel@tonic-gate #define NPRXOREG 8 2287c478bd9Sstevel@tonic-gate 2297c478bd9Sstevel@tonic-gate #define NPRXFILLER 8 2307c478bd9Sstevel@tonic-gate 2317c478bd9Sstevel@tonic-gate #define XR_TYPE_V8P 1 /* interpret union as pr_v8p */ 2327c478bd9Sstevel@tonic-gate 2337c478bd9Sstevel@tonic-gate typedef struct prxregset { 2347c478bd9Sstevel@tonic-gate uint32_t pr_type; /* how to interpret union */ 2357c478bd9Sstevel@tonic-gate uint32_t pr_align; /* alignment for the union */ 2367c478bd9Sstevel@tonic-gate union { 2377c478bd9Sstevel@tonic-gate struct pr_v8p { 2387c478bd9Sstevel@tonic-gate union { /* extra FP registers */ 2397c478bd9Sstevel@tonic-gate uint32_t pr_regs[32]; 2407c478bd9Sstevel@tonic-gate double pr_dregs[16]; 2417c478bd9Sstevel@tonic-gate #ifndef __sparcv9 /* 32-bit alignment problem */ 2427c478bd9Sstevel@tonic-gate long double pr_qregs[8]; 2437c478bd9Sstevel@tonic-gate #endif 2447c478bd9Sstevel@tonic-gate } pr_xfr; 2457c478bd9Sstevel@tonic-gate uint32_t pr_xfsr; /* upper 32bits, FP state reg */ 2467c478bd9Sstevel@tonic-gate uint32_t pr_fprs; /* FP registers state */ 2477c478bd9Sstevel@tonic-gate uint32_t pr_xg[NPRXGREG]; /* upper 32bits, G registers */ 2487c478bd9Sstevel@tonic-gate uint32_t pr_xo[NPRXOREG]; /* upper 32bits, O registers */ 2497c478bd9Sstevel@tonic-gate uint64_t pr_tstate; /* TSTATE register */ 2507c478bd9Sstevel@tonic-gate uint32_t pr_filler[NPRXFILLER]; 2517c478bd9Sstevel@tonic-gate } pr_v8p; 2527c478bd9Sstevel@tonic-gate } pr_un; 2537c478bd9Sstevel@tonic-gate } prxregset_t; 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate /* 2567c478bd9Sstevel@tonic-gate * Given a pointer to a prxregset structure, this macro yields the value 2577c478bd9Sstevel@tonic-gate * of the %gsr embedded in the structure. It is an lvalue, so it can 2587c478bd9Sstevel@tonic-gate * be used to assign the value of the %gsr into the structure. 2597c478bd9Sstevel@tonic-gate * (Please don't ask why this is done this way.) 2607c478bd9Sstevel@tonic-gate */ 2617c478bd9Sstevel@tonic-gate #define PRXREG_GSR(xrp) (*(uint64_t *)((xrp)->pr_un.pr_v8p.pr_filler)) 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2647c478bd9Sstevel@tonic-gate } 2657c478bd9Sstevel@tonic-gate #endif 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gate #endif /* _SYS_PROCFS_ISA_H */ 268