[Skiboot] [PATCH] external/mambo: Add di command to decode instructions

Michael Neuling mikey at neuling.org
Mon Apr 23 16:41:17 AEST 2018


By default you get 16 instructions but you can specify the number you
want.  ie

  systemsim % di 0x100 4
  0x0000000000000100: Enc:0xA64BB17D : mtspr   HSPRG1,r13
  0x0000000000000104: Enc:0xA64AB07D : mfspr   r13,HSPRG0
  0x0000000000000108: Enc:0xF0092DF9 : std     r9,0x9F0(r13)
  0x000000000000010C: Enc:0xA6E2207D : mfspr   r9,PPR

Using di since it's what xmon uses.

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 external/mambo/mambo_utils.tcl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/external/mambo/mambo_utils.tcl b/external/mambo/mambo_utils.tcl
index 54b367c47c..b503acbfd4 100644
--- a/external/mambo/mambo_utils.tcl
+++ b/external/mambo/mambo_utils.tcl
@@ -158,6 +158,17 @@ proc ex {  ea { size 8 } } {
     puts "$pa : $val"
 }
 
+proc di { location { count 16 } }    {
+    set addr  [expr $location & 0xfffffffffffffff0]
+    set top [expr $addr + ($count * 4)]
+    for { set i $addr } { $i < $top } { incr i 4 } {
+	set pc_laddr [mysim cpu 0 util itranslate $i]
+	set inst [mysim cpu 0 memory display $pc_laddr 4]
+	set disasm [mysim cpu 0 util ppc_disasm $inst $i]
+	puts "$pc_laddr: Enc:$inst : $disasm"
+    }
+}
+
 proc hexdump { location count }    {
     set addr  [expr $location & 0xfffffffffffffff0]
     set top [expr $addr + ($count * 15)]
-- 
2.14.1



More information about the Skiboot mailing list