ETMv4 and PTM trace have a runtime option called "return stack". This is where the hardware saves potential return addresses from Branch+Link instructions onto a stack and uses the top of stack value if it matches for indirect branch instructions, rather than explicitly trace the branch value. This reduces the number of trace bytes in the stream.
If this option is active then the decoder must mirror the return stack from BL instructions and use it when it would ordinarily expect an explicitly traced address on an indirect branch instruction.
V2 changes: This set applies onto 0.6.1 of the master branch which contains a bugfix for the instruction follower branching from A32 to T32.
Tests on mixed T32/A32 code showed an issue with the return stack push/pop not saving ISA state. This is now added.
Mike Leach (9): opencsd: Add log message call to trace component base class. opencsd: new error type for return stack handling. opencsd: Add return stack object to library opencsd: Add return stack handling to PTM decoder opencsd: Add test trace snapshot for PTM return stack. opencsd: ETMv4 decoder: Implement trace return stack handling. opencsd: ETMv4 - juno add test snapshot for return stack testing opencsd: PTM test snapshot for return stack with A32 and T32 mixed code. opencsd: Update README and versions for v0.7
README.md | 15 +- decoder/build/linux/ref_trace_decode_lib/makefile | 1 + .../ref_trace_decode_lib.vcxproj | 2 + .../ref_trace_decode_lib.vcxproj.filters | 6 + decoder/include/common/trc_component.h | 8 + decoder/include/common/trc_ret_stack.h | 120 + decoder/include/etmv4/trc_pkt_decode_etmv4i.h | 5 + decoder/include/ocsd_if_types.h | 1 + decoder/include/ocsd_if_version.h | 6 +- decoder/include/ptm/trc_pkt_decode_ptm.h | 3 + decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp | 66 +- decoder/source/ocsd_error.cpp | 1 + decoder/source/ptm/trc_pkt_decode_ptm.cpp | 51 +- decoder/source/trc_ret_stack.cpp | 122 + decoder/tests/snapshots/juno-ret-stck/cpu_0.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_1.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_2.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_3.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_4.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_5.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cstrace.bin | Bin 0 -> 65536 bytes .../tests/snapshots/juno-ret-stck/device_10.ini | 18 + .../tests/snapshots/juno-ret-stck/device_11.ini | 18 + decoder/tests/snapshots/juno-ret-stck/device_6.ini | 18 + decoder/tests/snapshots/juno-ret-stck/device_7.ini | 18 + decoder/tests/snapshots/juno-ret-stck/device_8.ini | 18 + decoder/tests/snapshots/juno-ret-stck/device_9.ini | 18 + .../tests/snapshots/juno-ret-stck/kernel_dump.bin | Bin 0 -> 7340032 bytes decoder/tests/snapshots/juno-ret-stck/snapshot.ini | 20 + decoder/tests/snapshots/juno-ret-stck/trace.ini | 23 + .../tests/snapshots/tc2-ptm-rstk-t32/PTM_0_2.bin | Bin 0 -> 27884 bytes .../tests/snapshots/tc2-ptm-rstk-t32/README.txt | 1 + .../tests/snapshots/tc2-ptm-rstk-t32/device1.ini | 357 + .../tests/snapshots/tc2-ptm-rstk-t32/device2.ini | 129 + .../tests/snapshots/tc2-ptm-rstk-t32/device3.ini | 129 + .../tests/snapshots/tc2-ptm-rstk-t32/device4.ini | 129 + .../tests/snapshots/tc2-ptm-rstk-t32/device5.ini | 89 + .../tests/snapshots/tc2-ptm-rstk-t32/device6.ini | 89 + .../tc2-ptm-rstk-t32/ds-5_trace_dump/a15_rs.txt | 10005 +++++++++++++++++++ .../mem_Cortex-A15_0_0_VECTORS.bin | Bin 0 -> 632 bytes .../mem_Cortex-A15_0_1_RO_CODE.bin | Bin 0 -> 6576 bytes .../mem_Cortex-A15_0_2_RO_DATA.bin | Bin 0 -> 304 bytes .../mem_Cortex-A15_0_3_RW_DATA.bin | Bin 0 -> 16 bytes .../mem_Cortex-A15_0_4_ZI_DATA.bin | Bin 0 -> 576 bytes .../mem_Cortex-A15_0_5_ARM_LIB_HEAP.bin | Bin 0 -> 262144 bytes .../mem_Cortex-A15_0_6_ARM_LIB_STACK.bin | Bin 0 -> 65536 bytes .../mem_Cortex-A15_0_7_IRQ_STACK.bin | Bin 0 -> 65536 bytes .../tc2-ptm-rstk-t32/mem_Cortex-A15_0_8_TTB.bin | Bin 0 -> 16384 bytes .../tests/snapshots/tc2-ptm-rstk-t32/snapshot.ini | 16 + decoder/tests/snapshots/tc2-ptm-rstk-t32/trace.ini | 24 + decoder/tests/snapshots/trace_cov_a15/PTM_0_2.bin | Bin 0 -> 36 bytes decoder/tests/snapshots/trace_cov_a15/README.txt | 1 + decoder/tests/snapshots/trace_cov_a15/device1.ini | 357 + decoder/tests/snapshots/trace_cov_a15/device2.ini | 129 + decoder/tests/snapshots/trace_cov_a15/device3.ini | 129 + decoder/tests/snapshots/trace_cov_a15/device4.ini | 129 + decoder/tests/snapshots/trace_cov_a15/device5.ini | 89 + decoder/tests/snapshots/trace_cov_a15/device6.ini | 89 + .../trace_cov_a15/mem_Cortex-A15_0_0_VECTORS.bin | Bin 0 -> 632 bytes .../trace_cov_a15/mem_Cortex-A15_0_1_RO_CODE.bin | Bin 0 -> 6576 bytes .../trace_cov_a15/mem_Cortex-A15_0_2_RO_DATA.bin | Bin 0 -> 304 bytes .../trace_cov_a15/mem_Cortex-A15_0_3_RW_DATA.bin | Bin 0 -> 16 bytes .../trace_cov_a15/mem_Cortex-A15_0_4_ZI_DATA.bin | Bin 0 -> 576 bytes .../mem_Cortex-A15_0_5_ARM_LIB_HEAP.bin | Bin 0 -> 262144 bytes .../mem_Cortex-A15_0_6_ARM_LIB_STACK.bin | Bin 0 -> 65536 bytes .../trace_cov_a15/mem_Cortex-A15_0_7_IRQ_STACK.bin | Bin 0 -> 65536 bytes .../trace_cov_a15/mem_Cortex-A15_0_8_TTB.bin | Bin 0 -> 16384 bytes decoder/tests/snapshots/trace_cov_a15/snapshot.ini | 16 + decoder/tests/snapshots/trace_cov_a15/trace.ini | 24 + 69 files changed, 12563 insertions(+), 22 deletions(-) create mode 100644 decoder/include/common/trc_ret_stack.h create mode 100644 decoder/source/trc_ret_stack.cpp create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_0.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_1.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_2.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_3.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_4.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_5.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cstrace.bin create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_10.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_11.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_6.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_7.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_8.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_9.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/kernel_dump.bin create mode 100644 decoder/tests/snapshots/juno-ret-stck/snapshot.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/trace.ini create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/PTM_0_2.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/README.txt create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/device1.ini create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/device2.ini create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/device3.ini create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/device4.ini create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/device5.ini create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/device6.ini create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/ds-5_trace_dump/a15_rs.txt create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/mem_Cortex-A15_0_0_VECTORS.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/mem_Cortex-A15_0_1_RO_CODE.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/mem_Cortex-A15_0_2_RO_DATA.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/mem_Cortex-A15_0_3_RW_DATA.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/mem_Cortex-A15_0_4_ZI_DATA.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/mem_Cortex-A15_0_5_ARM_LIB_HEAP.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/mem_Cortex-A15_0_6_ARM_LIB_STACK.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/mem_Cortex-A15_0_7_IRQ_STACK.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/mem_Cortex-A15_0_8_TTB.bin create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/snapshot.ini create mode 100644 decoder/tests/snapshots/tc2-ptm-rstk-t32/trace.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/PTM_0_2.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/README.txt create mode 100644 decoder/tests/snapshots/trace_cov_a15/device1.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device2.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device3.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device4.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device5.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device6.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_0_VECTORS.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_1_RO_CODE.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_2_RO_DATA.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_3_RW_DATA.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_4_ZI_DATA.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_5_ARM_LIB_HEAP.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_6_ARM_LIB_STACK.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_7_IRQ_STACK.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_8_TTB.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/snapshot.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/trace.ini