1 |
2 |
alfik |
/////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// $Id: resolver.cc 10208 2011-02-24 21:54:04Z sshwarts $
|
3 |
|
|
/////////////////////////////////////////////////////////////////////////
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2008-2009 Stanislav Shwartsman
|
6 |
|
|
// Written by Stanislav Shwartsman [sshwarts at sourceforge net]
|
7 |
|
|
//
|
8 |
|
|
// This library is free software; you can redistribute it and/or
|
9 |
|
|
// modify it under the terms of the GNU Lesser General Public
|
10 |
|
|
// License as published by the Free Software Foundation; either
|
11 |
|
|
// version 2 of the License, or (at your option) any later version.
|
12 |
|
|
//
|
13 |
|
|
// This library is distributed in the hope that it will be useful,
|
14 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
16 |
|
|
// Lesser General Public License for more details.
|
17 |
|
|
//
|
18 |
|
|
// You should have received a copy of the GNU Lesser General Public
|
19 |
|
|
// License along with this library; if not, write to the Free Software
|
20 |
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
|
21 |
|
|
//
|
22 |
|
|
/////////////////////////////////////////////////////////////////////////
|
23 |
|
|
|
24 |
|
|
#define NEED_CPU_REG_SHORTCUTS 1
|
25 |
|
|
#include "bochs.h"
|
26 |
|
|
#include "cpu.h"
|
27 |
|
|
#define LOG_THIS BX_CPU_THIS_PTR
|
28 |
|
|
|
29 |
|
|
//
|
30 |
|
|
// 16 bit address size
|
31 |
|
|
//
|
32 |
|
|
|
33 |
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
34 |
|
|
BX_CPU_C::BxResolve16BaseIndex(bxInstruction_c *i)
|
35 |
|
|
{
|
36 |
|
|
return (Bit16u) (BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + i->displ16s());
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
//
|
40 |
|
|
// 32 bit address size
|
41 |
|
|
//
|
42 |
|
|
|
43 |
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
44 |
|
|
BX_CPU_C::BxResolve32Base(bxInstruction_c *i)
|
45 |
|
|
{
|
46 |
|
|
return (Bit32u) (BX_READ_32BIT_REG(i->sibBase()) + i->displ32s());
|
47 |
|
|
}
|
48 |
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
49 |
|
|
BX_CPU_C::BxResolve32BaseIndex(bxInstruction_c *i)
|
50 |
|
|
{
|
51 |
|
|
return (Bit32u) (BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + i->displ32s());
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
//
|
55 |
|
|
// 64 bit address size
|
56 |
|
|
//
|
57 |
|
|
|
58 |
|
|
#if BX_SUPPORT_X86_64
|
59 |
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
60 |
|
|
BX_CPU_C::BxResolve64Base(bxInstruction_c *i)
|
61 |
|
|
{
|
62 |
|
|
return BX_READ_64BIT_REG(i->sibBase()) + i->displ32s();
|
63 |
|
|
}
|
64 |
|
|
bx_address BX_CPP_AttrRegparmN(1)
|
65 |
|
|
BX_CPU_C::BxResolve64BaseIndex(bxInstruction_c *i)
|
66 |
|
|
{
|
67 |
|
|
return BX_READ_64BIT_REG(i->sibBase()) + (BX_READ_64BIT_REG(i->sibIndex()) << i->sibScale()) + i->displ32s();
|
68 |
|
|
}
|
69 |
|
|
#endif
|