#ifndef __TRACE_H
#define __TRACE_H
+/* this file is included from a tool so uses uint32_t instead of u32, etc. */
+
enum {
/*
* This affects the granularity of our trace. We can bin function
* this value.
*/
FUNC_SITE_SIZE = 4, /* distance between function sites */
+
+ TRACE_VERSION = 1,
};
enum trace_chunk_type {
/* A header at the start of the trace output buffer */
struct trace_output_hdr {
enum trace_chunk_type type; /* Record type */
- size_t rec_count; /* Number of records */
+ uint32_t version; /* Version (TRACE_VERSION) */
+ uint32_t rec_count; /* Number of records */
+ uint32_t spare; /* 0 */
+ uint64_t text_base; /* Value of CONFIG_TEXT_BASE */
+ uint64_t spare2; /* 0 */
};
/* Print statistics about traced function calls */
enum ftrace_flags {
FUNCF_EXIT = 0UL << 30,
FUNCF_ENTRY = 1UL << 30,
- FUNCF_TEXTBASE = 2UL << 30,
+ /* two more values are available */
FUNCF_TIMESTAMP_MASK = 0x3fffffff,
};
hdr->ftrace_count++;
}
-static void notrace add_textbase(void)
-{
- if (hdr->ftrace_count < hdr->ftrace_size) {
- struct trace_call *rec = &hdr->ftrace[hdr->ftrace_count];
-
- rec->func = CONFIG_TEXT_BASE;
- rec->caller = 0;
- rec->flags = FUNCF_TEXTBASE;
- }
- hdr->ftrace_count++;
-}
-
/**
* __cyg_profile_func_enter() - record function entry
*
/* Update the header */
if (output_hdr) {
+ memset(output_hdr, '\0', sizeof(*output_hdr));
output_hdr->rec_count = upto;
output_hdr->type = TRACE_CHUNK_CALLS;
+ output_hdr->version = TRACE_VERSION;
+ output_hdr->text_base = CONFIG_TEXT_BASE;
}
/* Work out how must of the buffer we used */
/* Use any remaining space for the timed function trace */
hdr->ftrace = (struct trace_call *)(buff + needed);
hdr->ftrace_size = (buff_size - needed) / sizeof(*hdr->ftrace);
- add_textbase();
+ hdr->depth_limit = CONFIG_TRACE_CALL_DEPTH_LIMIT;
puts("trace: enabled\n");
- hdr->depth_limit = CONFIG_TRACE_CALL_DEPTH_LIMIT;
trace_enabled = 1;
trace_inited = 1;
/* Use any remaining space for the timed function trace */
hdr->ftrace = (struct trace_call *)((char *)hdr + needed);
hdr->ftrace_size = (buff_size - needed) / sizeof(*hdr->ftrace);
- add_textbase();
hdr->depth_limit = CONFIG_TRACE_EARLY_CALL_DEPTH_LIMIT;
printf("trace: early enable at %08x\n", CONFIG_TRACE_EARLY_ADDR);