| * arch/arm64/kernel/return_address.c |
| * Copyright (C) 2013 Linaro Limited |
| * Author: AKASHI Takahiro <takahiro.akashi@linaro.org> |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License version 2 as |
| * published by the Free Software Foundation. |
| #include <linux/export.h> |
| #include <linux/ftrace.h> |
| #include <asm/stacktrace.h> |
| struct return_address_data { |
| static int save_return_addr(struct stackframe *frame, void *d) |
| struct return_address_data *data = d; |
| data->addr = (void *)frame->pc; |
| void *return_address(unsigned int level) |
| struct return_address_data data; |
| frame.fp = (unsigned long)__builtin_frame_address(0); |
| frame.sp = current_stack_pointer; |
| frame.pc = (unsigned long)return_address; /* dummy */ |
| #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| frame.graph = current->curr_ret_stack; |
| walk_stackframe(current, &frame, save_return_addr, &data); |
| EXPORT_SYMBOL_GPL(return_address); |