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