instrument.cpp
来自「用vc++编写的虚拟机仿真系统。可以模拟真实操作系统的一些功能。」· C++ 代码 · 共 414 行
CPP
414 行
/////////////////////////////////////////////////////////////////////////// $Id: instrument.cc,v 1.2 2001/10/03 13:10:38 bdenney Exp $///////////////////////////////////////////////////////////////////////////// Copyright (C) 2001 MandrakeSoft S.A.//// MandrakeSoft S.A.// 43, rue d'Aboukir// 75002 Paris - France// http://www.linux-mandrake.com/// http://www.mandrakesoft.com///// This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2 of the License, or (at your option) any later version.//// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details.//// You should have received a copy of the GNU Lesser General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA#include "bochs.h"static logfunctions *instr_logfn = NULL;#define LOG_THIS instr_logfn->static FILE *logfd = NULL;#if 0// possible types passed to BX_INSTR_TLB_CNTRL()#define BX_INSTR_MOV_CR3 10#define BX_INSTR_INVLPG 11#define BX_INSTR_TASKSWITCH 12// possible types passed to BX_INSTR_CACHE_CNTRL()#define BX_INSTR_INVD 20#define BX_INSTR_WBINVD 21#endif// called from the CPU core voidbx_instr_cnear_branch_taken(Bit32u new_eip){ UNUSED(new_eip);} voidbx_instr_cnear_branch_not_taken(void){} voidbx_instr_ucnear_branch(unsigned what, Bit32u new_eip){ UNUSED(what); UNUSED(new_eip);} voidbx_instr_far_branch(unsigned what, Bit32u new_cs, Bit32u new_eip){ UNUSED(what); UNUSED(new_eip); UNUSED(new_cs);} voidbx_instr_opcode_byte1(Bit8u opcode){ UNUSED(opcode);} voidbx_instr_opcode_byte2(Bit8u opcode){ UNUSED(opcode);} voidbx_instr_opcode_g1ebib(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g1eviv(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g1evib(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g2ebib(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g2evib(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g2eb1(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g2ev1(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g2ebcl(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g2evcl(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g3eb(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g3ev(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g4(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g5(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g6(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g7(unsigned nnn){ UNUSED(nnn);} voidbx_instr_opcode_g8evib(unsigned nnn){ UNUSED(nnn);} voidbx_instr_mem_code(Bit32u linear, unsigned size){ UNUSED(linear); UNUSED(size);} voidbx_instr_mem_data(Bit32u linear, unsigned size, unsigned rw){ UNUSED(linear); UNUSED(size); UNUSED(rw);} voidbx_instr_opcode_begin(Bit32u linear){ Bit32u cs = BX_CPU(0)->sregs[BX_SEG_REG_CS].selector.value; Bit32u eip = BX_CPU(0)->prev_eip; fprintf (logfd, "pc %04x:%08x\n", cs, eip); fflush (logfd);} voidbx_instr_opcode_end(Bit32u linear){ UNUSED(linear);} voidbx_instr_exception(unsigned vector){ UNUSED(vector);} voidbx_instr_tlb_cntrl(unsigned what, Bit32u newval){ UNUSED(what); UNUSED(newval);} voidbx_instr_cache_cntrl(unsigned what){ UNUSED(what);} voidbx_instr_hwinterrupt(unsigned vector, Bit32u cs, Bit32u eip){ UNUSED(vector); UNUSED(cs); UNUSED(eip);} voidbx_instr_init(void){ instr_logfn = new logfunctions (); instr_logfn->put ("INST"); logfd = fopen ("bxevent.txt", "w"); if (!logfd) { BX_PANIC (("could not open bxevent.txt")); // if they continue through the panic, just log to stderr logfd = stderr; } fprintf (logfd, "# Instrument init\n");} voidbx_instr_shutdown(void){ fprintf (logfd, "# Instrument shutdown\n");} voidbx_instr_opcode_repeating(void){}// called from bochs debugger if you type "instrument start" voidbx_instr_start(void){ fprintf (logfd, "# Instrument start\n");}// called from bochs debugger if you type "instrument stop" voidbx_instr_stop(void){ fprintf (logfd, "# Instrument stop\n");}// called from bochs debugger if you type "instrument reset" voidbx_instr_reset(void){ fprintf (logfd, "# Instrument reset\n");}// called from bochs debugger if you type "instrument print" voidbx_instr_print(void){ fprintf (logfd, "# Instrument print\n");} voidbx_instr_prefix_as(void){} voidbx_instr_prefix_os(void){} voidbx_instr_prefix_rep(void){} voidbx_instr_prefix_repne(void){} voidbx_instr_prefix_lock(void){} voidbx_instr_prefix_cs(void){} voidbx_instr_prefix_ss(void){} voidbx_instr_prefix_ds(void){} voidbx_instr_prefix_es(void){} voidbx_instr_prefix_fs(void){} voidbx_instr_prefix_gs(void){} voidbx_instr_modrm32(unsigned modrm){ UNUSED(modrm);} voidbx_instr_sib32(unsigned sib){ UNUSED(sib);} voidbx_instr_modrm16(unsigned modrm){ UNUSED(modrm);} voidbx_instr_iret(void){} voidbx_instr_debug_prompt(void){} voidbx_instr_fetch_byte(Bit8u val8){} voidbx_instr_fetch_word(Bit16u val16){} voidbx_instr_fetch_dword(Bit32u val32){} voidbx_instr_phy_write(Bit32u addr, unsigned len){} voidbx_instr_phy_read(Bit32u addr, unsigned len){} voidbx_instr_interrupt(unsigned vector){} voidbx_instr_inp(Bit16u addr, unsigned len){} voidbx_instr_outp(Bit16u addr, unsigned len){} voidbx_instr_inp2(Bit16u addr, unsigned len, unsigned val){ fprintf (logfd, "in %d %04x %04x\n", len, addr, val);} voidbx_instr_outp2(Bit16u addr, unsigned len, unsigned val){ fprintf (logfd, "out %d %04x %04x\n", len, addr, val);}void bx_instr_lin_read(Bit32u lin, Bit32u phy, unsigned len){}void bx_instr_lin_write(Bit32u lin, Bit32u phy, unsigned len){}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?