minimize instrumentation callback interface.

removed bx_instr_new_instruction callback, the callback ALWAYS can be replaced with another one - bx_instr_before_execution
TODO: fix instrumentation examples (example0 and example1)
This commit is contained in:
Stanislav Shwartsman 2011-07-07 22:17:23 +00:00
parent 39086133b4
commit 642bdcfb0a
7 changed files with 8 additions and 22 deletions

View File

@ -79,7 +79,7 @@ void bx_instr_reset(unsigned cpu, unsigned type)
instruction[cpu].is_branch = 0;
}
void bx_instr_new_instruction(unsigned cpu)
void bx_instr_before_execution(unsigned cpu, bxInstruction_c *unused)
{
if (!active) return;

View File

@ -63,7 +63,6 @@ void bx_instr_exit_env(void);
void bx_instr_initialize(unsigned cpu);
void bx_instr_reset(unsigned cpu, unsigned type);
void bx_instr_new_instruction(unsigned cpu);
void bx_instr_cnear_branch_taken(unsigned cpu, bx_address new_eip);
void bx_instr_cnear_branch_not_taken(unsigned cpu);
@ -72,6 +71,8 @@ void bx_instr_far_branch(unsigned cpu, unsigned what, Bit16u new_cs, bx_address
void bx_instr_opcode(unsigned cpu, const Bit8u *opcode, unsigned len, bx_bool is32, bx_bool is64);
void bx_instr_before_execution(unsigned cpu, bxInstruction_c *i);
void bx_instr_interrupt(unsigned cpu, unsigned vector);
void bx_instr_exception(unsigned cpu, unsigned vector, unsigned error_code);
void bx_instr_hwinterrupt(unsigned cpu, unsigned vector, Bit16u cs, bx_address eip);
@ -88,7 +89,6 @@ void bx_instr_mem_data_access(unsigned cpu, unsigned seg, bx_address offset, uns
#define BX_INSTR_RESET(cpu_id, type) bx_instr_reset(cpu_id, type)
#define BX_INSTR_HLT(cpu_id)
#define BX_INSTR_MWAIT(cpu_id, addr, len, flags)
#define BX_INSTR_NEW_INSTRUCTION(cpu_id) bx_instr_new_instruction(cpu_id)
/* called from command line debugger */
#define BX_INSTR_DEBUG_PROMPT()
@ -118,7 +118,7 @@ void bx_instr_mem_data_access(unsigned cpu, unsigned seg, bx_address offset, uns
#define BX_INSTR_PREFETCH_HINT(cpu_id, what, seg, offset)
/* execution */
#define BX_INSTR_BEFORE_EXECUTION(cpu_id, i)
#define BX_INSTR_BEFORE_EXECUTION(cpu_id, i) bx_instr_before_execution(cpu_id, i)
#define BX_INSTR_AFTER_EXECUTION(cpu_id, i)
#define BX_INSTR_REPEAT_ITERATION(cpu_id, i)
@ -153,7 +153,6 @@ void bx_instr_mem_data_access(unsigned cpu, unsigned seg, bx_address offset, uns
#define BX_INSTR_RESET(cpu_id, type)
#define BX_INSTR_HLT(cpu_id)
#define BX_INSTR_MWAIT(cpu_id, addr, len, flags)
#define BX_INSTR_NEW_INSTRUCTION(cpu_id)
/* called from command line debugger */
#define BX_INSTR_DEBUG_PROMPT()

View File

@ -52,7 +52,7 @@ void bxInstrumentation::bx_instr_reset(unsigned type)
active = 1;
}
void bxInstrumentation::bx_instr_new_instruction()
void bxInstrumentation::bx_instr_before_execution(bxInstruction_c *unused)
{
if (!active) return;

View File

@ -104,7 +104,6 @@ public:
bx_bool is_active() const { return active; }
void bx_instr_reset(unsigned type);
void bx_instr_new_instruction();
void bx_instr_cnear_branch_taken(bx_address new_eip);
void bx_instr_cnear_branch_not_taken();
@ -113,6 +112,8 @@ public:
void bx_instr_opcode(const Bit8u *opcode, unsigned len, bx_bool is32, bx_bool is64);
void bx_instr_before_execution(bxInstruction_c *i);
void bx_instr_interrupt(unsigned vector);
void bx_instr_exception(unsigned vector, unsigned error_code);
void bx_instr_hwinterrupt(unsigned vector, Bit16u cs, bx_address eip);
@ -138,8 +139,6 @@ extern bxInstrumentation *icpu;
#define BX_INSTR_HLT(cpu_id)
#define BX_INSTR_MWAIT(cpu_id, addr, len, flags)
#define BX_INSTR_NEW_INSTRUCTION(cpu_id) icpu[cpu_id].bx_instr_new_instruction()
/* called from command line debugger */
#define BX_INSTR_DEBUG_PROMPT()
#define BX_INSTR_DEBUG_CMD(cmd)
@ -168,7 +167,7 @@ extern bxInstrumentation *icpu;
#define BX_INSTR_PREFETCH_HINT(cpu_id, what, seg, offset)
/* execution */
#define BX_INSTR_BEFORE_EXECUTION(cpu_id, i)
#define BX_INSTR_BEFORE_EXECUTION(cpu_id, i) icpu[cpu_id].bx_instr_before_execution(i)
#define BX_INSTR_AFTER_EXECUTION(cpu_id, i)
#define BX_INSTR_REPEAT_ITERATION(cpu_id, i)
@ -202,7 +201,6 @@ extern bxInstrumentation *icpu;
#define BX_INSTR_RESET(cpu_id, type)
#define BX_INSTR_HLT(cpu_id)
#define BX_INSTR_MWAIT(cpu_id, addr, len, flags)
#define BX_INSTR_NEW_INSTRUCTION(cpu_id)
/* called from command line debugger */
#define BX_INSTR_DEBUG_PROMPT()

View File

@ -66,12 +66,6 @@ state. The callback receives monitored memory range and MWAIT flags as a
parameters.
void bx_instr_new_instruction(unsigned cpu);
The callback is called each time, when Bochs completes (commits) already
finished instruction and starts a new one.
void bx_instr_cnear_branch_taken(unsigned cpu, bx_address new_eip);
The callback is called each time, when currently executed instruction is a

View File

@ -32,7 +32,6 @@ void bx_instr_exit(unsigned cpu) {}
void bx_instr_reset(unsigned cpu, unsigned type) {}
void bx_instr_hlt(unsigned cpu) {}
void bx_instr_mwait(unsigned cpu, bx_phy_address addr, unsigned len, Bit32u flags) {}
void bx_instr_new_instruction(unsigned cpu) {}
void bx_instr_debug_promt() {}
void bx_instr_debug_cmd(const char *cmd) {}

View File

@ -66,7 +66,6 @@ void bx_instr_exit(unsigned cpu);
void bx_instr_reset(unsigned cpu, unsigned type);
void bx_instr_hlt(unsigned cpu);
void bx_instr_mwait(unsigned cpu, bx_phy_address addr, unsigned len, Bit32u flags);
void bx_instr_new_instruction(unsigned cpu);
void bx_instr_debug_promt();
void bx_instr_debug_cmd(const char *cmd);
@ -116,8 +115,6 @@ void bx_instr_wrmsr(unsigned cpu, unsigned addr, Bit64u value);
#define BX_INSTR_MWAIT(cpu_id, addr, len, flags) \
bx_instr_mwait(cpu_id, addr, len, flags)
#define BX_INSTR_NEW_INSTRUCTION(cpu_id) bx_instr_new_instruction(cpu_id)
/* called from command line debugger */
#define BX_INSTR_DEBUG_PROMPT() bx_instr_debug_promt()
#define BX_INSTR_DEBUG_CMD(cmd) bx_instr_debug_cmd(cmd)
@ -181,7 +178,6 @@ void bx_instr_wrmsr(unsigned cpu, unsigned addr, Bit64u value);
#define BX_INSTR_RESET(cpu_id, type)
#define BX_INSTR_HLT(cpu_id)
#define BX_INSTR_MWAIT(cpu_id, addr, len, flags)
#define BX_INSTR_NEW_INSTRUCTION(cpu_id)
/* called from command line debugger */
#define BX_INSTR_DEBUG_PROMPT()