]> git.saurik.com Git - apple/xnu.git/blame - osfmk/i386/trap.h
xnu-344.49.tar.gz
[apple/xnu.git] / osfmk / i386 / trap.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
43866e37
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
1c79356b
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/*
26 * @OSF_COPYRIGHT@
27 */
28/*
29 * Mach Operating System
30 * Copyright (c) 1991,1990 Carnegie Mellon University
31 * All Rights Reserved.
32 *
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
38 *
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
42 *
43 * Carnegie Mellon requests users of this software to return to
44 *
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
49 *
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
52 */
53/*
54 */
55
56#ifndef _I386_TRAP_H_
57#define _I386_TRAP_H_
58
59/*
60 * Hardware trap vectors for i386.
61 */
62#define T_DIVIDE_ERROR 0
63#define T_DEBUG 1
64#define T_NMI 2 /* non-maskable interrupt */
65#define T_INT3 3 /* int 3 instruction */
66#define T_OVERFLOW 4 /* overflow test */
67#define T_OUT_OF_BOUNDS 5 /* bounds check */
68#define T_INVALID_OPCODE 6 /* invalid op code */
69#define T_NO_FPU 7 /* no floating point */
70#define T_DOUBLE_FAULT 8 /* double fault */
71#define T_FPU_FAULT 9
72/* 10 */
73#define T_SEGMENT_NOT_PRESENT 11
74#define T_STACK_FAULT 12
75#define T_GENERAL_PROTECTION 13
76#define T_PAGE_FAULT 14
77/* 15 */
78#define T_FLOATING_POINT_ERROR 16
79#define T_WATCHPOINT 17
80#define T_PREEMPT 255
81
82#define TRAP_NAMES "divide error", "debug trap", "NMI", "breakpoint", \
83 "overflow", "bounds check", "invalid opcode", \
84 "no coprocessor", "double fault", "coprocessor overrun", \
85 "invalid TSS", "segment not present", "stack bounds", \
86 "general protection", "page fault", "(reserved)", \
87 "coprocessor error", "watchpoint"
88
89/*
90 * Page-fault trap codes.
91 */
92#define T_PF_PROT 0x1 /* protection violation */
93#define T_PF_WRITE 0x2 /* write access */
94#define T_PF_USER 0x4 /* from user state */
95
96#if !defined(ASSEMBLER) && defined(MACH_KERNEL)
97
98#include <i386/thread.h>
99
100extern void i386_exception(
101 int exc,
102 int code,
103 int subcode);
104
105extern void thread_exception_return(void);
106
107extern boolean_t kernel_trap(
108 struct i386_saved_state *regs);
109
110extern void panic_trap(
111 struct i386_saved_state *regs);
112
113extern void user_trap(
114 struct i386_saved_state *regs);
115
116extern void i386_astintr(int preemption);
117
118#endif /* !ASSEMBLER && MACH_KERNEL */
119
120#endif /* _I386_TRAP_H_ */