source: trunk/source/lisp-kernel/x86-exceptions.h @ 14347

Last change on this file since 14347 was 14295, checked in by rme, 9 years ago

Eliminate some (but not all) warnings produced when building with
"-Wall -Wno-format". Also a couple of minor changes that enable
clang to build the lisp kernel (at least on x8632 and x8664).

  • 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) 2005-2009 Clozure Associates
3   This file is part of Clozure CL. 
4
5   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
6   License , known as the LLGPL and distributed with Clozure CL as the
7   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
8   which is distributed with Clozure CL as the file "LGPL".  Where these
9   conflict, the preamble takes precedence. 
10
11   Clozure CL 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 X86_EXCEPTIONS_H
18#define X86_EXCEPTIONS_H 1
19
20typedef u8_t opcode, *pc;
21
22void switch_to_foreign_stack(void*, ...);
23
24#define INTN_OPCODE 0xcd
25
26#define UUO_GC_TRAP    0xc4
27#define UUO_ALLOC_TRAP 0xc5
28#define UUO_DEBUG_TRAP 0xca
29#define UUO_DEBUG_TRAP_WITH_STRING 0xcd
30#define UUO_WATCH_TRAP 0xce
31  #define WATCH_TRAP_FUNCTION_WATCH 0
32  #define WATCH_TRAP_FUNCTION_UNWATCH 1
33
34#define XUUO_OPCODE_0 0x0f
35#define XUUO_OPCODE_1 0x0b
36
37#define XUUO_TLB_TOO_SMALL 1
38#define XUUO_INTERRUPT_NOW 2
39#define XUUO_SUSPEND_NOW 3
40#define XUUO_INTERRUPT 4
41#define XUUO_SUSPEND 5
42#define XUUO_SUSPEND_ALL 6
43#define XUUO_RESUME 7
44#define XUUO_RESUME_ALL 8
45#define XUUO_KILL 9
46#define XUUO_ALLOCATE_LIST 10
47
48int callback_to_lisp (TCR *tcr, LispObj callback_macptr, ExceptionInformation *xp,
49                      natural arg1, natural arg2, natural arg3, natural arg4,
50                      natural arg5);
51
52
53void
54pc_luser_xp(ExceptionInformation*, TCR*, signed_natural*);
55
56
57typedef enum {
58  ID_unrecognized_alloc_instruction,
59  ID_load_allocptr_reg_from_tcr_save_allocptr_instruction,
60  ID_compare_allocptr_reg_to_tcr_save_allocbase_instruction,
61  ID_branch_around_alloc_trap_instruction,
62  ID_alloc_trap_instruction,
63  ID_set_allocptr_header_instruction,
64  ID_clear_tcr_save_allocptr_tag_instruction
65} alloc_instruction_id;
66
67
68
69
70
71/* Please go away. */
72#ifdef DARWIN_GS_HACK
73extern Boolean ensure_gs_pthread(void);
74extern void set_gs_address(void *);
75#endif
76
77
78/* sigaltstack isn't thread-specific on The World's Most Advanced OS */
79#ifdef DARWIN
80#undef USE_SIGALTSTACK
81#else
82#ifdef WINDOWS
83#undef USE_SIGALTSTACK
84#else
85#define USE_SIGALTSTACK 1
86#endif
87#endif
88
89#ifdef USE_SIGALTSTACK
90void setup_sigaltstack(area *);
91#endif
92
93/* recognizing the function associated with a tagged return address */
94/* now involves recognizinig an "(lea (@ disp (% rip)) (% rn))" */
95/* instruction at the tra */
96
97#define RECOVER_FN_FROM_RIP_LENGTH 7 /* the instruction is 7 bytes long */
98#define RECOVER_FN_FROM_RIP_DISP_OFFSET 3 /* displacement word is 3 bytes in */
99#define RECOVER_FN_FROM_RIP_WORD0 0x8d4c /* 0x4c 0x8d, little-endian */
100#define RECOVER_FN_FROM_RIP_BYTE2 0x2d  /* third byte of opcode */
101
102extern natural get_mxcsr();
103extern void set_mxcsr(natural);
104void enable_fp_exceptions(void);
105
106#ifdef X8632
107/* The 32-bit immediate value in the instruction
108 * "(mov ($ 0x12345678) (% fn))" at a tagged return address
109 * refers to the associated function.
110 */
111#define RECOVER_FN_OPCODE 0xbf
112#define RECOVER_FN_LENGTH 5
113#endif
114
115void callback_for_gc_notification(ExceptionInformation *xp, TCR *tcr);
116
117#endif /* X86_EXCEPTIONS_H */
118
Note: See TracBrowser for help on using the repository browser.