Just software changes:

1. Separate interrupt function to 3 different functions (real_mode, long_mode, pmode)
2. Added PANIC messages for not implemented FAR CALL, FAR JUMP and FAR RET in long mode
This commit is contained in:
Stanislav Shwartsman 2005-04-12 18:08:10 +00:00
parent c2c18d2aa4
commit 9b30cad4c4
4 changed files with 760 additions and 762 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.cc,v 1.103 2005-04-10 19:42:47 sshwarts Exp $
// $Id: cpu.cc,v 1.104 2005-04-12 18:07:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -146,23 +146,17 @@ BX_CPU_C::cpu_loop(Bit32s max_instr_count)
BX_CPU_THIS_PTR stop_reason = STOP_NO_REASON;
#endif
#if BX_INSTRUMENTATION
if (setjmp( BX_CPU_THIS_PTR jmp_buf_env ))
{
// only from exception function can we get here ...
BX_INSTR_NEW_INSTRUCTION(BX_CPU_ID);
}
#elif BX_GDBSTUB
if (bx_dbg.gdbstub_enabled) {
if (setjmp( BX_CPU_THIS_PTR jmp_buf_env )) {
#if BX_GDBSTUB
if (bx_dbg.gdbstub_enabled) {
return;
}
} else {
(void) setjmp( BX_CPU_THIS_PTR jmp_buf_env );
}
#else
(void) setjmp( BX_CPU_THIS_PTR jmp_buf_env );
#endif
}
#if BX_DEBUGGER
// If the exception() routine has encountered a nasty fault scenario,
@ -491,8 +485,8 @@ debugger_check:
#if BX_GDBSTUB
if (bx_dbg.gdbstub_enabled) {
unsigned int reason;
if ((reason = bx_gdbstub_check(EIP)) != GDBSTUB_STOP_NO_REASON) {
unsigned int reason = bx_gdbstub_check(EIP);
if (reason != GDBSTUB_STOP_NO_REASON) {
return;
}
}
@ -929,10 +923,10 @@ BX_CPU_C::dbg_is_begin_instr_bpoint(Bit32u cs, Bit32u eip, Bit32u laddr,
BX_CPU_THIS_PTR guard_found.guard_found = BX_DBG_GUARD_IADDR_VIR;
BX_CPU_THIS_PTR guard_found.iaddr_index = i;
return(1); // on a breakpoint
}
}
}
}
}
#endif
#if BX_DBG_SUPPORT_LIN_BPOINT
if (bx_guard.guard_for & BX_DBG_GUARD_IADDR_LIN) {
@ -943,10 +937,10 @@ BX_CPU_C::dbg_is_begin_instr_bpoint(Bit32u cs, Bit32u eip, Bit32u laddr,
BX_CPU_THIS_PTR guard_found.guard_found = BX_DBG_GUARD_IADDR_LIN;
BX_CPU_THIS_PTR guard_found.iaddr_index = i;
return(1); // on a breakpoint
}
}
}
}
}
#endif
#if BX_DBG_SUPPORT_PHY_BPOINT
if (bx_guard.guard_for & BX_DBG_GUARD_IADDR_PHY) {
@ -965,12 +959,12 @@ BX_CPU_C::dbg_is_begin_instr_bpoint(Bit32u cs, Bit32u eip, Bit32u laddr,
BX_CPU_THIS_PTR guard_found.guard_found = BX_DBG_GUARD_IADDR_PHY;
BX_CPU_THIS_PTR guard_found.iaddr_index = i;
return(1); // on a breakpoint
}
}
}
}
#endif
}
#endif
}
return(0); // not on a breakpoint
}
@ -984,10 +978,11 @@ BX_CPU_C::dbg_is_end_instr_bpoint(Bit32u cs, Bit32u eip, Bit32u laddr,
// convenient point to see if user typed Ctrl-C
if (bx_guard.interrupt_requested &&
(bx_guard.guard_for & BX_DBG_GUARD_CTRL_C)) {
(bx_guard.guard_for & BX_DBG_GUARD_CTRL_C))
{
BX_CPU_THIS_PTR guard_found.guard_found = BX_DBG_GUARD_CTRL_C;
return(1);
}
}
// see if debugger requesting icount guard
if (bx_guard.guard_for & BX_DBG_GUARD_ICOUNT) {
@ -998,8 +993,8 @@ BX_CPU_C::dbg_is_end_instr_bpoint(Bit32u cs, Bit32u eip, Bit32u laddr,
BX_CPU_THIS_PTR guard_found.is_32bit_code = is_32;
BX_CPU_THIS_PTR guard_found.guard_found = BX_DBG_GUARD_ICOUNT;
return(1);
}
}
}
#if (BX_NUM_SIMULATORS >= 2)
// if async event pending, acknowlege them
@ -1009,8 +1004,8 @@ BX_CPU_C::dbg_is_end_instr_bpoint(Bit32u cs, Bit32u eip, Bit32u laddr,
bx_guard.async_changes_pending.a20);
if (bx_guard.async_changes_pending.which) {
BX_PANIC(("decode: async pending unrecognized."));
}
}
}
#endif
return(0); // no breakpoint
}
@ -1031,8 +1026,8 @@ BX_CPU_C::dbg_take_irq(void)
BX_CPU_THIS_PTR EXT = 1; // external event
BX_CPU_THIS_PTR async_event = 1; // set in case INTR is triggered
interrupt(vector, 0, 0, 0);
}
}
}
}
void
@ -1047,7 +1042,7 @@ BX_CPU_C::dbg_force_interrupt(unsigned vector)
BX_CPU_THIS_PTR EXT = 1; // external event
BX_CPU_THIS_PTR async_event = 1; // probably don't need this
interrupt(vector, 0, 0, 0);
}
}
}
void
@ -1057,7 +1052,7 @@ BX_CPU_C::dbg_take_dma(void)
if ( BX_HRQ ) {
BX_CPU_THIS_PTR async_event = 1; // set in case INTR is triggered
DEV_dma_raise_hlda();
}
}
}
#endif // #if BX_DEBUGGER
#endif // #if BX_DEBUGGER

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.215 2005-04-11 18:53:02 sshwarts Exp $
// $Id: cpu.h,v 1.216 2005-04-12 18:08:08 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2664,6 +2664,14 @@ public: // for now...
BX_SMF char *strseg(bx_segment_reg_t *seg) BX_CPP_AttrRegparmN(1);
BX_SMF void interrupt(Bit8u vector, bx_bool is_INT, bx_bool is_error_code,
Bit16u error_code);
BX_SMF void real_mode_int(Bit8u vector, bx_bool is_INT, bx_bool is_error_code,
Bit16u error_code);
BX_SMF void protected_mode_int(Bit8u vector, bx_bool is_INT, bx_bool is_error_code,
Bit16u error_code);
#if BX_SUPPORT_X86_64
BX_SMF void long_mode_int(Bit8u vector, bx_bool is_INT, bx_bool is_error_code,
Bit16u error_code);
#endif
#if BX_CPU_LEVEL >= 2
BX_SMF void exception(unsigned vector, Bit16u error_code, bx_bool is_INT)
BX_CPP_AttrNoReturn();

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ctrl_xfer64.cc,v 1.30 2005-03-28 06:29:22 sshwarts Exp $
// $Id: ctrl_xfer64.cc,v 1.31 2005-04-12 18:08:10 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -226,6 +226,7 @@ BX_CPU_C::CALL64_Ep(bxInstruction_c *i)
read_virtual_word(i->seg(), RMAddr(i)+8, &cs_raw);
if ( protected_mode() ) {
BX_PANIC(("Call protected is not implemented in x86-64 mode !"));
BX_CPU_THIS_PTR call_protected(i, cs_raw, op1_64);
goto done;
}
@ -334,6 +335,7 @@ BX_CPU_C::JMP64_Ep(bxInstruction_c *i)
read_virtual_word(i->seg(), RMAddr(i)+4, &cs_raw);
if ( protected_mode() ) {
BX_PANIC(("Jump protected is not implemented in x86-64 mode !"));
BX_CPU_THIS_PTR jump_protected(i, cs_raw, op1_32);
goto done;
}

File diff suppressed because it is too large Load Diff