]> gitweb.factorcode.org Git - factor.git/blob - vm/errors.hpp
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / vm / errors.hpp
1 namespace factor
2 {
3
4 /* Runtime errors */
5 enum vm_error_type
6 {
7         ERROR_EXPIRED = 0,
8         ERROR_IO,
9         ERROR_NOT_IMPLEMENTED,
10         ERROR_TYPE,
11         ERROR_DIVIDE_BY_ZERO,
12         ERROR_SIGNAL,
13         ERROR_ARRAY_SIZE,
14         ERROR_C_STRING,
15         ERROR_FFI,
16         ERROR_HEAP_SCAN,
17         ERROR_UNDEFINED_SYMBOL,
18         ERROR_DS_UNDERFLOW,
19         ERROR_DS_OVERFLOW,
20         ERROR_RS_UNDERFLOW,
21         ERROR_RS_OVERFLOW,
22         ERROR_MEMORY,
23     ERROR_FP_TRAP,
24 };
25
26 void out_of_memory();
27 void fatal_error(const char* msg, cell tagged);
28 void critical_error(const char* msg, cell tagged);
29
30 PRIMITIVE(die);
31
32 void throw_error(cell error, stack_frame *native_stack);
33 void general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *native_stack);
34 void divide_by_zero_error();
35 void memory_protection_error(cell addr, stack_frame *native_stack);
36 void signal_error(int signal, stack_frame *native_stack);
37 void type_error(cell type, cell tagged);
38 void not_implemented_error();
39 void fp_trap_error();
40
41 PRIMITIVE(call_clear);
42 PRIMITIVE(unimplemented);
43
44 /* Global variables used to pass fault handler state from signal handler to
45 user-space */
46 extern cell signal_number;
47 extern cell signal_fault_addr;
48 extern stack_frame *signal_callstack_top;
49
50 void memory_signal_handler_impl();
51 void fp_signal_handler_impl();
52 void misc_signal_handler_impl();
53
54 }