Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2597
-gerrit
commit 10c41b5ed7c5718821bde96903e4a97fd12cf241 Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Tue Mar 5 09:40:28 2013 +0200
Only log Raw action lines from Qemu session
The only lines a qemu session with SerialICE needs to write in the output are those produced with the core filters and marked with the flag Raw "R...". Everything else can be replayed from these.
This is a principal change: the output of Qemu session is now completely raw and one must pass the logfile thru replayer to have simplified view.
Change-Id: I6e4eebde41ca46072c545c02eabac848113bb5ee Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- SerialICE/simba/core_io.lua | 4 ++-- SerialICE/simba/cpu.lua | 4 +++- SerialICE/simba/hooks.lua | 24 ++++++++++++------------ SerialICE/simba/output.lua | 37 +++++++++++++++++++++++++++++++------ SerialICE/simba/replay.lua | 9 +-------- SerialICE/simba/serialice.lua | 4 ++-- SerialICE/simba/smbus_host.lua | 1 - 7 files changed, 51 insertions(+), 32 deletions(-)
diff --git a/SerialICE/simba/core_io.lua b/SerialICE/simba/core_io.lua index 0aa67fd..08ae42e 100644 --- a/SerialICE/simba/core_io.lua +++ b/SerialICE/simba/core_io.lua @@ -8,7 +8,6 @@ F_RANGE = 2 function io_undefined(f, action) action.to_hw = true action.to_qemu = false - action.undefined = true return true end
@@ -32,6 +31,7 @@ end
filter_io_fallback = { name = "IO", + raw = true, pre = io_undefined, post = io_post, decode = F_FIXED, @@ -45,7 +45,6 @@ filter_io_fallback = { function mem_undefined(f, action) action.to_hw = true action.to_qemu = false - action.undefined = true return true end
@@ -69,6 +68,7 @@ end
filter_mem_fallback = { name = "MEM", + raw = true, pre = mem_undefined, post = mem_post, decode = F_FIXED, diff --git a/SerialICE/simba/cpu.lua b/SerialICE/simba/cpu.lua index 6dad741..02839a9 100644 --- a/SerialICE/simba/cpu.lua +++ b/SerialICE/simba/cpu.lua @@ -72,6 +72,7 @@ end
filter_cpumsr_fallback = { name = "CPU MSR", + raw = true, pre = cpumsr_pre, post = cpumsr_post, } @@ -96,6 +97,7 @@ end
filter_cpuid_fallback = { name = "CPUID", + raw = true, pre = cpuid_pre, post = cpuid_post, } @@ -114,7 +116,7 @@ function multicore_post(f, action) if not action.write and rin.eax == 0x01 then rout.ebx = bit32.band(0xff00ffff, rout.ebx); rout.ebx = bit32.bor(0x00010000, rout.ebx); - fake_action(f, action, 0) + return fake_action(f, action, 0) end return skip_filter(f, action) end diff --git a/SerialICE/simba/hooks.lua b/SerialICE/simba/hooks.lua index 01aea65..4a0d529 100644 --- a/SerialICE/simba/hooks.lua +++ b/SerialICE/simba/hooks.lua @@ -85,12 +85,16 @@ function walk_pre_hooks(list, action) f = l.hook if no_base_check or action.addr >= f.base and action.addr < f.base + f.size then if f.enable and f.pre then - logged = f.pre(f, action) + if f.pre(f, action) then + if not f.raw then + action.logged_pre = f + end + logged = true + end end end l = l.next end - if prev_filter ~= f and not action.ignore then prev_filter = f new_parent_action() @@ -118,15 +122,11 @@ function walk_post_hooks(list, action) f = l.hook if no_base_check or action.addr >= f.base and action.addr < f.base + f.size then if f.enable and f.post then - if no_base_check then - -- cpuid or cpumsr - logged = f.post(f, action) - else - -- io or mem - if f.post(f, action) then - action.f = f - logged = f.hide and not log_everything + if f.post(f, action) then + if not f.raw then + action.logged_post = f end + logged = false end end end @@ -218,9 +218,9 @@ function pre_action(action, dir_wr, addr, size, data) action.my_id = 0
-- no filter, not filtered - action.f = nil + action.logged_pre = nil + action.logged_post = nil action.ignore = false - action.undefined = false action.faked = false action.dropped = false action.to_hw = false diff --git a/SerialICE/simba/output.lua b/SerialICE/simba/output.lua index 10977ea..889dcc1 100644 --- a/SerialICE/simba/output.lua +++ b/SerialICE/simba/output.lua @@ -12,7 +12,21 @@ end
function printk(f, action, fmt, ...) local str = "" - if action.undefined or action.f or action == cpu_action then + + -- For Qemu runs only Raw actions are logged + if not replaying and not f.raw then + return + end + + -- For replays, a post filter prevents further lines for the + -- same action from printing if it has property hide set. + if replaying and not log_everything then + if action.logged_post and action.logged_post.hide then + return + end + end + + if f.raw then str = str .. "R" elseif action.info_only then str = str .. "I" @@ -29,7 +43,7 @@ function printk(f, action, fmt, ...) else str = str .. "." end - if action.undefined then + if f.raw and not (action.logged_pre or action.logged_post) then str = str .. "U" elseif action.dropped then str = str .. "D" @@ -41,12 +55,23 @@ function printk(f, action, fmt, ...)
print_address(action.parent_id, action.my_id, str, action.cs, action.eip)
- if action.f then - printf("%s,%s: ", f.name, action.f.name) - printf(fmt, ...) - else + if not replaying then printf("%s: ", f.name) printf(fmt, ...) + else + if not f.raw then + printf("%s: ", f.name) + printf(fmt, ...) + elseif action.logged_post then + printf("%s: ", action.logged_post.name) + printf(fmt, ...) + elseif action.logged_pre then + printf("%s: ", action.logged_pre.name) + printf(fmt, ...) + else + printf("%s: ", f.name) + printf(fmt, ...) + end end end
diff --git a/SerialICE/simba/replay.lua b/SerialICE/simba/replay.lua index 3ac0434..4632c05 100644 --- a/SerialICE/simba/replay.lua +++ b/SerialICE/simba/replay.lua @@ -1,5 +1,5 @@
-local verbose_log = false +replaying = true
function SerialICE_register_physical() end @@ -176,8 +176,6 @@ function parse_headers() found, _, board = string.find(line, "SerialICE: Mainboard...:%s+(.+)") if found then SerialICE_mainboard = board - io.write(line) - io.write("\n") end end if string.find(line, "LUA script initialized.") then @@ -267,11 +265,6 @@ function parse_file() end
parse_headers() - dofile("serialice.lua") - --- set logging -log_everything = verbose_log - parse_file()
diff --git a/SerialICE/simba/serialice.lua b/SerialICE/simba/serialice.lua index 7cabf67..434556f 100644 --- a/SerialICE/simba/serialice.lua +++ b/SerialICE/simba/serialice.lua @@ -68,6 +68,8 @@ dofile("pc80.lua") dofile("superio.lua") dofile("mmio.lua")
+io.write("SerialICE: LUA script initialized.\n") + function do_minimal_setup() enable_hook(io_hooks, filter_io_fallback) enable_hook(mem_hooks, filter_mem_fallback) @@ -106,7 +108,5 @@ else do_default_setup() end
-root_info("LUA script initialized.\n") - return true
diff --git a/SerialICE/simba/smbus_host.lua b/SerialICE/simba/smbus_host.lua index a407843..161bc42 100644 --- a/SerialICE/simba/smbus_host.lua +++ b/SerialICE/simba/smbus_host.lua @@ -186,7 +186,6 @@ local function dump_transaction(f, action) end
if signal_in(f, SIG_TIMEOUT) then - action.undefined = true dump = dump .. " (TIMEOUT) " end