Bugfix: Let Bochs' trigger breakpoint events even in case of rep-instructions

This reverts the solution of a former commit (see git hash e1f6601d8494bcb002e89543a9334e053f0e69d3). All additional changes proposed in that commit have been deleted and the major work is now done by the aspect header BreakRepeatInstr.ah: It ensures the condition in the methods repeat() and repeat_ZF() if (BX_CPU_THIS_PTR async_event) ... to be always true which causes Bochs to leave these methods immediately. This, in turn, involves a call to defineCPULoopJointPoint(), yielding a breakpoint event in Fail.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@2009 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2013-01-17 13:41:19 +00:00
parent 0ba62aea8f
commit 03b4356598
2 changed files with 46 additions and 27 deletions

View File

@ -0,0 +1,46 @@
#ifndef __BREAK_REPEAT_INSTR_AH__
#define __BREAK_REPEAT_INSTR_AH__
#include "config/VariantConfig.hpp"
#include "config/FailConfig.hpp"
#if defined(BUILD_BOCHS) && defined(CONFIG_EVENT_BREAKPOINTS)
#include <iostream>
#include "cpu/cpu.h"
#include "BochsHelpers.hpp"
#include "../SALInst.hpp"
/*
* This aspect ensures that all conditions like
* ... if (BX_CPU_THIS_PTR async_event) ...
* (in "break_condition_methods") are always true.
*
* This is required by the Breakpoint-Events (aspect) in case
* of (any) rep-instructions because they need to be triggered
* after *each* repetition of the corresponding instruction.
*/
aspect BreakRepeatInstr {
pointcut break_condition_methods() =
"% ...::bx_cpu_c::repeat(...)" || // cpu/cpu.cc
"% ...::bx_cpu_c::repeat_ZF(...)"; // dito
advice execution (break_condition_methods()) : around ()
{
// We cannot restore the previous state because the methods
// itself may change the value of "async_event". We need to
// be aware of introducing a potential bug in the Bochs'
// internal logic this way if "1" represents an internally
// used value.
//Bit32u old_async_ev = getCPU(tjp->that())->async_event;
getCPU(tjp->that())->async_event |= 1;
tjp->proceed();
//getCPU(tjp->that())->async_event = old_async_ev;
}
};
#endif // CONFIG_EVENT_BREAKPOINTS
#endif // __BREAK_REPEAT_INSTR_AH__