aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>2019-03-18 15:28:55 +1100
committerStewart Smith <stewart@linux.ibm.com>2019-03-28 15:24:12 +1100
commitb971b67ac2e10880c490e73be99fdeb9731bd395 (patch)
tree043f7923785503a96f82fd737f2b69504e9b3ddc /include
parentc9bc52a250a0f15e75b10670165f8e518a845b68 (diff)
downloadskiboot-b971b67ac2e10880c490e73be99fdeb9731bd395.zip
skiboot-b971b67ac2e10880c490e73be99fdeb9731bd395.tar.gz
skiboot-b971b67ac2e10880c490e73be99fdeb9731bd395.tar.bz2
core/stack: Define a backtrace metadata struct
Every time we take a backtrace, we have to store the number of entries, the OPAL API token, r1 caller and PIR values. Rather than defining these and passing them around all over the place, let's throw them in a struct. Define a struct, struct bt_metadata, to store these details, and convert ___backtrace() and ___print_backtrace() to use it. We change the wrapper functions __backtrace() and __print_backtrace() to call ___backtrace()/___print_backtrace() with struct bt_metadata, but don't change their parameter profiles for now - we'll do that later. Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/stack.h40
1 files changed, 28 insertions, 12 deletions
diff --git a/include/stack.h b/include/stack.h
index ae910a3..d8baf8d 100644
--- a/include/stack.h
+++ b/include/stack.h
@@ -107,36 +107,52 @@ struct stack_frame {
uint64_t dar;
} __attribute__((aligned(16)));
-/* Backtrace */
+/* Backtrace entry */
struct bt_entry {
unsigned long sp;
unsigned long pc;
};
+/* Backtrace metadata */
+struct bt_metadata {
+ unsigned int ents;
+ unsigned long token;
+ unsigned long r1_caller;
+ unsigned long pir;
+};
+
/* Boot stack top */
extern void *boot_stack_top;
/* Create a backtrace */
-void ___backtrace(struct bt_entry *entries, unsigned int *count,
- unsigned long *token, unsigned long *r1_caller);
+void ___backtrace(struct bt_entry *entries, unsigned int max_ents,
+ struct bt_metadata *metadata);
+
static inline void __backtrace(struct bt_entry *entries, unsigned int *count)
{
- unsigned long token, r1_caller;
+ struct bt_metadata metadata;
+
+ ___backtrace(entries, *count, &metadata);
- ___backtrace(entries, count, &token, &r1_caller);
+ *count = metadata.ents;
}
/* Convert a backtrace to ASCII */
-extern void ___print_backtrace(unsigned int pir, struct bt_entry *entries,
- unsigned int count, unsigned long token,
- unsigned long r1_caller, char *out_buf,
- unsigned int *len, bool symbols);
+extern void ___print_backtrace(struct bt_entry *entries,
+ struct bt_metadata *metadata, char *out_buf,
+ unsigned int *len, bool symbols);
static inline void __print_backtrace(unsigned int pir, struct bt_entry *entries,
- unsigned int count, char *out_buf,
- unsigned int *len, bool symbols)
+ unsigned int count, char *out_buf,
+ unsigned int *len, bool symbols)
{
- ___print_backtrace(pir, entries, count, OPAL_LAST + 1, 0, out_buf, len, symbols);
+ struct bt_metadata metadata = {
+ .ents = count,
+ .token = OPAL_LAST + 1,
+ .r1_caller = 0,
+ .pir = pir
+ };
+ ___print_backtrace(entries, &metadata, out_buf, len, symbols);
}
/* For use by debug code, create and print backtrace, uses a static buffer */