2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 00:54:04 +03:00
|
|
|
// $Id$
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2009-10-15 00:45:29 +04:00
|
|
|
// Copyright (c) 2008-2009 Stanislav Shwartsman
|
2008-04-03 21:44:33 +04:00
|
|
|
// Written by Stanislav Shwartsman [sshwarts at sourceforge net]
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// 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
|
2009-01-16 21:18:59 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
|
2008-04-03 21:44:33 +04:00
|
|
|
//
|
2007-11-18 02:28:33 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2001-05-24 22:46:34 +04:00
|
|
|
#define NEED_CPU_REG_SHORTCUTS 1
|
2001-04-10 05:04:59 +04:00
|
|
|
#include "bochs.h"
|
2006-03-07 01:03:16 +03:00
|
|
|
#include "cpu.h"
|
merge in BRANCH-io-cleanup.
To see the commit logs for this use either cvsweb or
cvs update -r BRANCH-io-cleanup and then 'cvs log' the various files.
In general this provides a generic interface for logging.
logfunctions:: is a class that is inherited by some classes, and also
. allocated as a standalone global called 'genlog'. All logging uses
. one of the ::info(), ::error(), ::ldebug(), ::panic() methods of this
. class through 'BX_INFO(), BX_ERROR(), BX_DEBUG(), BX_PANIC()' macros
. respectively.
.
. An example usage:
. BX_INFO(("Hello, World!\n"));
iofunctions:: is a class that is allocated once by default, and assigned
as the iofunction of each logfunctions instance. It is this class that
maintains the file descriptor and other output related code, at this
point using vfprintf(). At some future point, someone may choose to
write a gui 'console' for bochs to which messages would be redirected
simply by assigning a different iofunction class to the various logfunctions
objects.
More cleanup is coming, but this works for now. If you want to see alot
of debugging output, in main.cc, change onoff[LOGLEV_DEBUG]=0 to =1.
Comments, bugs, flames, to me: todd@fries.net
2001-05-15 18:49:57 +04:00
|
|
|
#define LOG_THIS BX_CPU_THIS_PTR
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2008-04-03 21:44:33 +04:00
|
|
|
//
|
|
|
|
// 16 bit address size
|
|
|
|
//
|
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
2008-05-02 00:08:37 +04:00
|
|
|
BX_CPU_C::BxResolve16BaseIndex(bxInstruction_c *i)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
2009-01-12 23:14:37 +03:00
|
|
|
return (Bit16u) (BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + i->displ16s());
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|
2008-04-03 21:44:33 +04:00
|
|
|
|
|
|
|
//
|
|
|
|
// 32 bit address size
|
|
|
|
//
|
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
2008-04-03 21:44:33 +04:00
|
|
|
BX_CPU_C::BxResolve32Base(bxInstruction_c *i)
|
|
|
|
{
|
2009-01-12 23:14:37 +03:00
|
|
|
return (Bit32u) (BX_READ_32BIT_REG(i->sibBase()) + i->displ32s());
|
2008-04-03 21:44:33 +04:00
|
|
|
}
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
2008-04-03 21:44:33 +04:00
|
|
|
BX_CPU_C::BxResolve32BaseIndex(bxInstruction_c *i)
|
|
|
|
{
|
2009-01-12 23:14:37 +03:00
|
|
|
return (Bit32u) (BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + i->displ32s());
|
2008-04-03 21:44:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// 64 bit address size
|
|
|
|
//
|
|
|
|
|
|
|
|
#if BX_SUPPORT_X86_64
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
2008-04-03 21:44:33 +04:00
|
|
|
BX_CPU_C::BxResolve64Base(bxInstruction_c *i)
|
|
|
|
{
|
2009-01-12 23:14:37 +03:00
|
|
|
return BX_READ_64BIT_REG(i->sibBase()) + i->displ32s();
|
2008-04-03 21:44:33 +04:00
|
|
|
}
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
2008-04-03 21:44:33 +04:00
|
|
|
BX_CPU_C::BxResolve64BaseIndex(bxInstruction_c *i)
|
|
|
|
{
|
2009-01-12 23:14:37 +03:00
|
|
|
return BX_READ_64BIT_REG(i->sibBase()) + (BX_READ_64BIT_REG(i->sibIndex()) << i->sibScale()) + i->displ32s();
|
2008-04-03 21:44:33 +04:00
|
|
|
}
|
|
|
|
#endif
|