xref: /titanic_44/usr/src/lib/libbc/inc/include/vm/faultcode.h (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
23 
24 /*
25  * Copyright (c) 1987 by Sun Microsystems, Inc.
26  */
27 
28 #ifndef _vm_faultcode_h
29 #define	_vm_faultcode_h
30 
31 /*
32  * This file describes the "code" that is delivered during
33  * SIGBUS and SIGSEGV exceptions.  It also describes the data
34  * type returned by vm routines which handle faults.
35  *
36  * If FC_CODE(fc) == FC_OBJERR, then FC_ERRNO(fc) contains the errno value
37  * returned by the underlying object mapped at the fault address.
38  */
39 #define	FC_HWERR	0x1	/* misc hardware error (e.g. bus timeout) */
40 #define	FC_ALIGN	0x2	/* hardware alignment error */
41 #define	FC_NOMAP	0x3	/* no mapping at the fault address */
42 #define	FC_PROT		0x4	/* access exceeded current protections */
43 #define	FC_OBJERR	0x5	/* underlying object returned errno value */
44 
45 #define	FC_MAKE_ERR(e)	(((e) << 8) | FC_OBJERR)
46 
47 #define	FC_CODE(fc)	((fc) & 0xff)
48 #define	FC_ERRNO(fc)	((unsigned)(fc) >> 8)
49 
50 #ifndef LOCORE
51 typedef	int	faultcode_t;	/* type returned by vm fault routines */
52 #endif LOCORE
53 
54 #endif /*!_vm_faultcode_h*/
55