[SerialICE] New patch to review for serialice: 3a7357a Unify output line format

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Mon Feb 25 20:35:03 CET 2013


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2511

-gerrit

commit 3a7357a106fd94b1ae14271c349dcf20a36995c0
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Mon Feb 25 19:33:44 2013 +0200

    Unify output line format
    
    Serialice log had obscure format with characters like "#!*" appearing
    at different positions, this patch makes the output lines more readable.
    
    First number pair is a running index that could be used to group and indent the lines
    to improve readability. Doesn't work flawlessly yet.
    
    Second string is combination of flags telling how action got processed:
    
       I Info         -- informational line only
       R Raw          -- raw IO/MEMORY/CPU operation
       H Hardware     -- action was sent to target
       Q Qemu         -- action was sent to qemu
       U Undefined    -- action hit the fallback filter
       D Dropped      -- filter prevented sending action to target or qemu
       F Faked        -- filter modified the action on-the-fly
    
    Third field is the instruction pointer [CS:EIP]. At the moment EIP is not reported
    accurately at all.
    
    Remaining of the line describes the action.
    
    A few examples:
    
    Memory access, Raw + Qemu. Following is read of vector stored in the BIOS image file.
    
       0000.0001    RQ..    [ffff000:fff0]   MEM,ROM_HI:  readb fffffff0 => ea
       0000.0002    RQ..    [ffff000:fff0]   MEM,ROM_HI:  readw fffffff1 => e05b
       0000.0003    RQ..    [ffff000:fff0]   MEM,ROM_HI:  readw fffffff3 => f000
    
    PCI config read, Hardware. This is composed from either IO accesses to 0xcf8-0xcff or
    memory access to a specific PCI-e MM config region. Thus it is not Raw but a composed
    action.
    
       0044.0046    .H..    [f000:f764]   PCI: 0:1e.0 [004] => 00
    
    CPUID,  Raw + Hard + Faked. CPUID was executed on the target, but the returned
    value was modified. In this case, it fakes CPU has a single core.
    
       000d.000e    RH.F    [f000:e814]   CPUID: eax: 00000001; ecx: 00000000 => 00000f4a.00010800.0000649d.bfebfbff
    
    RDMSR Raw + Hard and WRMSR Raw + Dropped. In this case, requst to do microcode update
    in target CPU is dropped as our serialice.rom image doesn't contain that binary.
    
       0019.001a    RH..    [f000:e869]   CPU MSR: [00000017] => 00120000.00000000
       001c.001d    R..D    [f000:e88e]   CPU MSR: [00000079] <= 00000000.fffdfc10
    
    Change-Id: I99308636c6a997ac82740c7d715617a1564aba81
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 SerialICE/simba/core_io.lua | 12 ++++--------
 SerialICE/simba/output.lua  | 44 ++++++++++++++++++++++++++++++++------------
 SerialICE/simba/replay.lua  |  5 +++--
 3 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/SerialICE/simba/core_io.lua b/SerialICE/simba/core_io.lua
index 5781b5a..37db0ea 100644
--- a/SerialICE/simba/core_io.lua
+++ b/SerialICE/simba/core_io.lua
@@ -54,21 +54,17 @@ function mem_post(f, action)
 	local size = size_data(action.size, action.data)
 	if not f.decode or f.decode == F_FIXED then
 		if (action.write) then
-			printk(f, action, "write%s %08x <= %s", size_suffix(action.size), action.addr, size)
+			printk(f, action, "write%s %08x <= %s\n", size_suffix(action.size), action.addr, size)
 		else
-			printk(f, action, " read%s %08x => %s", size_suffix(action.size), action.addr, size)
+			printk(f, action, " read%s %08x => %s\n", size_suffix(action.size), action.addr, size)
 		end
 	elseif f.decode == F_RANGE then
 		if (action.write) then
-			printk(f, action, "[%08x] <= %s", bit32.band(action.addr, (f.size - 1)), size)
+			printk(f, action, "[%08x] <= %s\n", bit32.band(action.addr, (f.size - 1)), size)
 		else
-			printk(f, action, "[%08x] => %s", bit32.band(action.addr, (f.size - 1)), size)
+			printk(f, action, "[%08x] => %s\n", bit32.band(action.addr, (f.size - 1)), size)
 		end
 	end
-	if action.to_hw then
-		printf(" *")
-	end
-	printf("\n")
 	return true
 end
 
diff --git a/SerialICE/simba/output.lua b/SerialICE/simba/output.lua
index 41210da..c006248 100644
--- a/SerialICE/simba/output.lua
+++ b/SerialICE/simba/output.lua
@@ -17,31 +17,51 @@ function printf(s,...)
 	return io.write(s:format(...))
 end
 
-function printk(f, action, fmt, ...)
-	printf("[%04x:%04x] ", action.cs, action.eip)
-	printf("%04x.%04x ", action.parent_id, action.my_id)
+function print_address(pid, id, flags, cs, eip)
+	printf("%04x.%04x    %s    [%04x:%04x]   ",pid,id,flags,cs,eip)
+end
 
-	local str = " "
-	if action.dropped or action.faked then
-		str = "!"
+function printk(f, action, fmt, ...)
+	local str = ""
+	if action.undefined or action.f or action == cpu_action then
+		str = str .. "R"
+	else
+		str = str .. "."
+	end
+	if action.to_hw then
+		str = str .. "H"
+	elseif action.to_qemu then
+		str = str .. "Q"
+	else
+		str = str .. "."
 	end
 	if action.undefined then
-		str = "#"
+		str = str .. "U"
+	else
+		str = str .. "."
 	end
+	if action.dropped then
+		str = str .. "D"
+	elseif action.faked then
+		str = str .. "F"
+	else
+		str = str .. "."
+	end
+
+	print_address(action.parent_id, action.my_id, str, action.cs, action.eip)
 
 	if action.f then
-		printf("%s %s,%s: ", str, f.name, action.f.name)
+		printf("%s,%s: ", f.name, action.f.name)
 		printf(fmt, ...)
 	else
-		printf("%s %s: ", str, f.name)
+		printf("%s: ", f.name)
 		printf(fmt, ...)
 	end
 end
 
 function printks(f, fmt, ...)
-	printf("[%04x:%04x] ", 0, 0)
-	printf("%04x.%04x ", 0, 0)
-	printf("  %s: ", f.name)
+	print_address(0,0,"I...",0,0)
+	printf("%s: ", f.name)
 	printf(fmt, ...)
 end
 
diff --git a/SerialICE/simba/replay.lua b/SerialICE/simba/replay.lua
index f3ba17f..ec98149 100644
--- a/SerialICE/simba/replay.lua
+++ b/SerialICE/simba/replay.lua
@@ -35,8 +35,9 @@ function replay_unknown(str)
 	local dummy = {}
 	pre_action(dummy, false, 0, 0, 0)
 	post_action(dummy, 0)
-	io.write(string.format("[%04x:%04x] %04x.%04x   %s\n",
-			regs.cs, regs.eip, ids.parent, ids.this, str))
+	print_address(ids.parent, ids.this, "...", regs.cs, regs.eip)
+	printf(str)
+	printf("\n")
 end
 
 function parse_cpu(line)



More information about the SerialICE mailing list