Enable TSD in CR4 (RDTSC instruction is already implemented so it has no problem to enable TSD for CPU LEVEL >=5)

This commit is contained in:
Stanislav Shwartsman 2005-01-23 21:13:49 +00:00
parent 1d9d616a4f
commit 7eb2f0aa3e
2 changed files with 14 additions and 8 deletions

View File

@ -201,6 +201,9 @@ Changes to next release:
- patch.apic-zwane (APIC fixes) (Zwane Mwaikambo)
- these S.F. bugs were closed
#831751 behaviour unrealistic
#661213 CR4.TSD is broken
#685508 PANIC: prefetch: RIP > CS.limit
#1037923 Non-executable page support missed (NX bit, x86-64)
#1106530 wrong disassemble result
#1105208 drive order for boot gets saved wrong

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.90 2005-01-13 19:03:39 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.91 2005-01-23 21:13:49 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1391,17 +1391,17 @@ void BX_CPU_C::SetCR4(Bit32u val_32)
// [1] PVI: Protected-Mode Virtual Interrupts R/W
// [0] VME: Virtual-8086 Mode Extensions R/W
Bit32u allowMask = 0;
Bit32u oldCR4 = BX_CPU_THIS_PTR cr4.getRegister();
Bit32u allowMask = 0;
#if BX_CPU_LEVEL >= 5
allowMask |= (1<<2); /* TSD */
#endif
#if BX_SUPPORT_4MEG_PAGES
allowMask |= (1<<4);
#endif
#if BX_SupportGlobalPages
allowMask |= (1<<7);
#endif
#if BX_SupportPAE
allowMask |= (1<<5);
#endif
@ -1411,6 +1411,10 @@ void BX_CPU_C::SetCR4(Bit32u val_32)
allowMask |= (1<<6); /* MCE */
#endif
#if BX_SupportGlobalPages
allowMask |= (1<<7);
#endif
#if BX_CPU_LEVEL >= 6
allowMask |= (1<<9); /* OSFXSR */
#endif
@ -1503,8 +1507,7 @@ void BX_CPU_C::RDTSC(bxInstruction_c *i)
{
#if BX_CPU_LEVEL >= 5
bx_bool tsd = BX_CPU_THIS_PTR cr4.get_TSD();
bx_bool cpl = CPL;
if ((tsd==0) || (tsd==1 && cpl==0)) {
if ((tsd==0) || (tsd==1 && CPL==0)) {
// return ticks
Bit64u ticks = bx_pc_system.time_ticks ();
RAX = (Bit32u) (ticks & 0xffffffff);