| * arch/arm/kernel/return_address.c |
| * Copyright (C) 2009 Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> |
| * 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> |
| #if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) |
| #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.lr = (unsigned long)__builtin_return_address(0); |
| frame.pc = (unsigned long)return_address; |
| walk_stackframe(&frame, save_return_addr, &data); |
| #endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) */ |
| EXPORT_SYMBOL_GPL(return_address); |