arch: arm64: Enable tracing

Enable the tracing hooks on the ARM64 platform and white-list the
tracing tests.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
Carlo Caione 2019-11-18 09:49:25 +00:00 committed by Anas Nashif
commit 0d5e011be4
5 changed files with 33 additions and 2 deletions

View file

@ -15,6 +15,11 @@
GTEXT(arch_cpu_idle)
SECTION_FUNC(TEXT, arch_cpu_idle)
#ifdef CONFIG_TRACING
stp xzr, x30, [sp, #-16]!
bl sys_trace_idle
ldp xzr, x30, [sp], #16
#endif
dsb sy
wfi
msr daifclr, #(DAIFSET_IRQ)
@ -22,6 +27,11 @@ SECTION_FUNC(TEXT, arch_cpu_idle)
GTEXT(arch_cpu_atomic_idle)
SECTION_FUNC(TEXT, arch_cpu_atomic_idle)
#ifdef CONFIG_TRACING
stp xzr, x30, [sp, #-16]!
bl sys_trace_idle
ldp xzr, x30, [sp], #16
#endif
msr daifset, #(DAIFSET_IRQ)
isb
wfe

View file

@ -58,11 +58,19 @@ SECTION_FUNC(TEXT, _isr_wrapper)
add x2, x2, #1
str x2, [x1, #_kernel_offset_to_nested]
#ifdef CONFIG_TRACING
bl sys_trace_isr_enter
#endif
/* Cortex-A has one IRQ line so the main handler will be at offset 0 */
ldr x1, =_sw_isr_table
ldp x0, x3, [x1] /* arg in x0, ISR in x3 */
blr x3
#ifdef CONFIG_TRACING
bl sys_trace_isr_exit
#endif
/* --(_kernel->nested) */
ldr x1, =_kernel
ldr x2, [x1, #_kernel_offset_to_nested]

View file

@ -39,6 +39,11 @@ GDATA(_k_neg_eagain)
*/
GTEXT(z_arm64_pendsv)
SECTION_FUNC(TEXT, z_arm64_pendsv)
#ifdef CONFIG_TRACING
stp xzr, x30, [sp, #-16]!
bl sys_trace_thread_switched_in
ldp xzr, x30, [sp], #16
#endif
/* load _kernel into x1 and current k_thread into x2 */
ldr x1, =_kernel
ldr x2, [x1, #_kernel_offset_to_current]
@ -112,6 +117,12 @@ SECTION_FUNC(TEXT, z_arm64_pendsv)
ldr x6, [x0]
mov sp, x6
#ifdef CONFIG_TRACING
stp xzr, x30, [sp, #-16]!
bl sys_trace_thread_switched_out
ldp xzr, x30, [sp], #16
#endif
/* We restored x30 from the process stack. There are three possible
* cases:
*

View file

@ -17,4 +17,3 @@ testing:
- net
- nfc
- shell
- tracing

View file

@ -44,7 +44,10 @@ size_t _kernel_openocd_offsets[] = {
[OPENOCD_OFFSET_T_USER_OPTIONS] = offsetof(struct _thread_base,
user_options),
[OPENOCD_OFFSET_T_PRIO] = offsetof(struct _thread_base, prio),
#if defined(CONFIG_ARM)
#if defined(CONFIG_ARM64)
[OPENOCD_OFFSET_T_STACK_PTR] = offsetof(struct k_thread,
callee_saved.sp),
#elif defined(CONFIG_ARM)
[OPENOCD_OFFSET_T_STACK_PTR] = offsetof(struct k_thread,
callee_saved.psp),
#elif defined(CONFIG_ARC)