Committed CPU fixes from Vitaly Vorobyov:

[x] fixed bug in int01 (opcode 0xF1) emulation
[x] fixed bug in x86 debugger with dr0-dr3 registers

Committed disassembler bugfix from Dirk Thierbach:

[x] fixed bug in relative addresses in Jmp, Jcc, Call and so on
This commit is contained in:
Stanislav Shwartsman 2003-08-03 16:44:53 +00:00
parent 8b8b9b0450
commit 549eb70324
4 changed files with 23 additions and 18 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.72 2003-06-20 08:58:12 sshwarts Exp $ // $Id: proc_ctrl.cc,v 1.73 2003-08-03 16:44:53 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -73,7 +73,7 @@ BX_CPU_C::HLT(bxInstruction_c *i)
BX_PANIC(("HALT instruction encountered in the BIOS ROM")); BX_PANIC(("HALT instruction encountered in the BIOS ROM"));
if (CPL!=0) { if (CPL!=0) {
BX_INFO(("HLT(): CPL!=0")); // BX_INFO(("HLT(): CPL!=0"));
exception(BX_GP_EXCEPTION, 0, 0); exception(BX_GP_EXCEPTION, 0, 0);
return; return;
} }
@ -175,8 +175,9 @@ BX_CPU_C::MOV_DdRd(bxInstruction_c *i)
#else #else
Bit32u val_32; Bit32u val_32;
if (v8086_mode()) BX_PANIC(("MOV_DdRd: v8086 mode unsupported")); if (v8086_mode()) {
exception(BX_GP_EXCEPTION, 0, 0);
}
/* NOTES: /* NOTES:
* 32bit operands always used * 32bit operands always used
* r/m field specifies general register * r/m field specifies general register
@ -290,6 +291,10 @@ BX_CPU_C::MOV_DdRd(bxInstruction_c *i)
// Even bits 11,10 are changeable though reserved. // Even bits 11,10 are changeable though reserved.
BX_CPU_THIS_PTR dr7 = (val_32 & 0xffff2fff) | 0x00000400; BX_CPU_THIS_PTR dr7 = (val_32 & 0xffff2fff) | 0x00000400;
#endif #endif
// if we have breakpoints enabled then we must check
// breakpoints condition in cpu loop
if(BX_CPU_THIS_PTR dr7 & 0xff)
BX_CPU_THIS_PTR async_event = 1;
break; break;
default: default:
BX_PANIC(("MOV_DdRd: control register index out of range")); BX_PANIC(("MOV_DdRd: control register index out of range"));

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: soft_int.cc,v 1.16 2003-05-15 16:41:16 sshwarts Exp $ // $Id: soft_int.cc,v 1.17 2003-08-03 16:44:53 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -89,9 +89,9 @@ BX_CPU_C::INT1(bxInstruction_c *i)
#if BX_EXTERNAL_DEBUGGER #if BX_EXTERNAL_DEBUGGER
trap_debugger(0); trap_debugger(0);
#else
interrupt(1, 1, 0, 0);
#endif #endif
interrupt(1, 1, 0, 0);
BX_INSTR_FAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_INT, BX_INSTR_FAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_INT,
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value, BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value,
EIP); EIP);

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: stack_pro.cc,v 1.14 2003-03-02 23:59:09 cbothamy Exp $ // $Id: stack_pro.cc,v 1.15 2003-08-03 16:44:53 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -52,7 +52,7 @@ BailBigRSP("push_16");
#endif #endif
temp_ESP = SP; temp_ESP = SP;
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, temp_ESP, 2)) { if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, temp_ESP, 2)) {
BX_PANIC(("push_16(): push outside stack limits")); BX_DEBUG(("push_16(): push outside stack limits"));
exception(BX_SS_EXCEPTION, 0, 0); exception(BX_SS_EXCEPTION, 0, 0);
return; return;
} }

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: dis_groups.cc,v 1.8 2003-01-21 13:23:47 cbothamy Exp $ // $Id: dis_groups.cc,v 1.9 2003-08-03 16:44:53 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -418,12 +418,12 @@ bx_disassemble_c::Av(void)
{ {
if (db_32bit_opsize) { if (db_32bit_opsize) {
Bit32s imm32; Bit32s imm32;
imm32 = fetch_dword(); imm32 = (Bit32s) fetch_dword();
dis_sprintf("%08x", (unsigned) (imm32 + db_eip)); dis_sprintf("%08x", (unsigned) (imm32 + db_eip));
} }
else { else {
Bit16s imm16; Bit16s imm16;
imm16 = fetch_word(); imm16 = (Bit16s) fetch_word();
dis_sprintf("%04x", (unsigned) ((imm16 + db_eip) & 0xFFFF)); dis_sprintf("%04x", (unsigned) ((imm16 + db_eip) & 0xFFFF));
} }
} }
@ -522,17 +522,17 @@ bx_disassemble_c::Jv(void)
{ {
#if BX_CPU_LEVEL > 2 #if BX_CPU_LEVEL > 2
if (db_32bit_opsize) { if (db_32bit_opsize) {
Bit32u imm32; Bit32s imm32; /* JMP rel32 is signed */
imm32 = fetch_dword(); imm32 = (Bit32s) fetch_dword();
dis_sprintf("%08x", (unsigned) (imm32 + db_eip)); dis_sprintf("%08x", (unsigned) (imm32 + db_eip));
} }
else else
#endif #endif
{ {
Bit16u imm16; Bit16s imm16; /* JMP rel16 is signed */
imm16 = fetch_word(); imm16 = (Bit16s) fetch_word();
dis_sprintf("%04x", (unsigned) ((imm16 + db_eip) & 0xFFFF)); dis_sprintf("%04x", (unsigned) ((imm16 + db_eip) & 0xFFFF));
} }
} }
@ -591,9 +591,9 @@ bx_disassemble_c::Ib(void)
void void
bx_disassemble_c::Jb(void) bx_disassemble_c::Jb(void)
{ {
Bit8u imm8; Bit8s imm8; /* JMP rel8 is signed */
imm8 = fetch_byte(); imm8 = (Bit8s) fetch_byte();
#if BX_CPU_LEVEL > 2 #if BX_CPU_LEVEL > 2
if (db_32bit_opsize) { if (db_32bit_opsize) {
dis_sprintf("%08x", (unsigned) (imm8 + db_eip)); dis_sprintf("%08x", (unsigned) (imm8 + db_eip));