aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2016-12-02 16:38:59 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-12-23 16:16:19 +1100
commitdec17027dd3b65eee93782156ab76094c6b6b592 (patch)
tree0ff56e61e8fbcac9d19a44b0e4050b522b83398b /external
parent8ea2dcf14ddddc1b698ce2165118d52f86a6bd13 (diff)
downloadskiboot-dec17027dd3b65eee93782156ab76094c6b6b592.zip
skiboot-dec17027dd3b65eee93782156ab76094c6b6b592.tar.gz
skiboot-dec17027dd3b65eee93782156ab76094c6b6b592.tar.bz2
mambo_utils: add p_str <addr> [limit]
Adds a helper function to mambo_utils.tcl that prints the NUL terminated string at <addr>, and optionally limits the output to a fixed number of characters. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/mambo/mambo_utils.tcl19
1 files changed, 19 insertions, 0 deletions
diff --git a/external/mambo/mambo_utils.tcl b/external/mambo/mambo_utils.tcl
index e124343..879db92 100644
--- a/external/mambo/mambo_utils.tcl
+++ b/external/mambo/mambo_utils.tcl
@@ -161,6 +161,25 @@ proc hexdump { location count } {
}
}
+proc get_char { addr } {
+ return [expr [mysim memory display "$addr" 1]]
+}
+
+proc p_str { addr { limit 0 } } {
+ set addr_limit 0xfffffffffffffffff
+ if { $limit > 0 } { set addr_limit [expr $limit + $addr] }
+ set s ""
+
+ for {} { [get_char "$addr"] != 0} { incr addr 1 } {
+ # memory display returns hex values with a leading 0x
+ set c [format %c [get_char "$addr"]]
+ set s [string cat "$s" "$c"]
+ if { $addr == $addr_limit } { break }
+ }
+
+ puts "$s"
+}
+
proc slbv {} {
puts [mysim cpu 0 display slb valid]
}