Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * S390 Version |
| 4 | * Copyright IBM Corp. 2002, 2011 |
| 5 | * Author(s): Thomas Spatzier (tspat@de.ibm.com) |
| 6 | * Author(s): Mahesh Salgaonkar (mahesh@linux.vnet.ibm.com) |
| 7 | * Author(s): Heinz Graalfs (graalfs@linux.vnet.ibm.com) |
| 8 | * Author(s): Andreas Krebbel (krebbel@linux.vnet.ibm.com) |
| 9 | * |
| 10 | * @remark Copyright 2002-2011 OProfile authors |
| 11 | */ |
| 12 | |
| 13 | #include <linux/oprofile.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <asm/processor.h> |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 16 | #include <asm/unwind.h> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 17 | |
| 18 | static void s390_backtrace(struct pt_regs *regs, unsigned int depth) |
| 19 | { |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 20 | struct unwind_state state; |
| 21 | |
| 22 | unwind_for_each_frame(&state, current, regs, 0) { |
| 23 | if (depth-- == 0) |
| 24 | break; |
| 25 | oprofile_add_trace(state.ip); |
| 26 | } |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
| 30 | { |
| 31 | ops->backtrace = s390_backtrace; |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | void oprofile_arch_exit(void) |
| 36 | { |
| 37 | } |