faultcode.h revision 722:636b850d4ee9
1226031Sstas/*
2226031Sstas * CDDL HEADER START
3226031Sstas *
4226031Sstas * The contents of this file are subject to the terms of the
5226031Sstas * Common Development and Distribution License, Version 1.0 only
6226031Sstas * (the "License").  You may not use this file except in compliance
7226031Sstas * with the License.
8226031Sstas *
9226031Sstas * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10226031Sstas * or http://www.opensolaris.org/os/licensing.
11226031Sstas * See the License for the specific language governing permissions
12226031Sstas * and limitations under the License.
13226031Sstas *
14226031Sstas * When distributing Covered Code, include this CDDL HEADER in each
15226031Sstas * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16226031Sstas * If applicable, add the following below this CDDL HEADER, with the
17226031Sstas * fields enclosed by brackets "[]" replaced with your own identifying
18226031Sstas * information: Portions Copyright [yyyy] [name of copyright owner]
19226031Sstas *
20226031Sstas * CDDL HEADER END
21226031Sstas */
22226031Sstas/*
23226031Sstas * Copyright 1987 Sun Microsystems, Inc.  All rights reserved.
24226031Sstas * Use is subject to license terms.
25226031Sstas */
26226031Sstas
27226031Sstas#ifndef _vm_faultcode_h
28226031Sstas#define	_vm_faultcode_h
29226031Sstas
30226031Sstas#pragma ident	"%Z%%M%	%I%	%E% SMI"
31226031Sstas
32226031Sstas/*
33226031Sstas * This file describes the "code" that is delivered during
34226031Sstas * SIGBUS and SIGSEGV exceptions.  It also describes the data
35226031Sstas * type returned by vm routines which handle faults.
36226031Sstas *
37226031Sstas * If FC_CODE(fc) == FC_OBJERR, then FC_ERRNO(fc) contains the errno value
38226031Sstas * returned by the underlying object mapped at the fault address.
39226031Sstas */
40226031Sstas#define	FC_HWERR	0x1	/* misc hardware error (e.g. bus timeout) */
41226031Sstas#define	FC_ALIGN	0x2	/* hardware alignment error */
42226031Sstas#define	FC_NOMAP	0x3	/* no mapping at the fault address */
43226031Sstas#define	FC_PROT		0x4	/* access exceeded current protections */
44226031Sstas#define	FC_OBJERR	0x5	/* underlying object returned errno value */
45226031Sstas
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
52typedef	int	faultcode_t;	/* type returned by vm fault routines */
53#endif	/* LOCORE */
54
55#endif /* !_vm_faultcode_h */
56