// SPDX-License-Identifier: GPL-2.0 /* * ARM callchain support * * Copyright (C) 2009 picoChip Designs, Ltd., Jamie Iles * Copyright (C) 2010 ARM Ltd., Will Deacon <will.deacon@arm.com> * * This code is based on the ARM OProfile backtrace code.
*/ #include <linux/perf_event.h> #include <linux/uaccess.h>
#include <asm/stacktrace.h>
/* * The registers we're interested in are at the end of the variable * length saved register structure. The fp points at the end of this * structure so the address of this struct is: * (struct frame_tail *)(xxx->fp)-1 * * This code has been adapted from the ARM OProfile support.
*/ struct frame_tail { struct frame_tail __user *fp; unsignedlong sp; unsignedlong lr;
} __attribute__((packed));
/* * Get the return address for a single stackframe and return a pointer to the * next frame tail.
*/ staticstruct frame_tail __user *
user_backtrace(struct frame_tail __user *tail, struct perf_callchain_entry_ctx *entry)
{ struct frame_tail buftail; unsignedlong err;
if (!access_ok(tail, sizeof(buftail))) return NULL;
/* * Gets called by walk_stackframe() for every stackframe. This will be called * whist unwinding the stackframe and is like a subroutine return so we use * the PC.
*/ staticbool
callchain_trace(void *data, unsignedlong pc)
{ struct perf_callchain_entry_ctx *entry = data; return perf_callchain_store(entry, pc) == 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.