This more ellegant way to have debug info for BxError and not lose any performace

This commit is contained in:
Stanislav Shwartsman 2008-08-09 19:18:09 +00:00
parent 5dd02b26e3
commit 24e0b53720
4 changed files with 15 additions and 21 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode.cc,v 1.196 2008-07-13 15:35:09 sshwarts Exp $
// $Id: fetchdecode.cc,v 1.197 2008-08-09 19:18:09 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2488,7 +2488,6 @@ fetch_b1:
switch (b1) {
case 0x0f: // 2-byte escape
i->setOpcodeExtension();
if (ilen < remain) {
ilen++;
b1 = 0x100 | *iptr++;
@ -2947,9 +2946,13 @@ modrm_done:
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BxError(bxInstruction_c *i)
{
BX_DEBUG(("BxError: i with opcode=0x%u%02x", i->hasOpcodeExtension(), i->b1()));
BX_DEBUG(("BxError: Encountered an unknown instruction b1=0x%02x (signalling #UD)", i->b1()));
BX_DEBUG(("modrm was 0x%02x, nnn was %u, rm was %u", i->modrm(), i->nnn(), i->rm()));
BX_DEBUG(("WARNING: Encountered an unknown instruction (signalling #UD)"));
#if BX_DISASM && BX_DEBUGGER == 0 // with debugger it easy to see the #UD
if (LOG_THIS getonoff(LOGLEV_DEBUG))
debug_disasm_instruction(BX_CPU_THIS_PTR prev_rip);
#endif
exception(BX_UD_EXCEPTION, 0, 0);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode64.cc,v 1.204 2008-07-13 09:59:59 sshwarts Exp $
// $Id: fetchdecode64.cc,v 1.205 2008-08-09 19:18:09 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -3398,7 +3398,6 @@ fetch_b1:
}
return(0);
case 0x0f: // 2 byte escape
i->setOpcodeExtension();
if (ilen < remain) {
ilen++;
b1 = 0x100 | *iptr++;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: instr.h,v 1.14 2008-08-08 09:22:47 sshwarts Exp $
// $Id: instr.h,v 1.15 2008-08-09 19:18:09 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2008 Stanislav Shwartsman
@ -50,9 +50,8 @@ public:
#endif
struct {
// 7...2 (unused)
// 1...1 stop trace (used with trace cache)
// 0...0 opcode extension: 0-none, 1-0x0f used
// 7...1 (unused)
// 0...0 stop trace (used with trace cache)
Bit8u metaInfo4;
// 7...0 b1 - opcode byte
@ -274,19 +273,12 @@ public:
metaInfo.metaInfo3 = b1 & 0xff;
}
BX_CPP_INLINE void setOpcodeExtension(void) {
metaInfo.metaInfo4 |= 1;
}
BX_CPP_INLINE unsigned hasOpcodeExtension(void) const {
return metaInfo.metaInfo4 & 1;
}
#if BX_SUPPORT_TRACE_CACHE
BX_CPP_INLINE void setStopTraceAttr(void) {
metaInfo.metaInfo4 |= (1<<1);
metaInfo.metaInfo4 |= 1;
}
BX_CPP_INLINE unsigned getStopTraceAttr(void) const {
return metaInfo.metaInfo4 & (1<<1);
return metaInfo.metaInfo4 & 1;
}
#endif
};

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.251 2008-08-08 09:22:47 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.252 2008-08-09 19:18:09 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -41,7 +41,7 @@
void BX_CPP_AttrRegparmN(1) BX_CPU_C::UndefinedOpcode(bxInstruction_c *i)
{
BX_DEBUG(("UndefinedOpcode: 0x%d%02x causes #UD exception", i->hasOpcodeExtension(), i->b1()));
BX_DEBUG(("UndefinedOpcode: b1 = 0x%02x causes #UD exception", i->b1()));
exception(BX_UD_EXCEPTION, 0, 0);
}