bochs: backport decoding of CRC32 instr fix
Upstream SVN r10223 Backport was neccessary, because the CRC32 assambly instruction did not work as expected in bochs.
This commit is contained in:
@ -651,6 +651,29 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
|
|||||||
// Code page fault (priority 7 on 486/Pentium)
|
// Code page fault (priority 7 on 486/Pentium)
|
||||||
// (handled in main decode loop)
|
// (handled in main decode loop)
|
||||||
|
|
||||||
|
// Now we can handle things which are synchronous to instruction
|
||||||
|
// execution.
|
||||||
|
if (BX_CPU_THIS_PTR get_RF()) {
|
||||||
|
BX_CPU_THIS_PTR clear_RF();
|
||||||
|
}
|
||||||
|
#if BX_X86_DEBUGGER
|
||||||
|
else {
|
||||||
|
// only bother comparing if any breakpoints enabled and
|
||||||
|
// debug events are not inhibited on this boundary.
|
||||||
|
if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG_SHADOW) && ! BX_CPU_THIS_PTR in_repeat) {
|
||||||
|
code_breakpoint_match(get_laddr(BX_SEG_REG_CS, BX_CPU_THIS_PTR prev_rip));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (BX_CPU_THIS_PTR get_TF())
|
||||||
|
{
|
||||||
|
// TF is set before execution of next instruction. Schedule
|
||||||
|
// a debug trap (#DB) after execution. After completion of
|
||||||
|
// next instruction, the code above will invoke the trap.
|
||||||
|
BX_CPU_THIS_PTR debug_trap |= BX_DEBUG_SINGLE_STEP_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
// Priority 7: Faults from decoding next instruction
|
// Priority 7: Faults from decoding next instruction
|
||||||
// Instruction length > 15 bytes
|
// Instruction length > 15 bytes
|
||||||
// Illegal opcode
|
// Illegal opcode
|
||||||
@ -669,38 +692,6 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
|
|||||||
// Alignment check
|
// Alignment check
|
||||||
// (handled by rest of the code)
|
// (handled by rest of the code)
|
||||||
|
|
||||||
// Now we can handle things which are synchronous to instruction
|
|
||||||
// execution.
|
|
||||||
if (BX_CPU_THIS_PTR get_RF()) {
|
|
||||||
BX_CPU_THIS_PTR clear_RF();
|
|
||||||
}
|
|
||||||
#if BX_X86_DEBUGGER
|
|
||||||
else {
|
|
||||||
// only bother comparing if any breakpoints enabled and
|
|
||||||
// debug events are not inhibited on this boundary.
|
|
||||||
if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG_SHADOW) && ! BX_CPU_THIS_PTR in_repeat) {
|
|
||||||
if (BX_CPU_THIS_PTR dr7 & 0x000000ff) {
|
|
||||||
bx_address iaddr = get_laddr(BX_SEG_REG_CS, BX_CPU_THIS_PTR prev_rip);
|
|
||||||
Bit32u dr6_bits = hwdebug_compare(iaddr, 1, BX_HWDebugInstruction, BX_HWDebugInstruction);
|
|
||||||
if (dr6_bits) {
|
|
||||||
// Add to the list of debug events thus far.
|
|
||||||
BX_CPU_THIS_PTR debug_trap |= dr6_bits;
|
|
||||||
BX_ERROR(("#DB: x86 code breakpoint catched"));
|
|
||||||
exception(BX_DB_EXCEPTION, 0); // no error, not interrupt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (BX_CPU_THIS_PTR get_TF())
|
|
||||||
{
|
|
||||||
// TF is set before execution of next instruction. Schedule
|
|
||||||
// a debug trap (#DB) after execution. After completion of
|
|
||||||
// next instruction, the code above will invoke the trap.
|
|
||||||
BX_CPU_THIS_PTR debug_trap |= BX_DEBUG_SINGLE_STEP_BIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!((BX_CPU_INTR && BX_CPU_THIS_PTR get_IF()) ||
|
if (!((BX_CPU_INTR && BX_CPU_THIS_PTR get_IF()) ||
|
||||||
BX_CPU_THIS_PTR debug_trap ||
|
BX_CPU_THIS_PTR debug_trap ||
|
||||||
// BX_CPU_THIS_PTR get_TF() // implies debug_trap is set
|
// BX_CPU_THIS_PTR get_TF() // implies debug_trap is set
|
||||||
|
|||||||
@ -3267,6 +3267,7 @@ public: // for now...
|
|||||||
// x86 hardware debug support
|
// x86 hardware debug support
|
||||||
BX_SMF bx_bool hwbreakpoint_check(bx_address laddr);
|
BX_SMF bx_bool hwbreakpoint_check(bx_address laddr);
|
||||||
BX_SMF void iobreakpoint_match(unsigned port, unsigned len);
|
BX_SMF void iobreakpoint_match(unsigned port, unsigned len);
|
||||||
|
BX_SMF void code_breakpoint_match(bx_address laddr);
|
||||||
BX_SMF void hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw);
|
BX_SMF void hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw);
|
||||||
BX_SMF Bit32u hwdebug_compare(bx_address laddr, unsigned len,
|
BX_SMF Bit32u hwdebug_compare(bx_address laddr, unsigned len,
|
||||||
unsigned opa, unsigned opb);
|
unsigned opa, unsigned opb);
|
||||||
|
|||||||
@ -1192,6 +1192,19 @@ bx_bool BX_CPU_C::hwbreakpoint_check(bx_address laddr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BX_CPU_C::code_breakpoint_match(bx_address laddr)
|
||||||
|
{
|
||||||
|
if (BX_CPU_THIS_PTR dr7 & 0x000000ff) {
|
||||||
|
Bit32u dr6_bits = hwdebug_compare(iaddr, 1, BX_HWDebugInstruction, BX_HWDebugInstruction);
|
||||||
|
if (dr6_bits) {
|
||||||
|
// Add to the list of debug events thus far.
|
||||||
|
BX_CPU_THIS_PTR debug_trap |= dr6_bits;
|
||||||
|
BX_ERROR(("#DB: x86 code breakpoint catched"));
|
||||||
|
exception(BX_DB_EXCEPTION, 0); // no error, not interrupt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BX_CPU_C::hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw)
|
void BX_CPU_C::hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw)
|
||||||
{
|
{
|
||||||
if (BX_CPU_THIS_PTR dr7 & 0x000000ff) {
|
if (BX_CPU_THIS_PTR dr7 & 0x000000ff) {
|
||||||
|
|||||||
@ -2012,7 +2012,7 @@ modrm_done:
|
|||||||
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[b3]);
|
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[b3]);
|
||||||
break;
|
break;
|
||||||
case BxOSizeGrp:
|
case BxOSizeGrp:
|
||||||
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[offset >> 8]);
|
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[offset >> 9]);
|
||||||
break;
|
break;
|
||||||
case BxPrefixSSE:
|
case BxPrefixSSE:
|
||||||
/* For SSE opcodes look into another table
|
/* For SSE opcodes look into another table
|
||||||
|
|||||||
Reference in New Issue
Block a user