Added MWAIT callback

This commit is contained in:
Stanislav Shwartsman 2007-12-13 21:41:32 +00:00
parent f145f4c847
commit 85d10e4f72
6 changed files with 26 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.185 2007-12-03 21:43:14 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.186 2007-12-13 21:41:32 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2000,6 +2000,8 @@ void BX_CPU_C::MWAIT(bxInstruction_c *i)
// will remain in a optimized state until one of the above
// conditions is met.
BX_INSTR_MWAIT(BX_CPU_ID, BX_CPU_THIS_PTR monitor.monitor_begin, CACHE_LINE_SIZE, ECX);
#if BX_USE_IDLE_HACK
bx_gui->sim_is_idle();
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: instrument.h,v 1.18 2007-12-13 21:30:05 sshwarts Exp $
// $Id: instrument.h,v 1.19 2007-12-13 21:41:32 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -78,6 +78,7 @@ void bx_instr_mem_data(unsigned cpu, bx_address lin, unsigned size, unsigned rw)
# define BX_INSTR_SHUTDOWN(cpu_id)
# define BX_INSTR_RESET(cpu_id) bx_instr_reset(cpu_id)
# 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 */
@ -143,6 +144,7 @@ void bx_instr_mem_data(unsigned cpu, bx_address lin, unsigned size, unsigned rw)
# define BX_INSTR_SHUTDOWN(cpu_id)
# define BX_INSTR_RESET(cpu_id)
# 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 */

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: instrument.h,v 1.16 2007-12-13 21:30:05 sshwarts Exp $
// $Id: instrument.h,v 1.17 2007-12-13 21:41:32 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -126,6 +126,8 @@ extern bxInstrumentation *icpu;
# define BX_INSTR_SHUTDOWN(cpu_id)
# define BX_INSTR_RESET(cpu_id) icpu[cpu_id].bx_instr_reset()
# 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 */
@ -190,6 +192,7 @@ extern bxInstrumentation *icpu;
# define BX_INSTR_SHUTDOWN(cpu_id)
# define BX_INSTR_RESET(cpu_id)
# 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 */

View File

@ -42,6 +42,13 @@ RESET BUTTON on the simulator's control panel.
The callback is called each time, when Bochs' emulated CPU enters to the HALT
state.
void bx_instr_mwait(unsigned cpu, bx_phy_address addr, unsigned len, Bit32u flags);
The callback is called each time, when Bochs' emulated CPU enters to the MWAIT
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

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: instrument.cc,v 1.18 2007-12-13 21:30:05 sshwarts Exp $
// $Id: instrument.cc,v 1.19 2007-12-13 21:41:32 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -33,6 +33,7 @@ void bx_instr_init(unsigned cpu) {}
void bx_instr_shutdown(unsigned cpu) {}
void bx_instr_reset(unsigned cpu) {}
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() {}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: instrument.h,v 1.22 2007-12-13 21:30:05 sshwarts Exp $
// $Id: instrument.h,v 1.23 2007-12-13 21:41:32 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -56,6 +56,7 @@ void bx_instr_init(unsigned cpu);
void bx_instr_shutdown(unsigned cpu);
void bx_instr_reset(unsigned cpu);
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();
@ -105,6 +106,10 @@ void bx_instr_wrmsr(unsigned cpu, unsigned addr, Bit64u value);
# define BX_INSTR_SHUTDOWN(cpu_id) bx_instr_shutdown(cpu_id)
# define BX_INSTR_RESET(cpu_id) bx_instr_reset(cpu_id)
# define BX_INSTR_HLT(cpu_id) bx_instr_hlt(cpu_id)
# define BX_INSTR_MWAIT(cpu_id, addr, len, flags) \
bx_instr_hlt(cpu_id, addr, len, flags)
# define BX_INSTR_NEW_INSTRUCTION(cpu_id) bx_instr_new_instruction(cpu_id)
/* called from command line debugger */
@ -171,6 +176,7 @@ void bx_instr_wrmsr(unsigned cpu, unsigned addr, Bit64u value);
# define BX_INSTR_SHUTDOWN(cpu_id)
# define BX_INSTR_RESET(cpu_id)
# 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 */