factor/vm/errors.hpp

52 lines
1.2 KiB
C++
Raw Normal View History

2009-05-04 02:46:13 -04:00
namespace factor
{
2009-05-02 05:04:19 -04:00
/* Runtime errors */
2009-05-04 05:50:24 -04:00
enum vm_error_type
2009-05-02 05:04:19 -04:00
{
ERROR_EXPIRED = 0,
ERROR_IO,
ERROR_NOT_IMPLEMENTED,
ERROR_TYPE,
ERROR_DIVIDE_BY_ZERO,
ERROR_SIGNAL,
ERROR_ARRAY_SIZE,
ERROR_C_STRING,
ERROR_FFI,
ERROR_HEAP_SCAN,
ERROR_UNDEFINED_SYMBOL,
ERROR_DS_UNDERFLOW,
ERROR_DS_OVERFLOW,
ERROR_RS_UNDERFLOW,
ERROR_RS_OVERFLOW,
ERROR_MEMORY,
2009-05-04 05:50:24 -04:00
};
2009-05-02 05:04:19 -04:00
2009-05-05 12:33:35 -04:00
void out_of_memory();
void fatal_error(const char* msg, cell tagged);
void critical_error(const char* msg, cell tagged);
PRIMITIVE(die);
2009-05-02 05:04:19 -04:00
2009-05-04 05:50:24 -04:00
void throw_error(cell error, stack_frame *native_stack);
void general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *native_stack);
2009-05-05 12:33:35 -04:00
void divide_by_zero_error();
2009-05-04 05:50:24 -04:00
void memory_protection_error(cell addr, stack_frame *native_stack);
void signal_error(int signal, stack_frame *native_stack);
void type_error(cell type, cell tagged);
2009-05-05 12:33:35 -04:00
void not_implemented_error();
2009-05-02 05:04:19 -04:00
PRIMITIVE(call_clear);
PRIMITIVE(unimplemented);
2009-05-02 21:01:54 -04:00
2009-05-02 05:04:19 -04:00
/* Global variables used to pass fault handler state from signal handler to
user-space */
2009-05-04 05:50:24 -04:00
extern cell signal_number;
extern cell signal_fault_addr;
extern stack_frame *signal_callstack_top;
2009-05-02 05:04:19 -04:00
2009-05-05 12:33:35 -04:00
void memory_signal_handler_impl();
void misc_signal_handler_impl();
2009-05-04 02:46:13 -04:00
}