Check for old TSS limits in task switching logic

MSR_GSKERNELBASE should be canonical - added WRMSR check
This commit is contained in:
Stanislav Shwartsman 2008-04-25 11:39:51 +00:00
parent b78878bd90
commit a647c7e551
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.218 2008-04-20 21:44:13 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.219 2008-04-25 11:39:51 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1896,6 +1896,10 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::WRMSR(bxInstruction_c *i)
return;
case BX_MSR_KERNELGSBASE:
if (! IsCanonical(val64)) {
BX_ERROR(("WRMSR: attempt to write non-canonical value to MSR_KERNELGSBASE !"));
exception(BX_GP_EXCEPTION, 0, 0);
}
MSR_KERNELGSBASE = val64;
return;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: tasking.cc,v 1.54 2008-04-22 22:05:38 sshwarts Exp $
// $Id: tasking.cc,v 1.55 2008-04-25 11:39:51 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -186,6 +186,11 @@ void BX_CPU_C::task_switch(bx_selector_t *tss_selector,
exception(BX_TS_EXCEPTION, tss_selector->value & 0xfffc, 0);
}
if (old_TSS_limit < old_TSS_max) {
BX_ERROR(("task_switch(): old TSS limit < %d", old_TSS_max));
exception(BX_TS_EXCEPTION, BX_CPU_THIS_PTR tr.selector.value & 0xfffc, 0);
}
if (obase32 == nbase32) {
BX_INFO(("TASK SWITCH: switching to the same TSS !"));
}