source: trunk/ccl/lisp-kernel/lisp-exceptions.h @ 7282

Last change on this file since 7282 was 7282, checked in by gb, 13 years ago

Don't use sigaltstack on any x86-64 platform: even if it works, it makes
it harder to deal with exceptions in foreign code (we've often gotten
segfaults from running out of space on the alt stack, the mechanism
isn't reentrant, etc.)

Try to report cases where the kernel debugger is entered due to an
exception in foreign code. Todo: make it less tempting to use (L)
in that case, maybe try to make backtrace find saved_rbp from tcr on x86-64,
etc.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
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
25typedef enum {
26  kDebugger,
27  kContinue,
28  kExit
29} ErrAction;
30
31
32
33void
34zero_page(BytePtr);
35
36void
37zero_heap_segment(BytePtr);
38
39extern protected_area_ptr AllProtectedAreas;
40
41protected_area_ptr find_protected_area(BytePtr);
42
43OSStatus
44lisp_Debugger(ExceptionInformation *, siginfo_t *, int, char *, ...);
45
46OSStatus
47handle_protection_violation(ExceptionInformation *, siginfo_t *, TCR *, int);
48
49protected_area_ptr
50new_protected_area(BytePtr, BytePtr, lisp_protection_kind, natural, Boolean);
51
52void
53unprotect_area_prefix(protected_area_ptr, size_t);
54
55void
56protect_area_prefix(protected_area_ptr, size_t);
57
58void
59protect_area(protected_area_ptr);
60
61
62Boolean
63resize_dynamic_heap(BytePtr, natural);
64
65OSStatus
66PMCL_exception_handler(int, ExceptionInformation *, TCR *, siginfo_t *, int);
67
68TCR*
69get_tcr(Boolean);
70
71ErrAction
72error_action( void );
73
74void
75install_pmcl_exception_handlers(void);
76
77void
78unprotect_all_areas(void);
79
80void
81exception_cleanup(void);
82
83void
84exception_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
95void
96Fatal(StringPtr, StringPtr);
97
98
99Ptr
100allocate(natural);
101
102Ptr
103zalloc(natural);
104
105void
106deallocate(Ptr);
107
108
109
110void
111non_fatal_error( char * );
112
113void Bug(ExceptionInformation *, const char *format_string, ...);
114void FBug(ExceptionInformation *, const char *format_string, ...);
115int gc_from_xp(ExceptionInformation *, signed_natural);
116int purify_from_xp(ExceptionInformation *, signed_natural);
117int impurify_from_xp(ExceptionInformation *, signed_natural);
118int change_hons_area_size_from_xp(ExceptionInformation *, signed_natural);
119
120
121void
122adjust_exception_pc(ExceptionInformation *, int);
123
124size_t
125symbol_name( unsigned, char *, size_t );
126
127
128size_t
129exception_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
145void suspend_other_threads(Boolean);
146void resume_other_threads(Boolean);
147
148#define debug_foreign_exception 0x80
149
150#endif /* __lisp_exceptions_h__ */
151
Note: See TracBrowser for help on using the repository browser.