- fixed 286 tss handling (descriptor wasn't parsed correctly)

- fixed timing of faulted instructions
- fixed PANIC message in interrupt through incorrect task gate
This commit is contained in:
Stanislav Shwartsman 2008-04-18 10:19:33 +00:00
parent 639967e1da
commit 5993ca527c
3 changed files with 15 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.cc,v 1.221 2008-04-16 16:44:04 sshwarts Exp $
// $Id: cpu.cc,v 1.222 2008-04-18 10:19:33 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -96,10 +96,10 @@ void BX_CPU_C::cpu_loop(Bit32u max_instr_count)
BX_CPU_THIS_PTR stop_reason = STOP_NO_REASON;
#endif
if (setjmp(BX_CPU_THIS_PTR jmp_buf_env))
{
if (setjmp(BX_CPU_THIS_PTR jmp_buf_env)) {
// only from exception function we can get here ...
BX_INSTR_NEW_INSTRUCTION(BX_CPU_ID);
BX_TICK1_IF_SINGLE_PROCESSOR();
#if BX_DEBUGGER || BX_EXTERNAL_DEBUGGER || BX_GDBSTUB
if (dbg_instruction_epilog()) return;
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: exception.cc,v 1.109 2008-04-16 22:08:46 sshwarts Exp $
// $Id: exception.cc,v 1.110 2008-04-18 10:19:33 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -356,7 +356,7 @@ void BX_CPU_C::protected_mode_int(Bit8u vector, bx_bool is_INT, bx_bool is_error
// must specify global in the local/global bit,
// else #GP(TSS selector)
if (tss_selector.ti) {
BX_PANIC(("interrupt: tss_selector.ti=1"));
BX_ERROR(("interrupt: tss_selector.ti=1 from gate descriptor - #GP(tss_selector)"));
exception(BX_GP_EXCEPTION, raw_tss_selector & 0xfffc, 0);
}
@ -368,11 +368,14 @@ void BX_CPU_C::protected_mode_int(Bit8u vector, bx_bool is_INT, bx_bool is_error
// AR byte must specify available TSS,
// else #GP(TSS selector)
if (tss_descriptor.valid==0 || tss_descriptor.segment) {
BX_ERROR(("exception: TSS selector points to bad TSS"));
BX_ERROR(("exception: TSS selector points to invalid or bad TSS - #GP(tss_selector)"));
exception(BX_GP_EXCEPTION, raw_tss_selector & 0xfffc, 0);
}
if (tss_descriptor.type!=9 && tss_descriptor.type!=1) {
BX_ERROR(("exception: TSS selector points to bad TSS"));
if (tss_descriptor.type!=BX_SYS_SEGMENT_AVAIL_286_TSS &&
tss_descriptor.type!=BX_SYS_SEGMENT_AVAIL_386_TSS)
{
BX_ERROR(("exception: TSS selector points to bad TSS - #GP(tss_selector)"));
exception(BX_GP_EXCEPTION, raw_tss_selector & 0xfffc, 0);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: segment_ctrl_pro.cc,v 1.84 2008-03-29 18:18:07 sshwarts Exp $
// $Id: segment_ctrl_pro.cc,v 1.85 2008-04-18 10:19:33 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -578,16 +578,6 @@ BX_CPU_C::parse_descriptor(Bit32u dword1, Bit32u dword2, bx_descriptor_t *temp)
temp->valid = 0;
break;
case BX_SYS_SEGMENT_AVAIL_286_TSS:
case BX_SYS_SEGMENT_BUSY_286_TSS:
temp->u.system.base = (dword1 >> 16) | ((dword2 & 0xff) << 16);
temp->u.system.limit = (dword1 & 0xffff);
temp->u.system.limit_scaled = temp->u.system.limit;
temp->u.system.g = 0;
temp->u.system.avl = 0;
temp->valid = 1;
break;
case BX_286_CALL_GATE:
case BX_286_INTERRUPT_GATE:
case BX_286_TRAP_GATE:
@ -615,10 +605,12 @@ BX_CPU_C::parse_descriptor(Bit32u dword1, Bit32u dword2, bx_descriptor_t *temp)
break;
case BX_SYS_SEGMENT_LDT:
case BX_SYS_SEGMENT_AVAIL_286_TSS:
case BX_SYS_SEGMENT_BUSY_286_TSS:
case BX_SYS_SEGMENT_AVAIL_386_TSS:
case BX_SYS_SEGMENT_BUSY_386_TSS:
temp->u.system.base = (dword1 >> 16) |
((dword2 & 0xff) << 16) | (dword2 & 0xff000000);
((dword2 & 0xff) << 16) | (dword2 & 0xff000000);
temp->u.system.limit = (dword1 & 0x0000ffff) | (dword2 & 0x000f0000);
temp->u.system.g = (dword2 & 0x00800000) > 0;
temp->u.system.avl = (dword2 & 0x00100000) > 0;