1
/////////////////////////////////////////////////////////////////////////
2
// $Id: ctrl_xfer8.cc,v 1.27 2008/03/22 21:29:39 sshwarts Exp $
3
/////////////////////////////////////////////////////////////////////////
5
// Copyright (C) 2001 MandrakeSoft S.A.
9
// 75002 Paris - France
10
// http://www.linux-mandrake.com/
11
// http://www.mandrakesoft.com/
13
// This library is free software; you can redistribute it and/or
14
// modify it under the terms of the GNU Lesser General Public
15
// License as published by the Free Software Foundation; either
16
// version 2 of the License, or (at your option) any later version.
18
// This library is distributed in the hope that it will be useful,
19
// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
// Lesser General Public License for more details.
23
// You should have received a copy of the GNU Lesser General Public
24
// License along with this library; if not, write to the Free Software
25
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
/////////////////////////////////////////////////////////////////////////
28
#define NEED_CPU_REG_SHORTCUTS 1
31
#define LOG_THIS BX_CPU_THIS_PTR
33
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JCXZ_Jb(bxInstruction_c *i)
35
// it is impossible to get this instruction in long mode
36
BX_ASSERT(i->as64L() == 0);
46
Bit32u new_EIP = EIP + (Bit32s) i->Id();
47
if (i->os32L()==0) new_EIP &= 0x0000ffff;
48
branch_near32(new_EIP);
49
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
53
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
57
// There is some weirdness in LOOP instructions definition. If an exception
58
// was generated during the instruction execution (for example #GP fault
59
// because EIP was beyond CS segment limits) CPU state should restore the
60
// state prior to instruction execution.
62
// The final point that we are not allowed to decrement ECX register before
63
// it is known that no exceptions can happen.
66
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOOPNE_Jb(bxInstruction_c *i)
68
// it is impossible to get this instruction in long mode
69
BX_ASSERT(i->as64L() == 0);
81
if ((count!=0) && (get_ZF()==0)) {
82
Bit32u new_EIP = EIP + (Bit32s) i->Id();
83
if (i->os32L()==0) new_EIP &= 0x0000ffff;
84
branch_near32(new_EIP);
85
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
87
#if BX_INSTRUMENTATION
89
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
99
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOOPE_Jb(bxInstruction_c *i)
101
// it is impossible to get this instruction in long mode
102
BX_ASSERT(i->as64L() == 0);
106
#if BX_CPU_LEVEL >= 3
114
if ((count!=0) && get_ZF()) {
115
Bit32u new_EIP = EIP + (Bit32s) i->Id();
116
if (i->os32L()==0) new_EIP &= 0x0000ffff;
117
branch_near32(new_EIP);
118
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
120
#if BX_INSTRUMENTATION
122
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
132
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOOP_Jb(bxInstruction_c *i)
134
// it is impossible to get this instruction in long mode
135
BX_ASSERT(i->as64L() == 0);
139
#if BX_CPU_LEVEL >= 3
148
Bit32u new_EIP = EIP + (Bit32s) i->Id();
149
if (i->os32L()==0) new_EIP &= 0x0000ffff;
150
branch_near32(new_EIP);
151
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
153
#if BX_INSTRUMENTATION
155
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);