Replaced "return;" statements associated with bx_guard.special_unwind_stack
hack with longjmp() back to cpu.cc main decode loop, and added a check in there to return control when bx_guard.special_unwind_stack is set (compiling with debugger enabled only). If in the debugger you try to execute further instructions (which you shouldn't), other fields need to be reset I would think, such as EXT and errorno, and have to make sure ESP/EIP are corrected properly. Basically, this hack is only good for examining the current situation of a nasty fault.
This commit is contained in:
parent
c6350caa48
commit
d7a16521c4
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: cpu.cc,v 1.63 2002-10-05 14:51:25 kevinlawton Exp $
|
// $Id: cpu.cc,v 1.64 2002-10-06 22:08:18 kevinlawton Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||||
@ -131,6 +131,15 @@ BX_CPU_C::cpu_loop(Bit32s max_instr_count)
|
|||||||
(void) setjmp( BX_CPU_THIS_PTR jmp_buf_env );
|
(void) setjmp( BX_CPU_THIS_PTR jmp_buf_env );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if BX_DEBUGGER
|
||||||
|
// If the exception() routine has encountered a nasty fault scenario,
|
||||||
|
// the debugger may request that control is returned to it so that
|
||||||
|
// the situation may be examined.
|
||||||
|
if (bx_guard.special_unwind_stack) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// We get here either by a normal function call, or by a longjmp
|
// We get here either by a normal function call, or by a longjmp
|
||||||
// back from an exception() call. In either case, commit the
|
// back from an exception() call. In either case, commit the
|
||||||
// new EIP/ESP, and set up other environmental fields. This code
|
// new EIP/ESP, and set up other environmental fields. This code
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: cpu.h,v 1.98 2002-10-05 14:51:25 kevinlawton Exp $
|
// $Id: cpu.h,v 1.99 2002-10-06 22:08:18 kevinlawton Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||||
@ -2515,7 +2515,8 @@ union {
|
|||||||
BX_SMF void interrupt(Bit8u vector, Boolean is_INT, Boolean is_error_code,
|
BX_SMF void interrupt(Bit8u vector, Boolean is_INT, Boolean is_error_code,
|
||||||
Bit16u error_code);
|
Bit16u error_code);
|
||||||
#if BX_CPU_LEVEL >= 2
|
#if BX_CPU_LEVEL >= 2
|
||||||
BX_SMF void exception(unsigned vector, Bit16u error_code, Boolean is_INT);
|
BX_SMF void exception(unsigned vector, Bit16u error_code, Boolean is_INT)
|
||||||
|
BX_CPP_AttrNoReturn();
|
||||||
#endif
|
#endif
|
||||||
BX_SMF int int_number(bx_segment_reg_t *seg);
|
BX_SMF int int_number(bx_segment_reg_t *seg);
|
||||||
BX_SMF void shutdown_cpu(void);
|
BX_SMF void shutdown_cpu(void);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: exception.cc,v 1.26 2002-10-06 18:05:21 kevinlawton Exp $
|
// $Id: exception.cc,v 1.27 2002-10-06 22:08:18 kevinlawton Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||||
@ -806,11 +806,14 @@ BX_CPU_C::exception(unsigned vector, Bit16u error_code, Boolean is_INT)
|
|||||||
Bit8u exception_type;
|
Bit8u exception_type;
|
||||||
unsigned prev_errno;
|
unsigned prev_errno;
|
||||||
|
|
||||||
|
invalidate_prefetch_q();
|
||||||
|
UNUSED(is_INT);
|
||||||
|
|
||||||
#if BX_DEBUGGER
|
#if BX_DEBUGGER
|
||||||
if (bx_guard.special_unwind_stack) {
|
if (bx_guard.special_unwind_stack) {
|
||||||
BX_INFO (("exception() returning early because special_unwind_stack is set"));
|
BX_INFO (("exception() returning early because special_unwind_stack is set"));
|
||||||
return;
|
longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); // go back to main decode loop
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BX_EXTERNAL_DEBUGGER
|
#if BX_EXTERNAL_DEBUGGER
|
||||||
@ -822,11 +825,7 @@ BX_CPU_C::exception(unsigned vector, Bit16u error_code, Boolean is_INT)
|
|||||||
//trap_debugger(1);
|
//trap_debugger(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
BX_INSTR_EXCEPTION(CPU_ID, vector);
|
BX_INSTR_EXCEPTION(CPU_ID, vector);
|
||||||
invalidate_prefetch_q();
|
|
||||||
|
|
||||||
UNUSED(is_INT);
|
|
||||||
|
|
||||||
BX_DEBUG(("exception(%02x h)", (unsigned) vector));
|
BX_DEBUG(("exception(%02x h)", (unsigned) vector));
|
||||||
|
|
||||||
@ -846,7 +845,7 @@ BX_CPU_C::exception(unsigned vector, Bit16u error_code, Boolean is_INT)
|
|||||||
#if BX_DEBUGGER
|
#if BX_DEBUGGER
|
||||||
bx_guard.special_unwind_stack = true;
|
bx_guard.special_unwind_stack = true;
|
||||||
#endif
|
#endif
|
||||||
return;
|
longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); // go back to main decode loop
|
||||||
}
|
}
|
||||||
|
|
||||||
/* careful not to get here with curr_exception[1]==DOUBLE_FAULT */
|
/* careful not to get here with curr_exception[1]==DOUBLE_FAULT */
|
||||||
@ -859,7 +858,7 @@ BX_CPU_C::exception(unsigned vector, Bit16u error_code, Boolean is_INT)
|
|||||||
#if BX_DEBUGGER
|
#if BX_DEBUGGER
|
||||||
bx_guard.special_unwind_stack = true;
|
bx_guard.special_unwind_stack = true;
|
||||||
#endif
|
#endif
|
||||||
return;
|
longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); // go back to main decode loop
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ??? this is not totally correct, should be done depending on
|
/* ??? this is not totally correct, should be done depending on
|
||||||
|
Loading…
Reference in New Issue
Block a user