1 /////////////////////////////////////////////////////////////////////////
2 // $Id: resolver.cc,v 1.1 2008/10/07 07:47:56 akrisak Exp $
3 /////////////////////////////////////////////////////////////////////////
5 // Copyright (c) 2008 Stanislav Shwartsman
6 // Written by Stanislav Shwartsman [sshwarts at sourceforge net]
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 /////////////////////////////////////////////////////////////////////////
24 #define NEED_CPU_REG_SHORTCUTS 1
27 #define LOG_THIS BX_CPU_THIS_PTR
30 // 16 bit address size
33 bx_address
BX_CPP_AttrRegparmN(1)
34 BX_CPU_C::BxResolve16BaseIndex(bxInstruction_c
*i
)
36 return (Bit16u
) (BX_READ_16BIT_REG(i
->sibBase()) + BX_READ_16BIT_REG(i
->sibIndex()) + (Bit16s
) i
->displ16u());
40 // 32 bit address size
43 bx_address
BX_CPP_AttrRegparmN(1)
44 BX_CPU_C::BxResolve32Base(bxInstruction_c
*i
)
46 return (Bit32u
) (BX_READ_32BIT_REG(i
->sibBase()) + (Bit32s
) i
->displ32u());
48 bx_address
BX_CPP_AttrRegparmN(1)
49 BX_CPU_C::BxResolve32BaseIndex(bxInstruction_c
*i
)
51 return (Bit32u
) (BX_READ_32BIT_REG(i
->sibBase()) + (BX_READ_32BIT_REG(i
->sibIndex()) << i
->sibScale()) + (Bit32s
) i
->displ32u());
55 // 64 bit address size
59 bx_address
BX_CPP_AttrRegparmN(1)
60 BX_CPU_C::BxResolve64Base(bxInstruction_c
*i
)
62 return BX_READ_64BIT_REG(i
->sibBase()) + (Bit32s
) i
->displ32u();
64 bx_address
BX_CPP_AttrRegparmN(1)
65 BX_CPU_C::BxResolve64BaseIndex(bxInstruction_c
*i
)
67 return BX_READ_64BIT_REG(i
->sibBase()) + (BX_READ_64BIT_REG(i
->sibIndex()) << i
->sibScale()) + (Bit32s
) i
->displ32u();