Ejemplo n.º 1
0
long exception_handler(PEXCEPTION_POINTERS pe)
{
	PEXCEPTION_RECORD e = (PEXCEPTION_RECORD)pe->ExceptionRecord;
	CONTEXT *c = (CONTEXT*)pe->ContextRecord;

	if(in_code_heap_p(c->EIP))
		signal_callstack_top = (void *)c->ESP;
	else
		signal_callstack_top = NULL;

	if(e->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
	{
		signal_fault_addr = e->ExceptionInformation[1];
		c->EIP = (CELL)memory_signal_handler_impl;
	}
	else if(e->ExceptionCode == EXCEPTION_FLT_DIVIDE_BY_ZERO
			|| e->ExceptionCode == EXCEPTION_INT_DIVIDE_BY_ZERO)
	{
		signal_number = ERROR_DIVIDE_BY_ZERO;
		c->EIP = (CELL)divide_by_zero_signal_handler_impl;
	}
	/* If the Widcomm bluetooth stack is installed, the BTTray.exe process
	injects code into running programs. For some reason this results in
	random SEH exceptions with this (undocumented) exception code being
	raised. The workaround seems to be ignoring this altogether, since that
	is what happens if SEH is not enabled. Don't really have any idea what
	this exception means. */
	else if(e->ExceptionCode != 0x40010006)
	{
		signal_number = 11;
		c->EIP = (CELL)misc_signal_handler_impl;
	}

	return EXCEPTION_CONTINUE_EXECUTION;
}
Ejemplo n.º 2
0
INLINE F_STACK_FRAME *uap_stack_pointer(void *uap)
{
	/* There is a race condition here, but in practice a signal
	delivered during stack frame setup/teardown or while transitioning
	from Factor to C is a sign of things seriously gone wrong, not just
	a divide by zero or stack underflow in the listener */
	if(in_code_heap_p(UAP_PROGRAM_COUNTER(uap)))
	{
		F_STACK_FRAME *ptr = ucontext_stack_pointer(uap);
		if(!ptr)
			critical_error("Invalid uap",(CELL)uap);
		return ptr;
	}
	else
		return NULL;
}
Ejemplo n.º 3
0
inline static void check_code_pointer(cell ptr)
{
#ifdef FACTOR_DEBUG
	assert(in_code_heap_p(ptr));
#endif
}
Ejemplo n.º 4
0
inline void factor_vm::check_code_pointer(cell ptr)
{
#ifdef FACTOR_DEBUG
	assert(in_code_heap_p(ptr));
#endif
}