1 | /* |
---|
2 | Copyright (C) 1994-2001 Digitool, Inc |
---|
3 | This file is part of OpenMCL. |
---|
4 | |
---|
5 | OpenMCL is licensed under the terms of the Lisp Lesser GNU Public |
---|
6 | License , known as the LLGPL and distributed with OpenMCL as the |
---|
7 | file "LICENSE". The LLGPL consists of a preamble and the LGPL, |
---|
8 | which is distributed with OpenMCL as the file "LGPL". Where these |
---|
9 | conflict, the preamble takes precedence. |
---|
10 | |
---|
11 | OpenMCL is referenced in the preamble as the "LIBRARY." |
---|
12 | |
---|
13 | The LLGPL is also available online at |
---|
14 | http://opensource.franz.com/preamble.html |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __lisp_exceptions_h__ |
---|
18 | #define __lisp_exceptions_h__ 1 |
---|
19 | |
---|
20 | |
---|
21 | #include <stdlib.h> |
---|
22 | #include "memprotect.h" |
---|
23 | #include "gc.h" |
---|
24 | |
---|
25 | typedef enum { |
---|
26 | kDebugger, |
---|
27 | kContinue, |
---|
28 | kExit |
---|
29 | } ErrAction; |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | void |
---|
34 | zero_page(BytePtr); |
---|
35 | |
---|
36 | void |
---|
37 | zero_heap_segment(BytePtr); |
---|
38 | |
---|
39 | extern protected_area_ptr AllProtectedAreas; |
---|
40 | |
---|
41 | protected_area_ptr find_protected_area(BytePtr); |
---|
42 | |
---|
43 | OSStatus |
---|
44 | lisp_Debugger(ExceptionInformation *, siginfo_t *, int, Boolean, char *, ...); |
---|
45 | |
---|
46 | OSStatus |
---|
47 | handle_protection_violation(ExceptionInformation *, siginfo_t *, TCR *, int); |
---|
48 | |
---|
49 | protected_area_ptr |
---|
50 | new_protected_area(BytePtr, BytePtr, lisp_protection_kind, natural, Boolean); |
---|
51 | |
---|
52 | void |
---|
53 | unprotect_area_prefix(protected_area_ptr, size_t); |
---|
54 | |
---|
55 | void |
---|
56 | protect_area_prefix(protected_area_ptr, size_t); |
---|
57 | |
---|
58 | void |
---|
59 | protect_area(protected_area_ptr); |
---|
60 | |
---|
61 | |
---|
62 | Boolean |
---|
63 | resize_dynamic_heap(BytePtr, natural); |
---|
64 | |
---|
65 | OSStatus |
---|
66 | PMCL_exception_handler(int, ExceptionInformation *, TCR *, siginfo_t *, int); |
---|
67 | |
---|
68 | TCR* |
---|
69 | get_tcr(Boolean); |
---|
70 | |
---|
71 | ErrAction |
---|
72 | error_action( void ); |
---|
73 | |
---|
74 | void |
---|
75 | install_pmcl_exception_handlers(void); |
---|
76 | |
---|
77 | void |
---|
78 | unprotect_all_areas(void); |
---|
79 | |
---|
80 | void |
---|
81 | exception_cleanup(void); |
---|
82 | |
---|
83 | void |
---|
84 | exception_init(); |
---|
85 | |
---|
86 | |
---|
87 | #define debug_entry_exception 0 |
---|
88 | #define debug_entry_bug -1 |
---|
89 | #define debug_entry_dbg -2 |
---|
90 | |
---|
91 | #define ALLOW_EXCEPTIONS(context) \ |
---|
92 | pthread_sigmask(SIG_SETMASK, &context->uc_sigmask, NULL); |
---|
93 | |
---|
94 | |
---|
95 | void |
---|
96 | Fatal(StringPtr, StringPtr); |
---|
97 | |
---|
98 | |
---|
99 | Ptr |
---|
100 | allocate(natural); |
---|
101 | |
---|
102 | Ptr |
---|
103 | zalloc(natural); |
---|
104 | |
---|
105 | void |
---|
106 | deallocate(Ptr); |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | void |
---|
111 | non_fatal_error( char * ); |
---|
112 | |
---|
113 | void Bug(ExceptionInformation *, const char *format_string, ...); |
---|
114 | void FBug(ExceptionInformation *, const char *format_string, ...); |
---|
115 | int gc_from_xp(ExceptionInformation *, signed_natural); |
---|
116 | int purify_from_xp(ExceptionInformation *, signed_natural); |
---|
117 | int impurify_from_xp(ExceptionInformation *, signed_natural); |
---|
118 | int change_hons_area_size_from_xp(ExceptionInformation *, signed_natural); |
---|
119 | |
---|
120 | |
---|
121 | void |
---|
122 | adjust_exception_pc(ExceptionInformation *, int); |
---|
123 | |
---|
124 | size_t |
---|
125 | symbol_name( unsigned, char *, size_t ); |
---|
126 | |
---|
127 | |
---|
128 | size_t |
---|
129 | exception_fn_name( ExceptionInformation *, int, char *, size_t ); |
---|
130 | |
---|
131 | /* Need to define this here */ |
---|
132 | #ifdef DARWIN |
---|
133 | #define USE_MACH_EXCEPTION_LOCK 0 |
---|
134 | #endif |
---|
135 | |
---|
136 | |
---|
137 | #ifdef PPC |
---|
138 | #include "ppc-exceptions.h" |
---|
139 | #endif |
---|
140 | |
---|
141 | #ifdef X86 |
---|
142 | #include "x86-exceptions.h" |
---|
143 | #endif |
---|
144 | |
---|
145 | void suspend_other_threads(Boolean); |
---|
146 | void resume_other_threads(Boolean); |
---|
147 | |
---|
148 | #define debug_foreign_exception 0x80 |
---|
149 | |
---|
150 | #endif /* __lisp_exceptions_h__ */ |
---|
151 | |
---|