1. Small optimization for lazy_flags.cc

2. Merge patch 1013516
Avoid invalidate_prefetch_q on enter, leave and cpuid
This commit is contained in:
Stanislav Shwartsman 2004-09-04 10:21:28 +00:00
parent defdbda939
commit 193c7332aa
4 changed files with 51 additions and 75 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: lazy_flags.cc,v 1.26 2004-08-31 19:43:58 sshwarts Exp $ // $Id: lazy_flags.cc,v 1.27 2004-09-04 10:21:15 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -79,23 +79,19 @@ bx_bool BX_CPU_C::get_CFLazy(void)
break; break;
#endif #endif
case BX_INSTR_SUB8: case BX_INSTR_SUB8:
case BX_INSTR_COMPARE8:
cf = (BX_CPU_THIS_PTR oszapc.op1_8 < cf = (BX_CPU_THIS_PTR oszapc.op1_8 <
BX_CPU_THIS_PTR oszapc.op2_8); BX_CPU_THIS_PTR oszapc.op2_8);
break; break;
case BX_INSTR_SUB16: case BX_INSTR_SUB16:
case BX_INSTR_COMPARE16:
cf = (BX_CPU_THIS_PTR oszapc.op1_16 < cf = (BX_CPU_THIS_PTR oszapc.op1_16 <
BX_CPU_THIS_PTR oszapc.op2_16); BX_CPU_THIS_PTR oszapc.op2_16);
break; break;
case BX_INSTR_SUB32: case BX_INSTR_SUB32:
case BX_INSTR_COMPARE32:
cf = (BX_CPU_THIS_PTR oszapc.op1_32 < cf = (BX_CPU_THIS_PTR oszapc.op1_32 <
BX_CPU_THIS_PTR oszapc.op2_32); BX_CPU_THIS_PTR oszapc.op2_32);
break; break;
#if BX_SUPPORT_X86_64 #if BX_SUPPORT_X86_64
case BX_INSTR_SUB64: case BX_INSTR_SUB64:
case BX_INSTR_COMPARE64:
cf = (BX_CPU_THIS_PTR oszapc.op1_64 < cf = (BX_CPU_THIS_PTR oszapc.op1_64 <
BX_CPU_THIS_PTR oszapc.op2_64); BX_CPU_THIS_PTR oszapc.op2_64);
break; break;
@ -290,7 +286,6 @@ bx_bool BX_CPU_C::get_AFLazy(void)
switch ( (BX_CPU_THIS_PTR lf_flags_status>>8) & 0x00000f ) { switch ( (BX_CPU_THIS_PTR lf_flags_status>>8) & 0x00000f ) {
case BX_LF_INDEX_OSZAPC: case BX_LF_INDEX_OSZAPC:
switch (BX_CPU_THIS_PTR oszapc.instr) { switch (BX_CPU_THIS_PTR oszapc.instr) {
case BX_INSTR_COMPARE8:
case BX_INSTR_ADD8: case BX_INSTR_ADD8:
case BX_INSTR_ADC8: case BX_INSTR_ADC8:
case BX_INSTR_SUB8: case BX_INSTR_SUB8:
@ -300,7 +295,6 @@ bx_bool BX_CPU_C::get_AFLazy(void)
BX_CPU_THIS_PTR oszapc.op2_8) ^ BX_CPU_THIS_PTR oszapc.op2_8) ^
BX_CPU_THIS_PTR oszapc.result_8) & 0x10; BX_CPU_THIS_PTR oszapc.result_8) & 0x10;
break; break;
case BX_INSTR_COMPARE16:
case BX_INSTR_ADD16: case BX_INSTR_ADD16:
case BX_INSTR_ADC16: case BX_INSTR_ADC16:
case BX_INSTR_SUB16: case BX_INSTR_SUB16:
@ -310,7 +304,6 @@ bx_bool BX_CPU_C::get_AFLazy(void)
BX_CPU_THIS_PTR oszapc.op2_16) ^ BX_CPU_THIS_PTR oszapc.op2_16) ^
BX_CPU_THIS_PTR oszapc.result_16) & 0x10; BX_CPU_THIS_PTR oszapc.result_16) & 0x10;
break; break;
case BX_INSTR_COMPARE32:
case BX_INSTR_ADD32: case BX_INSTR_ADD32:
case BX_INSTR_ADC32: case BX_INSTR_ADC32:
case BX_INSTR_SUB32: case BX_INSTR_SUB32:
@ -321,7 +314,6 @@ bx_bool BX_CPU_C::get_AFLazy(void)
BX_CPU_THIS_PTR oszapc.result_32) & 0x10; BX_CPU_THIS_PTR oszapc.result_32) & 0x10;
break; break;
#if BX_SUPPORT_X86_64 #if BX_SUPPORT_X86_64
case BX_INSTR_COMPARE64:
case BX_INSTR_ADD64: case BX_INSTR_ADD64:
case BX_INSTR_ADC64: case BX_INSTR_ADC64:
case BX_INSTR_SUB64: case BX_INSTR_SUB64:
@ -445,7 +437,6 @@ bx_bool BX_CPU_C::get_ZFLazy(void)
case BX_INSTR_ADC8: case BX_INSTR_ADC8:
case BX_INSTR_SUB8: case BX_INSTR_SUB8:
case BX_INSTR_SBB8: case BX_INSTR_SBB8:
case BX_INSTR_COMPARE8:
case BX_INSTR_NEG8: case BX_INSTR_NEG8:
case BX_INSTR_SAR8: case BX_INSTR_SAR8:
case BX_INSTR_SHR8: case BX_INSTR_SHR8:
@ -457,7 +448,6 @@ bx_bool BX_CPU_C::get_ZFLazy(void)
case BX_INSTR_ADC16: case BX_INSTR_ADC16:
case BX_INSTR_SUB16: case BX_INSTR_SUB16:
case BX_INSTR_SBB16: case BX_INSTR_SBB16:
case BX_INSTR_COMPARE16:
case BX_INSTR_NEG16: case BX_INSTR_NEG16:
case BX_INSTR_SAR16: case BX_INSTR_SAR16:
case BX_INSTR_SHR16: case BX_INSTR_SHR16:
@ -469,7 +459,6 @@ bx_bool BX_CPU_C::get_ZFLazy(void)
case BX_INSTR_ADC32: case BX_INSTR_ADC32:
case BX_INSTR_SUB32: case BX_INSTR_SUB32:
case BX_INSTR_SBB32: case BX_INSTR_SBB32:
case BX_INSTR_COMPARE32:
case BX_INSTR_NEG32: case BX_INSTR_NEG32:
case BX_INSTR_SAR32: case BX_INSTR_SAR32:
case BX_INSTR_SHR32: case BX_INSTR_SHR32:
@ -482,7 +471,6 @@ bx_bool BX_CPU_C::get_ZFLazy(void)
case BX_INSTR_ADC64: case BX_INSTR_ADC64:
case BX_INSTR_SUB64: case BX_INSTR_SUB64:
case BX_INSTR_SBB64: case BX_INSTR_SBB64:
case BX_INSTR_COMPARE64:
case BX_INSTR_NEG64: case BX_INSTR_NEG64:
case BX_INSTR_SAR64: case BX_INSTR_SAR64:
case BX_INSTR_SHR64: case BX_INSTR_SHR64:
@ -571,7 +559,6 @@ bx_bool BX_CPU_C::get_SFLazy(void)
case BX_INSTR_ADC8: case BX_INSTR_ADC8:
case BX_INSTR_SUB8: case BX_INSTR_SUB8:
case BX_INSTR_SBB8: case BX_INSTR_SBB8:
case BX_INSTR_COMPARE8:
case BX_INSTR_NEG8: case BX_INSTR_NEG8:
case BX_INSTR_SAR8: case BX_INSTR_SAR8:
case BX_INSTR_SHR8: case BX_INSTR_SHR8:
@ -583,7 +570,6 @@ bx_bool BX_CPU_C::get_SFLazy(void)
case BX_INSTR_ADC16: case BX_INSTR_ADC16:
case BX_INSTR_SUB16: case BX_INSTR_SUB16:
case BX_INSTR_SBB16: case BX_INSTR_SBB16:
case BX_INSTR_COMPARE16:
case BX_INSTR_NEG16: case BX_INSTR_NEG16:
case BX_INSTR_SAR16: case BX_INSTR_SAR16:
case BX_INSTR_SHR16: case BX_INSTR_SHR16:
@ -596,7 +582,6 @@ bx_bool BX_CPU_C::get_SFLazy(void)
case BX_INSTR_ADC32: case BX_INSTR_ADC32:
case BX_INSTR_SUB32: case BX_INSTR_SUB32:
case BX_INSTR_SBB32: case BX_INSTR_SBB32:
case BX_INSTR_COMPARE32:
case BX_INSTR_NEG32: case BX_INSTR_NEG32:
case BX_INSTR_SAR32: case BX_INSTR_SAR32:
case BX_INSTR_SHR32: case BX_INSTR_SHR32:
@ -610,7 +595,6 @@ bx_bool BX_CPU_C::get_SFLazy(void)
case BX_INSTR_ADC64: case BX_INSTR_ADC64:
case BX_INSTR_SUB64: case BX_INSTR_SUB64:
case BX_INSTR_SBB64: case BX_INSTR_SBB64:
case BX_INSTR_COMPARE64:
case BX_INSTR_NEG64: case BX_INSTR_NEG64:
case BX_INSTR_SAR64: case BX_INSTR_SAR64:
case BX_INSTR_SHR64: case BX_INSTR_SHR64:
@ -726,7 +710,6 @@ bx_bool BX_CPU_C::get_OFLazy(void)
#endif #endif
case BX_INSTR_SUB8: case BX_INSTR_SUB8:
case BX_INSTR_SBB8: case BX_INSTR_SBB8:
case BX_INSTR_COMPARE8:
op1_b7 = BX_CPU_THIS_PTR oszapc.op1_8 & 0x80; op1_b7 = BX_CPU_THIS_PTR oszapc.op1_8 & 0x80;
op2_b7 = BX_CPU_THIS_PTR oszapc.op2_8 & 0x80; op2_b7 = BX_CPU_THIS_PTR oszapc.op2_8 & 0x80;
result_b7 = BX_CPU_THIS_PTR oszapc.result_8 & 0x80; result_b7 = BX_CPU_THIS_PTR oszapc.result_8 & 0x80;
@ -734,7 +717,6 @@ bx_bool BX_CPU_C::get_OFLazy(void)
break; break;
case BX_INSTR_SUB16: case BX_INSTR_SUB16:
case BX_INSTR_SBB16: case BX_INSTR_SBB16:
case BX_INSTR_COMPARE16:
op1_b15 = BX_CPU_THIS_PTR oszapc.op1_16 & 0x8000; op1_b15 = BX_CPU_THIS_PTR oszapc.op1_16 & 0x8000;
op2_b15 = BX_CPU_THIS_PTR oszapc.op2_16 & 0x8000; op2_b15 = BX_CPU_THIS_PTR oszapc.op2_16 & 0x8000;
result_b15 = BX_CPU_THIS_PTR oszapc.result_16 & 0x8000; result_b15 = BX_CPU_THIS_PTR oszapc.result_16 & 0x8000;
@ -742,7 +724,6 @@ bx_bool BX_CPU_C::get_OFLazy(void)
break; break;
case BX_INSTR_SUB32: case BX_INSTR_SUB32:
case BX_INSTR_SBB32: case BX_INSTR_SBB32:
case BX_INSTR_COMPARE32:
op1_b31 = BX_CPU_THIS_PTR oszapc.op1_32 & 0x80000000; op1_b31 = BX_CPU_THIS_PTR oszapc.op1_32 & 0x80000000;
op2_b31 = BX_CPU_THIS_PTR oszapc.op2_32 & 0x80000000; op2_b31 = BX_CPU_THIS_PTR oszapc.op2_32 & 0x80000000;
result_b31 = BX_CPU_THIS_PTR oszapc.result_32 & 0x80000000; result_b31 = BX_CPU_THIS_PTR oszapc.result_32 & 0x80000000;
@ -751,7 +732,6 @@ bx_bool BX_CPU_C::get_OFLazy(void)
#if BX_SUPPORT_X86_64 #if BX_SUPPORT_X86_64
case BX_INSTR_SUB64: case BX_INSTR_SUB64:
case BX_INSTR_SBB64: case BX_INSTR_SBB64:
case BX_INSTR_COMPARE64:
op1_b63 = BX_CPU_THIS_PTR oszapc.op1_64 & BX_CONST64(0x8000000000000000); op1_b63 = BX_CPU_THIS_PTR oszapc.op1_64 & BX_CONST64(0x8000000000000000);
op2_b63 = BX_CPU_THIS_PTR oszapc.op2_64 & BX_CONST64(0x8000000000000000); op2_b63 = BX_CPU_THIS_PTR oszapc.op2_64 & BX_CONST64(0x8000000000000000);
result_b63 = BX_CPU_THIS_PTR oszapc.result_64 & BX_CONST64(0x8000000000000000); result_b63 = BX_CPU_THIS_PTR oszapc.result_64 & BX_CONST64(0x8000000000000000);
@ -957,7 +937,6 @@ bx_bool BX_CPU_C::get_PFLazy(void)
case BX_INSTR_ADC8: case BX_INSTR_ADC8:
case BX_INSTR_SUB8: case BX_INSTR_SUB8:
case BX_INSTR_SBB8: case BX_INSTR_SBB8:
case BX_INSTR_COMPARE8:
case BX_INSTR_NEG8: case BX_INSTR_NEG8:
case BX_INSTR_SAR8: case BX_INSTR_SAR8:
case BX_INSTR_SHR8: case BX_INSTR_SHR8:
@ -969,7 +948,6 @@ bx_bool BX_CPU_C::get_PFLazy(void)
case BX_INSTR_ADC16: case BX_INSTR_ADC16:
case BX_INSTR_SUB16: case BX_INSTR_SUB16:
case BX_INSTR_SBB16: case BX_INSTR_SBB16:
case BX_INSTR_COMPARE16:
case BX_INSTR_NEG16: case BX_INSTR_NEG16:
case BX_INSTR_SAR16: case BX_INSTR_SAR16:
case BX_INSTR_SHR16: case BX_INSTR_SHR16:
@ -982,7 +960,6 @@ bx_bool BX_CPU_C::get_PFLazy(void)
case BX_INSTR_ADC32: case BX_INSTR_ADC32:
case BX_INSTR_SUB32: case BX_INSTR_SUB32:
case BX_INSTR_SBB32: case BX_INSTR_SBB32:
case BX_INSTR_COMPARE32:
case BX_INSTR_NEG32: case BX_INSTR_NEG32:
case BX_INSTR_SAR32: case BX_INSTR_SAR32:
case BX_INSTR_SHR32: case BX_INSTR_SHR32:
@ -996,7 +973,6 @@ bx_bool BX_CPU_C::get_PFLazy(void)
case BX_INSTR_ADC64: case BX_INSTR_ADC64:
case BX_INSTR_SUB64: case BX_INSTR_SUB64:
case BX_INSTR_SBB64: case BX_INSTR_SBB64:
case BX_INSTR_COMPARE64:
case BX_INSTR_NEG64: case BX_INSTR_NEG64:
case BX_INSTR_SAR64: case BX_INSTR_SAR64:
case BX_INSTR_SHR64: case BX_INSTR_SHR64:

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: lazy_flags.h,v 1.18 2004-08-31 19:43:58 sshwarts Exp $ // $Id: lazy_flags.h,v 1.19 2004-09-04 10:21:15 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -49,60 +49,60 @@
#define BX_INSTR_SBB32 15 #define BX_INSTR_SBB32 15
#define BX_INSTR_SBB64 16 #define BX_INSTR_SBB64 16
#define BX_INSTR_COMPARE8 17 #define BX_INSTR_INC8 17
#define BX_INSTR_COMPARE16 18 #define BX_INSTR_INC16 18
#define BX_INSTR_COMPARE32 19 #define BX_INSTR_INC32 19
#define BX_INSTR_COMPARE64 20 #define BX_INSTR_INC64 20
#define BX_INSTR_INC8 21 #define BX_INSTR_DEC8 21
#define BX_INSTR_INC16 22 #define BX_INSTR_DEC16 22
#define BX_INSTR_INC32 23 #define BX_INSTR_DEC32 23
#define BX_INSTR_INC64 24 #define BX_INSTR_DEC64 24
#define BX_INSTR_DEC8 25 #define BX_INSTR_NEG8 25
#define BX_INSTR_DEC16 26 #define BX_INSTR_NEG16 26
#define BX_INSTR_DEC32 27 #define BX_INSTR_NEG32 27
#define BX_INSTR_DEC64 28 #define BX_INSTR_NEG64 28
#define BX_INSTR_NEG8 29 #define BX_INSTR_LOGIC8 29
#define BX_INSTR_NEG16 30 #define BX_INSTR_LOGIC16 30
#define BX_INSTR_NEG32 31 #define BX_INSTR_LOGIC32 31
#define BX_INSTR_NEG64 32 #define BX_INSTR_LOGIC64 32
#define BX_INSTR_LOGIC8 33
#define BX_INSTR_LOGIC16 34
#define BX_INSTR_LOGIC32 35
#define BX_INSTR_LOGIC64 36
// BX_INSTR_BITSCAN8 not exists, leave number for alignment // BX_INSTR_BITSCAN8 not exists, leave number for alignment
#define BX_INSTR_BITSCAN16 38 #define BX_INSTR_BITSCAN16 34
#define BX_INSTR_BITSCAN32 39 #define BX_INSTR_BITSCAN32 35
#define BX_INSTR_BITSCAN64 40 #define BX_INSTR_BITSCAN64 36
#define BX_INSTR_SHL8 41 #define BX_INSTR_SHL8 37
#define BX_INSTR_SHL16 42 #define BX_INSTR_SHL16 38
#define BX_INSTR_SHL32 43 #define BX_INSTR_SHL32 39
#define BX_INSTR_SHL64 44 #define BX_INSTR_SHL64 40
#define BX_INSTR_SHR8 45 #define BX_INSTR_SHR8 41
#define BX_INSTR_SHR16 46 #define BX_INSTR_SHR16 42
#define BX_INSTR_SHR32 47 #define BX_INSTR_SHR32 43
#define BX_INSTR_SHR64 48 #define BX_INSTR_SHR64 44
#define BX_INSTR_SAR8 49 #define BX_INSTR_SAR8 45
#define BX_INSTR_SAR16 50 #define BX_INSTR_SAR16 46
#define BX_INSTR_SAR32 51 #define BX_INSTR_SAR32 47
#define BX_INSTR_SAR64 52 #define BX_INSTR_SAR64 48
#define BX_INSTR_MUL8 53 #define BX_INSTR_MUL8 49
#define BX_INSTR_MUL16 54 #define BX_INSTR_MUL16 50
#define BX_INSTR_MUL32 55 #define BX_INSTR_MUL32 51
#define BX_INSTR_MUL64 56 #define BX_INSTR_MUL64 52
#define BX_INSTR_IMUL8 57 #define BX_INSTR_IMUL8 53
#define BX_INSTR_IMUL16 58 #define BX_INSTR_IMUL16 54
#define BX_INSTR_IMUL32 59 #define BX_INSTR_IMUL32 55
#define BX_INSTR_IMUL64 60 #define BX_INSTR_IMUL64 56
#define BX_INSTR_COMPARE8 BX_INSTR_SUB8
#define BX_INSTR_COMPARE16 BX_INSTR_SUB16
#define BX_INSTR_COMPARE32 BX_INSTR_SUB32
#define BX_INSTR_COMPARE64 BX_INSTR_SUB64
#define BX_LF_INDEX_OSZAPC 1 #define BX_LF_INDEX_OSZAPC 1

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: stack32.cc,v 1.18 2004-05-10 21:05:50 sshwarts Exp $ // $Id: stack32.cc,v 1.19 2004-09-04 10:21:28 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -325,7 +325,7 @@ BX_CPU_C::ENTER_IwIb(bxInstruction_c *i)
level = i->Ib2(); level = i->Ib2();
invalidate_prefetch_q(); //invalidate_prefetch_q();
level %= 32; level %= 32;
/* ??? */ /* ??? */
@ -459,7 +459,7 @@ BX_CPU_C::LEAVE(bxInstruction_c *i)
#else #else
Bit32u temp_EBP; Bit32u temp_EBP;
invalidate_prefetch_q(); //invalidate_prefetch_q();
#if BX_CPU_LEVEL >= 3 #if BX_CPU_LEVEL >= 3
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b)

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: stack64.cc,v 1.12 2004-05-10 21:05:50 sshwarts Exp $ // $Id: stack64.cc,v 1.13 2004-09-04 10:21:28 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -249,7 +249,7 @@ BX_CPU_C::ENTER64_IwIb(bxInstruction_c *i)
level = i->Ib2(); level = i->Ib2();
invalidate_prefetch_q(); //invalidate_prefetch_q();
level %= 32; level %= 32;
/* ??? */ /* ??? */