Fixed problem in my morning checkin + some more changes

This commit is contained in:
Stanislav Shwartsman 2008-06-23 15:58:22 +00:00
parent a6fda9a971
commit b65816a92d
4 changed files with 317 additions and 172 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ctrl_xfer16.cc,v 1.57 2008-06-22 03:45:53 sshwarts Exp $
// $Id: ctrl_xfer16.cc,v 1.58 2008-06-23 15:58:21 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -110,7 +110,6 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::RETnear16(bxInstruction_c *i)
void BX_CPP_AttrRegparmN(1) BX_CPU_C::RETfar16_Iw(bxInstruction_c *i)
{
Bit16s imm16;
Bit16u ip, cs_raw;
invalidate_prefetch_q();
@ -119,7 +118,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::RETfar16_Iw(bxInstruction_c *i)
BX_CPU_THIS_PTR show_flag |= Flag_ret;
#endif
imm16 = i->Iw();
Bit16s imm16 = (Bit16s) i->Iw();
BX_CPU_THIS_PTR speculative_rsp = 1;
BX_CPU_THIS_PTR prev_rsp = RSP;
@ -132,6 +131,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::RETfar16_Iw(bxInstruction_c *i)
ip = pop_16();
cs_raw = pop_16();
// CS.LIMIT can't change when in real/v8086 mode
if (ip > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
BX_ERROR(("RETfar16_Iw: instruction pointer not within code segment limits"));
exception(BX_GP_EXCEPTION, 0, 0);
}
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS], cs_raw);
RIP = (Bit32u) ip;
@ -169,6 +174,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::RETfar16(bxInstruction_c *i)
ip = pop_16();
cs_raw = pop_16();
// CS.LIMIT can't change when in real/v8086 mode
if (ip > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
BX_ERROR(("RETfar16: instruction pointer not within code segment limits"));
exception(BX_GP_EXCEPTION, 0, 0);
}
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS], cs_raw);
RIP = (Bit32u) ip;
@ -203,17 +214,14 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL_Jw(bxInstruction_c *i)
void BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL16_Ap(bxInstruction_c *i)
{
Bit16u cs_raw;
Bit16u disp16;
invalidate_prefetch_q();
#if BX_DEBUGGER
BX_CPU_THIS_PTR show_flag |= Flag_call;
#endif
disp16 = i->Iw();
cs_raw = i->Iw2();
Bit16u disp16 = i->Iw();
Bit16u cs_raw = i->Iw2();
BX_CPU_THIS_PTR speculative_rsp = 1;
BX_CPU_THIS_PTR prev_rsp = RSP;
@ -224,7 +232,13 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL16_Ap(bxInstruction_c *i)
}
push_16(BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value);
push_16((Bit16u) EIP);
push_16(IP);
// CS.LIMIT can't change when in real/v8086 mode
if (disp16 > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
BX_ERROR(("CALL16_Ap: instruction pointer not within code segment limits"));
exception(BX_GP_EXCEPTION, 0, 0);
}
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS], cs_raw);
RIP = (Bit32u) disp16;
@ -306,6 +320,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL16_Ep(bxInstruction_c *i)
push_16(BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value);
push_16(IP);
// CS.LIMIT can't change when in real/v8086 mode
if (op1_16 > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
BX_ERROR(("CALL16_Ep: instruction pointer not within code segment limits"));
exception(BX_GP_EXCEPTION, 0, 0);
}
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS], cs_raw);
RIP = op1_16;
@ -330,10 +350,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JO_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNO_Jw(bxInstruction_c *i)
@ -342,10 +364,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNO_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JB_Jw(bxInstruction_c *i)
@ -354,10 +378,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JB_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNB_Jw(bxInstruction_c *i)
@ -366,10 +392,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNB_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JZ_Jw(bxInstruction_c *i)
@ -378,10 +406,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JZ_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNZ_Jw(bxInstruction_c *i)
@ -390,10 +420,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNZ_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JBE_Jw(bxInstruction_c *i)
@ -402,10 +434,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JBE_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNBE_Jw(bxInstruction_c *i)
@ -414,10 +448,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNBE_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JS_Jw(bxInstruction_c *i)
@ -426,10 +462,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JS_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNS_Jw(bxInstruction_c *i)
@ -438,10 +476,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNS_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JP_Jw(bxInstruction_c *i)
@ -450,10 +490,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JP_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNP_Jw(bxInstruction_c *i)
@ -462,10 +504,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNP_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JL_Jw(bxInstruction_c *i)
@ -474,10 +518,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JL_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNL_Jw(bxInstruction_c *i)
@ -486,10 +532,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNL_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JLE_Jw(bxInstruction_c *i)
@ -498,10 +546,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JLE_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNLE_Jw(bxInstruction_c *i)
@ -510,10 +560,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNLE_Jw(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JMP_EwM(bxInstruction_c *i)
@ -552,10 +604,17 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JMP16_Ep(bxInstruction_c *i)
goto done;
}
// CS.LIMIT can't change when in real/v8086 mode
if (op1_16 > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
BX_ERROR(("JMP16_Ep: instruction pointer not within code segment limits"));
exception(BX_GP_EXCEPTION, 0, 0);
}
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS], cs_raw);
RIP = op1_16;
done:
BX_INSTR_FAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_JMP,
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value, EIP);
}
@ -587,9 +646,15 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::IRET16(bxInstruction_c *i)
}
ip = pop_16();
cs_raw = pop_16();
cs_raw = pop_16(); // #SS has higher priority
flags = pop_16();
// CS.LIMIT can't change when in real/v8086 mode
if(ip > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
BX_ERROR(("IRET16: instruction pointer not within code segment limits"));
exception(BX_GP_EXCEPTION, 0, 0);
}
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS], cs_raw);
RIP = (Bit32u) ip;
write_flags(flags, /* change IOPL? */ 1, /* change IF? */ 1);
@ -617,10 +682,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JCXZ_Jb(bxInstruction_c *i)
Bit16u new_IP = (Bit16u)(IP + (Bit32s) i->Id());
branch_near16(new_IP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_IP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
//

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ctrl_xfer32.cc,v 1.74 2008-06-22 03:45:53 sshwarts Exp $
// $Id: ctrl_xfer32.cc,v 1.75 2008-06-23 15:58:22 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -125,7 +125,8 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::RETfar32_Iw(bxInstruction_c *i)
goto done;
}
eip = pop_32();
eip = pop_32();
cs_raw = (Bit16u) pop_32(); /* 32bit pop, MSW discarded */
// CS.LIMIT can't change when in real/v8086 mode
if (eip > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
@ -133,8 +134,6 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::RETfar32_Iw(bxInstruction_c *i)
exception(BX_GP_EXCEPTION, 0, 0);
}
cs_raw = (Bit16u) pop_32(); /* 32bit pop, MSW discarded */
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS], cs_raw);
RIP = eip;
@ -339,9 +338,7 @@ done:
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JMP_Jd(bxInstruction_c *i)
{
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_UCNEAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_JMP, new_EIP);
}
@ -351,10 +348,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JO_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNO_Jd(bxInstruction_c *i)
@ -363,10 +362,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNO_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JB_Jd(bxInstruction_c *i)
@ -375,10 +376,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JB_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNB_Jd(bxInstruction_c *i)
@ -387,10 +390,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNB_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JZ_Jd(bxInstruction_c *i)
@ -399,10 +404,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JZ_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNZ_Jd(bxInstruction_c *i)
@ -411,10 +418,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNZ_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JBE_Jd(bxInstruction_c *i)
@ -423,10 +432,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JBE_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNBE_Jd(bxInstruction_c *i)
@ -435,10 +446,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNBE_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JS_Jd(bxInstruction_c *i)
@ -447,10 +460,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JS_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNS_Jd(bxInstruction_c *i)
@ -459,10 +474,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNS_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JP_Jd(bxInstruction_c *i)
@ -471,10 +488,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JP_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNP_Jd(bxInstruction_c *i)
@ -483,10 +502,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNP_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JL_Jd(bxInstruction_c *i)
@ -495,10 +516,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JL_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNL_Jd(bxInstruction_c *i)
@ -507,10 +530,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNL_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JLE_Jd(bxInstruction_c *i)
@ -519,10 +544,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JLE_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNLE_Jd(bxInstruction_c *i)
@ -531,10 +558,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNLE_Jd(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JMP_Ap(bxInstruction_c *i)
@ -650,7 +679,9 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::IRET32(bxInstruction_c *i)
goto done;
}
eip = pop_32();
eip = pop_32();
cs_raw = (Bit16u) pop_32(); // #SS has higher priority
eflags32 = pop_32();
// CS.LIMIT can't change when in real/v8086 mode
if (eip > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
@ -658,9 +689,6 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::IRET32(bxInstruction_c *i)
exception(BX_GP_EXCEPTION, 0, 0);
}
cs_raw = (Bit16u) pop_32();
eflags32 = pop_32();
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS], cs_raw);
RIP = eip;
writeEFlags(eflags32, 0x00257fd5); // VIF, VIP, VM unchanged
@ -688,10 +716,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JECXZ_Jb(bxInstruction_c *i)
Bit32u new_EIP = EIP + (Bit32s) i->Id();
branch_near32(new_EIP);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
//

