[openfirmware] r1007 - cpu/x86
svn at openfirmware.info
svn at openfirmware.info
Mon Nov 17 21:53:54 CET 2008
Author: wmb
Date: 2008-11-17 21:53:53 +0100 (Mon, 17 Nov 2008)
New Revision: 1007
Modified:
cpu/x86/cpubpsup.fth
cpu/x86/dtacc.fth
Log:
x86 assembly language debugger - use hardware breakpoint mode when
running standalone, so that single-stepping RET and indirect JMP/CALL
instructions works. Also support single-stepping RET in software
breakpoint mode (supporting indirect JMP/CALL is hard, requiring full
effective address evaluation, so we don't do it yet).
Modified: cpu/x86/cpubpsup.fth
===================================================================
--- cpu/x86/cpubpsup.fth 2008-11-15 03:06:06 UTC (rev 1006)
+++ cpu/x86/cpubpsup.fth 2008-11-17 20:53:53 UTC (rev 1007)
@@ -10,6 +10,8 @@
: .instruction ( -- ) %eip pc!dis1 ;
+true value hardware-step? \ True if the environment permits hardware single-step
+
also hidden also definitions
headerless
@@ -55,10 +57,25 @@
\ addressing mode bytes. Returns the address following those addressing
\ mode bytes, or step-adr if the instruction is not a call or if following-
\ jsrs is true.
-true value hardware-step? \ True if the environment permits hardware single-step
+
+: jmp-indirect? ( -- false | pc1 pc2 true )
+ %eip c@ h# fe and h# c2 = if \ RET NEAR
+ %esp l@ 0 true exit
+ then
+
+ %eip c@ h# ff and if
+ %eip 1+ c@ 3 rshift 7 and 2 5 between if
+ ." Single-stepping indirect call/jmp doesn't work in software breakpoint mode" cr
+ then
+ then
+ false
+;
+
: find-successors ( -- pc1 pc2 )
hardware-step? if step-adr 0 exit then
+ jmp-indirect? if exit then
+
['] cr behavior >r ['] type behavior >r
['] noop to cr ['] 2drop to type
[ also disassembler ] %eip pc!dis1 pc @ branch-target @ [ previous ]
Modified: cpu/x86/dtacc.fth
===================================================================
--- cpu/x86/dtacc.fth 2008-11-15 03:06:06 UTC (rev 1006)
+++ cpu/x86/dtacc.fth 2008-11-17 20:53:53 UTC (rev 1007)
@@ -42,6 +42,7 @@
stand-init: Exceptions
make-idt stand-set-idt move-gdt
+ true to hardware-step?
;
\ LICENSE_BEGIN
More information about the openfirmware
mailing list