1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 1995-1999,2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _UTRAP_H 28*7c478bd9Sstevel@tonic-gate #define _UTRAP_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* 37*7c478bd9Sstevel@tonic-gate * this file contains definitions for user-level traps. 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #define UT_INSTRUCTION_DISABLED 1 41*7c478bd9Sstevel@tonic-gate #define UT_INSTRUCTION_ERROR 2 42*7c478bd9Sstevel@tonic-gate #define UT_INSTRUCTION_PROTECTION 3 43*7c478bd9Sstevel@tonic-gate #define UT_ILLTRAP_INSTRUCTION 4 44*7c478bd9Sstevel@tonic-gate #define UT_ILLEGAL_INSTRUCTION 5 45*7c478bd9Sstevel@tonic-gate #define UT_PRIVILEGED_OPCODE 6 46*7c478bd9Sstevel@tonic-gate #define UT_FP_DISABLED 7 47*7c478bd9Sstevel@tonic-gate #define UT_FP_EXCEPTION_IEEE_754 8 48*7c478bd9Sstevel@tonic-gate #define UT_FP_EXCEPTION_OTHER 9 49*7c478bd9Sstevel@tonic-gate #define UT_TAG_OVERFLOW 10 50*7c478bd9Sstevel@tonic-gate #define UT_DIVISION_BY_ZERO 11 51*7c478bd9Sstevel@tonic-gate #define UT_DATA_EXCEPTION 12 52*7c478bd9Sstevel@tonic-gate #define UT_DATA_ERROR 13 53*7c478bd9Sstevel@tonic-gate #define UT_DATA_PROTECTION 14 54*7c478bd9Sstevel@tonic-gate #define UT_MEM_ADDRESS_NOT_ALIGNED 15 55*7c478bd9Sstevel@tonic-gate #define UT_PRIVILEGED_ACTION 16 56*7c478bd9Sstevel@tonic-gate #define UT_ASYNC_DATA_ERROR 17 57*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_16 18 58*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_17 19 59*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_18 20 60*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_19 21 61*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_20 22 62*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_21 23 63*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_22 24 64*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_23 25 65*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_24 26 66*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_25 27 67*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_26 28 68*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_27 29 69*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_28 30 70*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_29 31 71*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_30 32 72*7c478bd9Sstevel@tonic-gate #define UT_TRAP_INSTRUCTION_31 33 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate /* 75*7c478bd9Sstevel@tonic-gate * These defines exist only for the private v8plus install_utrap interface. 76*7c478bd9Sstevel@tonic-gate */ 77*7c478bd9Sstevel@tonic-gate #define UTRAP_V8P_FP_DISABLED UT_FP_DISABLED 78*7c478bd9Sstevel@tonic-gate #define UTRAP_V8P_MEM_ADDRESS_NOT_ALIGNED UT_MEM_ADDRESS_NOT_ALIGNED 79*7c478bd9Sstevel@tonic-gate 80*7c478bd9Sstevel@tonic-gate #ifndef _ASM 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate #define UTH_NOCHANGE ((utrap_handler_t)(-1)) 83*7c478bd9Sstevel@tonic-gate #define UTRAP_UTH_NOCHANGE UTH_NOCHANGE 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate typedef int utrap_entry_t; 86*7c478bd9Sstevel@tonic-gate typedef void *utrap_handler_t; /* user trap handler entry point */ 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate #ifdef __sparcv8plus 89*7c478bd9Sstevel@tonic-gate int 90*7c478bd9Sstevel@tonic-gate install_utrap(utrap_entry_t type, utrap_handler_t new_handler, 91*7c478bd9Sstevel@tonic-gate utrap_handler_t *old_handlerp); 92*7c478bd9Sstevel@tonic-gate #endif /* __sparcv8plus */ 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 95*7c478bd9Sstevel@tonic-gate struct proc; 96*7c478bd9Sstevel@tonic-gate void utrap_dup(struct proc *pp, struct proc *cp); 97*7c478bd9Sstevel@tonic-gate void utrap_free(struct proc *p); 98*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate #ifdef __sparcv9 101*7c478bd9Sstevel@tonic-gate int 102*7c478bd9Sstevel@tonic-gate __sparc_utrap_install(utrap_entry_t type, 103*7c478bd9Sstevel@tonic-gate utrap_handler_t new_precise, utrap_handler_t new_deferred, 104*7c478bd9Sstevel@tonic-gate utrap_handler_t *old_precise, utrap_handler_t *old_deferred); 105*7c478bd9Sstevel@tonic-gate #endif 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate /* The trap_instruction user traps are precise only. */ 108*7c478bd9Sstevel@tonic-gate #define UT_PRECISE_MAXTRAPS 33 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate #endif /* ASM */ 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 113*7c478bd9Sstevel@tonic-gate } 114*7c478bd9Sstevel@tonic-gate #endif 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate #endif /* _UTRAP_H */ 117