View File

@ -1,5 +1,5 @@
////////c/////////////////////////////////////////////////////////////////
// $Id: ctrl_xfer64.cc,v 1.69 2008-06-22 03:45:53 sshwarts Exp $
// $Id: ctrl_xfer64.cc,v 1.70 2008-06-23 15:58:22 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -240,9 +240,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JO_Jq(bxInstruction_c *i)
if (get_OF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNO_Jq(bxInstruction_c *i)
@ -250,9 +253,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNO_Jq(bxInstruction_c *i)
if (! get_OF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JB_Jq(bxInstruction_c *i)
@ -260,9 +266,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JB_Jq(bxInstruction_c *i)
if (get_CF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNB_Jq(bxInstruction_c *i)
@ -270,9 +279,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNB_Jq(bxInstruction_c *i)
if (! get_CF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JZ_Jq(bxInstruction_c *i)
@ -280,9 +292,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JZ_Jq(bxInstruction_c *i)
if (get_ZF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNZ_Jq(bxInstruction_c *i)
@ -290,9 +305,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNZ_Jq(bxInstruction_c *i)
if (! get_ZF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JBE_Jq(bxInstruction_c *i)
@ -300,9 +318,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JBE_Jq(bxInstruction_c *i)
if (get_CF() || get_ZF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNBE_Jq(bxInstruction_c *i)
@ -310,9 +331,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNBE_Jq(bxInstruction_c *i)
if (! (get_CF() || get_ZF())) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JS_Jq(bxInstruction_c *i)
@ -320,9 +344,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JS_Jq(bxInstruction_c *i)
if (get_SF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNS_Jq(bxInstruction_c *i)
@ -330,9 +357,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNS_Jq(bxInstruction_c *i)
if (! get_SF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JP_Jq(bxInstruction_c *i)
@ -340,9 +370,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JP_Jq(bxInstruction_c *i)
if (get_PF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNP_Jq(bxInstruction_c *i)
@ -350,9 +383,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNP_Jq(bxInstruction_c *i)
if (! get_PF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JL_Jq(bxInstruction_c *i)
@ -360,9 +396,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JL_Jq(bxInstruction_c *i)
if (getB_SF() != getB_OF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNL_Jq(bxInstruction_c *i)
@ -370,9 +409,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNL_Jq(bxInstruction_c *i)
if (getB_SF() == getB_OF()) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JLE_Jq(bxInstruction_c *i)
@ -380,9 +422,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JLE_Jq(bxInstruction_c *i)
if (get_ZF() || (getB_SF() != getB_OF())) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNLE_Jq(bxInstruction_c *i)
@ -390,9 +435,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::JNLE_Jq(bxInstruction_c *i)
if (! get_ZF() && (getB_SF() == getB_OF())) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JMP_EqM(bxInstruction_c *i)
@ -469,22 +517,22 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::IRET64(bxInstruction_c *i)
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JRCXZ_Jb(bxInstruction_c *i)
{
if (i->as64L()) {
if (RCX == 0) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
}
else {
if (ECX == 0) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
return;
}
}
Bit64u temp_RCX;
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
if (i->as64L())
temp_RCX = RCX;
else
temp_RCX = ECX;
if (temp_RCX == 0) {
branch_near64(i);
BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, RIP);
}
#if BX_INSTRUMENTATION
else {
BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID);
}
#endif
}
//

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.243 2008-06-23 02:56:31 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.244 2008-06-23 15:58:22 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -645,7 +645,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_RdCd(bxInstruction_c *i)
val_32 = (Bit32u) BX_CPU_THIS_PTR cr3;
break;
case 4: // CR4
#if BX_CPU_LEVEL < 4
#if BX_CPU_LEVEL > 3
BX_DEBUG(("MOV_RdCd: read of CR4"));
val_32 = BX_CPU_THIS_PTR cr4.getRegister();
#endif