log every write to register
Hello, List!
I have a collection of ARMv8 register names. I need to add special logging mode to QEMU so that every time it is enabled, every write access to any of the specified registers will produce a new record to log, including register name and a value to be written.
Is it possible to accomplish such a task? If yes, where shall I find functions that implement "writing to register" functionality?
Thanks in advance!
Sincerely yours,
Sergey Smolov
Quoted 7 lines · Sergey Smolov
I have a collection of ARMv8 register names. I need to add special logging mode to QEMU so that every time it is enabled, every write access to any of the specified registers will produce a new record to log, including register name and a value to be written.
Is it possible to accomplish such a task? If yes, where shall I find functions that implement "writing to register" functionality?
This is difficult, because we don't have a single convenient location which all register accesses go through. (General purpose registers and some system registers will be optimised so that accesses are made directly from JIT generated code.)
thanks
-- PMM
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Sergey Smolov
I have a collection of ARMv8 register names. I need to add special logging mode to QEMU so that every time it is enabled, every write access to any of the specified registers will produce a new record to log, including register name and a value to be written.
Quoted 8 lines
Quoted 2 lines
Is it possible to accomplish such a task? If yes, where shall I find functions that implement "writing to register" functionality?
This is difficult, because we don't have a single convenient location which all register accesses go through. (General purpose registers and some system registers will be optimised so that accesses are made directly from JIT generated code.)
You may be able to hack the TCG generation functions to call out to helper context (which implements your log) on each op that updates your specific regs. It will kill performance though if those registers are hot.
Regards,
Peter
Quoted 3 lines
thanks
-- PMM
03.11.2015 20:29, Peter Crosthwaite пишет:
Quoted 14 lines · Peter Maydell
Quoted 6 lines · Sergey Smolov
Quoted 5 lines
I have a collection of ARMv8 register names. I need to add special logging mode to QEMU so that every time it is enabled, every write access to any of the specified registers will produce a new record to log, including register name and a value to be written.
Quoted 7 lines
Quoted 2 lines
Is it possible to accomplish such a task? If yes, where shall I find functions that implement "writing to register" functionality?
This is difficult, because we don't have a single convenient location which all register accesses go through. (General purpose registers and some system registers will be optimised so that accesses are made directly from JIT generated code.)
Quoted 4 lines
You may be able to hack the TCG generation functions to call out to helper context (which implements your log) on each op that updates your specific regs. It will kill performance though if those registers are hot.
Thank you for your answer!
Could you explain the idea in a more detailed way?
Which TCG generation functions should i hack for write-to-specific-regs logging?
Thanks in advance,
Sergey Smolov
Quoted 25 lines · Sergey Smolov
03.11.2015 20:29, Peter Crosthwaite пишет:
Quoted 18 lines
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Sergey Smolov
I have a collection of ARMv8 register names. I need to add special logging
mode to QEMU so that every time it is enabled, every write access to any of
the specified registers will produce a new record to log, including register
name and a value to be written.Quoted 7 lines
Quoted 2 lines
Is it possible to accomplish such a task? If yes, where shall I find functions that implement "writing to register" functionality?
This is difficult, because we don't have a single convenient location which all register accesses go through. (General purpose registers and some system registers will be optimised so that accesses are made directly from JIT generated code.)
Quoted 4 lines
You may be able to hack the TCG generation functions to call out to helper context (which implements your log) on each op that updates your specific regs. It will kill performance though if those registers are hot.
Quoted 4 lines
Thank you for your answer!
Could you explain the idea in a more detailed way? Which TCG generation functions should i hack for write-to-specific-regs logging?
As of general system/coprocessor registers you could first look at target-arm/translate-a64.c:handle_sys() and target-arm/translate.c:disas_coproc_insn().
Best regards,
Sergey