optimization

This commit is contained in:
Stanislav Shwartsman 2010-03-18 15:19:16 +00:00
parent 78badcbde4
commit d0bd30e4b9
4 changed files with 12 additions and 30 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.655 2010-03-17 21:55:18 sshwarts Exp $
// $Id: cpu.h,v 1.656 2010-03-18 15:19:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -977,9 +977,6 @@ public: // for now...
jmp_buf jmp_buf_env;
Bit8u curr_exception;
bx_address save_eip;
bx_address save_esp;
// Boundaries of current page, based on EIP
bx_address eipPageBias;
Bit32u eipPageWindowSize;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: exception.cc,v 1.153 2010-03-17 21:55:18 sshwarts Exp $
// $Id: exception.cc,v 1.154 2010-03-18 15:19:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -354,6 +354,8 @@ void BX_CPU_C::protected_mode_int(Bit8u vector, unsigned soft_int, bx_bool push_
task_switch(0, &tss_selector, &tss_descriptor,
BX_TASK_FROM_INT, dword1, dword2);
RSP_SPECULATIVE;
// if interrupt was caused by fault with error code
// stack limits must allow push of 2 more bytes, else #SS(0)
// push error code onto stack
@ -371,6 +373,8 @@ void BX_CPU_C::protected_mode_int(Bit8u vector, unsigned soft_int, bx_bool push_
exception(BX_GP_EXCEPTION, 0);
}
RSP_COMMIT;
return;
case BX_286_INTERRUPT_GATE:
@ -780,9 +784,6 @@ void BX_CPU_C::interrupt(Bit8u vector, unsigned type, bx_bool push_error, Bit16u
BX_CPU_THIS_PTR debug_trap = 0;
BX_CPU_THIS_PTR inhibit_mask = 0;
BX_CPU_THIS_PTR save_eip = RIP;
BX_CPU_THIS_PTR save_esp = RSP;
#if BX_SUPPORT_VMX
BX_CPU_THIS_PTR in_event = 1;
#endif
@ -794,12 +795,16 @@ void BX_CPU_C::interrupt(Bit8u vector, unsigned type, bx_bool push_error, Bit16u
else
#endif
{
RSP_SPECULATIVE;
if(real_mode()) {
real_mode_int(vector, push_error, error_code);
}
else {
protected_mode_int(vector, soft_int, push_error, error_code);
}
RSP_COMMIT;
}
#if BX_X86_DEBUGGER
@ -891,11 +896,6 @@ void BX_CPU_C::exception(unsigned vector, Bit16u error_code)
#endif
if (BX_CPU_THIS_PTR errorno > 0) {
// if not initial error, restore previous register values from
// previous attempt to handle exception
RIP = BX_CPU_THIS_PTR save_eip;
RSP = BX_CPU_THIS_PTR save_esp;
if (BX_CPU_THIS_PTR errorno > 2 || BX_CPU_THIS_PTR curr_exception == BX_ET_DOUBLE_FAULT) {
debug(BX_CPU_THIS_PTR prev_rip); // print debug information to the log
#if BX_SUPPORT_VMX

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: soft_int.cc,v 1.59 2010-03-15 13:22:14 sshwarts Exp $
// $Id: soft_int.cc,v 1.60 2010-03-18 15:19:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -73,13 +73,9 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::INT1(bxInstruction_c *i)
BX_CPU_THIS_PTR EXT = 1;
RSP_SPECULATIVE;
// interrupt is not RSP safe
interrupt(1, BX_PRIVILEGED_SOFTWARE_INTERRUPT, 0, 0);
RSP_COMMIT;
BX_CPU_THIS_PTR EXT = 0;
BX_INSTR_FAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_INT,
@ -99,13 +95,9 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::INT3(bxInstruction_c *i)
BX_CPU_THIS_PTR show_flag |= Flag_softint;
#endif
RSP_SPECULATIVE;
// interrupt is not RSP safe
interrupt(3, BX_SOFTWARE_EXCEPTION, 0, 0);
RSP_COMMIT;
BX_INSTR_FAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_INT,
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value,
EIP);
@ -160,13 +152,9 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::INTO(bxInstruction_c *i)
BX_CPU_THIS_PTR show_flag |= Flag_softint;
#endif
RSP_SPECULATIVE;
// interrupt is not RSP safe
interrupt(4, BX_SOFTWARE_EXCEPTION, 0, 0);
RSP_COMMIT;
BX_INSTR_FAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_INT,
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value,
EIP);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: tasking.cc,v 1.85 2010-03-14 15:51:27 sshwarts Exp $
// $Id: tasking.cc,v 1.86 2010-03-18 15:19:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -435,9 +435,6 @@ void BX_CPU_C::task_switch(bxInstruction_c *i, bx_selector_t *tss_selector,
BX_CPU_THIS_PTR speculative_rsp = 0;
BX_CPU_THIS_PTR save_eip = EIP;
BX_CPU_THIS_PTR save_esp = ESP;
writeEFlags(newEFLAGS, EFlagsValidMask);
// Fill in selectors for all segment registers. If errors