source: release/1.9/source/lisp-kernel/lisp-exceptions.h @ 16083

Last change on this file since 16083 was 15470, checked in by gb, 7 years ago

Try to minimize Mach dependencies on Darwin; in particular, use POSIX
signal handling to handle exceptions (as is done on other *nix platforms.)

Use sigaltstack() on Darwin; it still seems to have problems, but at least
doesn't (usually) try to force all threads to use the same alt stack. (That
just never gets old somehow ...)

Lots of stuff removed; lots of (mostly small, mostly obvious) changes to
support the above.

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