optimize LEAVE operation
This commit is contained in:
parent
b1da3d7d46
commit
a5a01c4b42
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.h,v 1.513 2008-08-24 17:29:17 sshwarts Exp $
|
||||
// $Id: cpu.h,v 1.514 2008-08-27 21:57:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1257,7 +1257,8 @@ public: // for now...
|
||||
|
||||
BX_SMF void ENTER16_IwIb(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
BX_SMF void ENTER32_IwIb(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
BX_SMF void LEAVE(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
BX_SMF void LEAVE16(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
BX_SMF void LEAVE32(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
|
||||
BX_SMF void INT1(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
BX_SMF void INT3(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: exception.cc,v 1.120 2008-08-13 21:51:54 sshwarts Exp $
|
||||
// $Id: exception.cc,v 1.121 2008-08-27 21:57:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -831,7 +831,6 @@ void BX_CPU_C::exception(unsigned vector, Bit16u error_code, bx_bool trap)
|
||||
unsigned exception_type = 0, exception_class = BX_EXCEPTION_CLASS_FAULT;
|
||||
bx_bool push_error = 0;
|
||||
|
||||
invalidate_prefetch_q();
|
||||
BX_INSTR_EXCEPTION(BX_CPU_ID, vector);
|
||||
|
||||
#if BX_DEBUGGER
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: fetchdecode.cc,v 1.204 2008-08-23 22:27:58 sshwarts Exp $
|
||||
// $Id: fetchdecode.cc,v 1.205 2008-08-27 21:57:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -398,7 +398,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32R[512*2] = {
|
||||
/* C6 /wr */ { BxGroup11, BX_IA_ERROR, BxOpcodeInfoG11EbR },
|
||||
/* C7 /wr */ { BxGroup11, BX_IA_ERROR, BxOpcodeInfoG11EwR },
|
||||
/* C8 /wr */ { BxImmediate_IwIb, BX_IA_ENTER16_IwIb },
|
||||
/* C9 /wr */ { 0, BX_IA_LEAVE },
|
||||
/* C9 /wr */ { 0, BX_IA_LEAVE16 },
|
||||
/* CA /wr */ { BxImmediate_Iw | BxTraceEnd, BX_IA_RETfar16_Iw },
|
||||
/* CB /wr */ { BxTraceEnd, BX_IA_RETfar16 },
|
||||
/* CC /wr */ { BxTraceEnd, BX_IA_INT3 },
|
||||
@ -961,7 +961,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32R[512*2] = {
|
||||
/* C6 /dr */ { BxGroup11, BX_IA_ERROR, BxOpcodeInfoG11EbR },
|
||||
/* C7 /dr */ { BxGroup11, BX_IA_ERROR, BxOpcodeInfoG11EdR },
|
||||
/* C8 /dr */ { BxImmediate_IwIb, BX_IA_ENTER32_IwIb },
|
||||
/* C9 /dr */ { 0, BX_IA_LEAVE },
|
||||
/* C9 /dr */ { 0, BX_IA_LEAVE32 },
|
||||
/* CA /dr */ { BxImmediate_Iw | BxTraceEnd, BX_IA_RETfar32_Iw },
|
||||
/* CB /dr */ { BxTraceEnd, BX_IA_RETfar32 },
|
||||
/* CC /dr */ { BxTraceEnd, BX_IA_INT3 },
|
||||
@ -1531,7 +1531,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32M[512*2] = {
|
||||
/* C6 /wm */ { BxGroup11, BX_IA_ERROR, BxOpcodeInfoG11EbM },
|
||||
/* C7 /wm */ { BxGroup11, BX_IA_ERROR, BxOpcodeInfoG11EwM },
|
||||
/* C8 /wm */ { BxImmediate_IwIb, BX_IA_ENTER16_IwIb },
|
||||
/* C9 /wm */ { 0, BX_IA_LEAVE },
|
||||
/* C9 /wm */ { 0, BX_IA_LEAVE16 },
|
||||
/* CA /wm */ { BxImmediate_Iw | BxTraceEnd, BX_IA_RETfar16_Iw },
|
||||
/* CB /wm */ { BxTraceEnd, BX_IA_RETfar16 },
|
||||
/* CC /wm */ { BxTraceEnd, BX_IA_INT3 },
|
||||
@ -2094,7 +2094,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32M[512*2] = {
|
||||
/* C6 /dm */ { BxGroup11, BX_IA_ERROR, BxOpcodeInfoG11EbM },
|
||||
/* C7 /dm */ { BxGroup11, BX_IA_ERROR, BxOpcodeInfoG11EdM },
|
||||
/* C8 /dm */ { BxImmediate_IwIb, BX_IA_ENTER32_IwIb },
|
||||
/* C9 /dm */ { 0, BX_IA_LEAVE },
|
||||
/* C9 /dm */ { 0, BX_IA_LEAVE32 },
|
||||
/* CA /dm */ { BxImmediate_Iw | BxTraceEnd, BX_IA_RETfar32_Iw },
|
||||
/* CB /dm */ { BxTraceEnd, BX_IA_RETfar32 },
|
||||
/* CC /dm */ { BxTraceEnd, BX_IA_INT3 },
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ia_opcodes.h,v 1.17 2008-08-11 20:34:05 sshwarts Exp $
|
||||
// $Id: ia_opcodes.h,v 1.18 2008-08-27 21:57:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2008 Stanislav Shwartsman
|
||||
@ -360,7 +360,8 @@ bx_define_opcode(BX_IA_LDS_GdMp, &BX_CPU_C::LDS_GdMp, NULL, 0)
|
||||
bx_define_opcode(BX_IA_LDS_GwMp, &BX_CPU_C::LDS_GwMp, NULL, 0)
|
||||
bx_define_opcode(BX_IA_LEA_GdM, &BX_CPU_C::LEA_GdM, NULL, 0)
|
||||
bx_define_opcode(BX_IA_LEA_GwM, &BX_CPU_C::LEA_GwM, NULL, 0)
|
||||
bx_define_opcode(BX_IA_LEAVE, &BX_CPU_C::LEAVE, NULL, 0)
|
||||
bx_define_opcode(BX_IA_LEAVE16, &BX_CPU_C::LEAVE16, NULL, 0)
|
||||
bx_define_opcode(BX_IA_LEAVE32, &BX_CPU_C::LEAVE32, NULL, 0)
|
||||
bx_define_opcode(BX_IA_LES_GdMp, &BX_CPU_C::LES_GdMp, NULL, 0)
|
||||
bx_define_opcode(BX_IA_LES_GwMp, &BX_CPU_C::LES_GwMp, NULL, 0)
|
||||
bx_define_opcode(BX_IA_LFS_GdMp, &BX_CPU_C::LFS_GdMp, NULL, 0)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: stack16.cc,v 1.42 2008-08-08 09:22:49 sshwarts Exp $
|
||||
// $Id: stack16.cc,v 1.43 2008-08-27 21:57:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -303,3 +303,21 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::ENTER16_IwIb(bxInstruction_c *i)
|
||||
|
||||
BX_CPU_THIS_PTR speculative_rsp = 0;
|
||||
}
|
||||
|
||||
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LEAVE16(bxInstruction_c *i)
|
||||
{
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
Bit16u value16;
|
||||
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) {
|
||||
value16 = read_virtual_word_32(BX_SEG_REG_SS, EBP);
|
||||
ESP = EBP + 2;
|
||||
}
|
||||
else {
|
||||
value16 = read_virtual_word_32(BX_SEG_REG_SS, BP);
|
||||
SP = BP + 2;
|
||||
}
|
||||
|
||||
BP = value16;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: stack32.cc,v 1.55 2008-08-08 09:22:49 sshwarts Exp $
|
||||
// $Id: stack32.cc,v 1.56 2008-08-27 21:57:40 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -302,22 +302,20 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::ENTER32_IwIb(bxInstruction_c *i)
|
||||
BX_CPU_THIS_PTR speculative_rsp = 0;
|
||||
}
|
||||
|
||||
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LEAVE(bxInstruction_c *i)
|
||||
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LEAVE32(bxInstruction_c *i)
|
||||
{
|
||||
BX_CPU_THIS_PTR speculative_rsp = 1;
|
||||
BX_CPU_THIS_PTR prev_rsp = RSP;
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
// delete frame
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b)
|
||||
ESP = EBP;
|
||||
else
|
||||
SP = BP;
|
||||
Bit32u value32;
|
||||
|
||||
// restore frame pointer
|
||||
if (i->os32L())
|
||||
EBP = pop_32();
|
||||
else
|
||||
BP = pop_16();
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) {
|
||||
value32 = read_virtual_dword_32(BX_SEG_REG_SS, EBP);
|
||||
ESP = EBP + 4;
|
||||
}
|
||||
else {
|
||||
value32 = read_virtual_dword_32(BX_SEG_REG_SS, BP);
|
||||
SP = BP + 4;
|
||||
}
|
||||
|
||||
BX_CPU_THIS_PTR speculative_rsp = 0;
|
||||
EBP = value32;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user