From: <ssh...@us...> - 2011-03-24 19:07:04
|
Revision: 10281 http://bochs.svn.sourceforge.net/bochs/?rev=10281&view=rev Author: sshwarts Date: 2011-03-24 19:06:58 +0000 (Thu, 24 Mar 2011) Log Message: ----------- fixed code breakpoint hit Modified Paths: -------------- trunk/bochs/cpu/cpu.cc trunk/bochs/cpu/cpu.h trunk/bochs/cpu/crregs.cc Modified: trunk/bochs/cpu/cpu.cc =================================================================== --- trunk/bochs/cpu/cpu.cc 2011-03-22 22:18:40 UTC (rev 10280) +++ trunk/bochs/cpu/cpu.cc 2011-03-24 19:06:58 UTC (rev 10281) @@ -525,6 +525,9 @@ // A trap may be inhibited on this boundary due to an instruction // which loaded SS. If so we clear the inhibit_mask below // and don't execute this code until the next boundary. +#if BX_X86_DEBUGGER + code_breakpoint_match(get_laddr(BX_SEG_REG_CS, BX_CPU_THIS_PTR prev_rip)); +#endif exception(BX_DB_EXCEPTION, 0); // no error, not interrupt } @@ -619,8 +622,9 @@ 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)); + if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG_SHADOW)) { + if (code_breakpoint_match(get_laddr(BX_SEG_REG_CS, BX_CPU_THIS_PTR prev_rip))) + exception(BX_DB_EXCEPTION, 0); // no error, not interrupt } } #endif Modified: trunk/bochs/cpu/cpu.h =================================================================== --- trunk/bochs/cpu/cpu.h 2011-03-22 22:18:40 UTC (rev 10280) +++ trunk/bochs/cpu/cpu.h 2011-03-24 19:06:58 UTC (rev 10281) @@ -3446,7 +3446,7 @@ // x86 hardware debug support BX_SMF bx_bool hwbreakpoint_check(bx_address laddr); BX_SMF void iobreakpoint_match(unsigned port, unsigned len); - BX_SMF void code_breakpoint_match(bx_address laddr); + BX_SMF Bit32u code_breakpoint_match(bx_address laddr); BX_SMF void hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw); BX_SMF Bit32u hwdebug_compare(bx_address laddr, unsigned len, unsigned opa, unsigned opb); Modified: trunk/bochs/cpu/crregs.cc =================================================================== --- trunk/bochs/cpu/crregs.cc 2011-03-22 22:18:40 UTC (rev 10280) +++ trunk/bochs/cpu/crregs.cc 2011-03-24 19:06:58 UTC (rev 10281) @@ -1209,17 +1209,22 @@ return 0; } -void BX_CPU_C::code_breakpoint_match(bx_address laddr) +Bit32u BX_CPU_C::code_breakpoint_match(bx_address laddr) { + if (BX_CPU_THIS_PTR get_RF() || BX_CPU_THIS_PTR in_repeat) + return 0; + if (BX_CPU_THIS_PTR dr7.get_bp_enabled()) { Bit32u dr6_bits = hwdebug_compare(laddr, 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 + return dr6_bits; } } + + return 0; } void BX_CPU_C::hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |