vm: die if we fault in a fault
parent
f645c82b8a
commit
4037c981eb
|
@ -29,6 +29,8 @@ void out_of_memory()
|
||||||
|
|
||||||
void factor_vm::general_error(vm_error_type error, cell arg1, cell arg2)
|
void factor_vm::general_error(vm_error_type error, cell arg1, cell arg2)
|
||||||
{
|
{
|
||||||
|
faulting_p = true;
|
||||||
|
|
||||||
/* Reset local roots before allocating anything */
|
/* Reset local roots before allocating anything */
|
||||||
data_roots.clear();
|
data_roots.clear();
|
||||||
bignum_roots.clear();
|
bignum_roots.clear();
|
||||||
|
@ -57,6 +59,7 @@ void factor_vm::general_error(vm_error_type error, cell arg1, cell arg2)
|
||||||
|
|
||||||
ctx->push(error_object);
|
ctx->push(error_object);
|
||||||
|
|
||||||
|
faulting_p = false;
|
||||||
unwind_native_frames(special_objects[ERROR_HANDLER_QUOT],
|
unwind_native_frames(special_objects[ERROR_HANDLER_QUOT],
|
||||||
ctx->callstack_top);
|
ctx->callstack_top);
|
||||||
}
|
}
|
||||||
|
@ -68,6 +71,7 @@ void factor_vm::general_error(vm_error_type error, cell arg1, cell arg2)
|
||||||
std::cout << "error: " << error << std::endl;
|
std::cout << "error: " << error << std::endl;
|
||||||
std::cout << "arg 1: "; print_obj(arg1); std::cout << std::endl;
|
std::cout << "arg 1: "; print_obj(arg1); std::cout << std::endl;
|
||||||
std::cout << "arg 2: "; print_obj(arg2); std::cout << std::endl;
|
std::cout << "arg 2: "; print_obj(arg2); std::cout << std::endl;
|
||||||
|
faulting_p = false;
|
||||||
factorbug();
|
factorbug();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +90,8 @@ void factor_vm::memory_protection_error(cell addr)
|
||||||
{
|
{
|
||||||
if(code->safepoint_p(addr))
|
if(code->safepoint_p(addr))
|
||||||
handle_safepoint();
|
handle_safepoint();
|
||||||
|
else if(faulting_p)
|
||||||
|
fatal_error("Double fault", 0);
|
||||||
else if(ctx->datastack_seg->underflow_p(addr))
|
else if(ctx->datastack_seg->underflow_p(addr))
|
||||||
general_error(ERROR_DATASTACK_UNDERFLOW,false_object,false_object);
|
general_error(ERROR_DATASTACK_UNDERFLOW,false_object,false_object);
|
||||||
else if(ctx->datastack_seg->overflow_p(addr))
|
else if(ctx->datastack_seg->overflow_p(addr))
|
||||||
|
|
|
@ -18,7 +18,8 @@ factor_vm::factor_vm() :
|
||||||
fep_disabled(false),
|
fep_disabled(false),
|
||||||
full_output(false),
|
full_output(false),
|
||||||
last_nano_count(0),
|
last_nano_count(0),
|
||||||
signal_callstack_seg(NULL)
|
signal_callstack_seg(NULL),
|
||||||
|
faulting_p(false)
|
||||||
{
|
{
|
||||||
primitive_reset_dispatch_stats();
|
primitive_reset_dispatch_stats();
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,9 @@ struct factor_vm
|
||||||
/* Stack for signal handlers, only used on Unix */
|
/* Stack for signal handlers, only used on Unix */
|
||||||
segment *signal_callstack_seg;
|
segment *signal_callstack_seg;
|
||||||
|
|
||||||
|
/* Are we already handling a fault? Used to catch double memory faults */
|
||||||
|
bool faulting_p;
|
||||||
|
|
||||||
// contexts
|
// contexts
|
||||||
context *new_context();
|
context *new_context();
|
||||||
void init_context(context *ctx);
|
void init_context(context *ctx);
|
||||||
|
|
Loading…
Reference in New Issue