Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 2 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * S390 Version |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 4 | * Copyright IBM Corp. 2002, 2011 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * Author(s): Thomas Spatzier (tspat@de.ibm.com) |
Heinz Graalfs | c814d16 | 2011-02-15 13:02:14 -0500 | [diff] [blame] | 6 | * Author(s): Mahesh Salgaonkar (mahesh@linux.vnet.ibm.com) |
| 7 | * Author(s): Heinz Graalfs (graalfs@linux.vnet.ibm.com) |
Andreas Krebbel | dd3c467 | 2011-11-25 20:03:05 +0100 | [diff] [blame] | 8 | * Author(s): Andreas Krebbel (krebbel@linux.vnet.ibm.com) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * |
Heinz Graalfs | c814d16 | 2011-02-15 13:02:14 -0500 | [diff] [blame] | 10 | * @remark Copyright 2002-2011 OProfile authors |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #include <linux/oprofile.h> |
| 14 | #include <linux/init.h> |
Andreas Krebbel | dd3c467 | 2011-11-25 20:03:05 +0100 | [diff] [blame] | 15 | #include <asm/processor.h> |
Heinz Graalfs | c814d16 | 2011-02-15 13:02:14 -0500 | [diff] [blame] | 16 | |
Heiko Carstens | d020863 | 2016-10-17 11:08:31 +0200 | [diff] [blame] | 17 | static int __s390_backtrace(void *data, unsigned long address, int reliable) |
Heiko Carstens | 758d39e | 2016-02-09 12:58:54 +0100 | [diff] [blame] | 18 | { |
| 19 | unsigned int *depth = data; |
| 20 | |
| 21 | if (*depth == 0) |
| 22 | return 1; |
| 23 | (*depth)--; |
| 24 | oprofile_add_trace(address); |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | static void s390_backtrace(struct pt_regs *regs, unsigned int depth) |
| 29 | { |
| 30 | if (user_mode(regs)) |
| 31 | return; |
| 32 | dump_trace(__s390_backtrace, &depth, NULL, regs->gprs[15]); |
| 33 | } |
| 34 | |
Robert Richter | ec6b426 | 2011-03-16 12:10:12 +0100 | [diff] [blame] | 35 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | { |
Andreas Krebbel | d0f4c16 | 2006-01-06 00:19:16 -0800 | [diff] [blame] | 37 | ops->backtrace = s390_backtrace; |
Andreas Krebbel | dd3c467 | 2011-11-25 20:03:05 +0100 | [diff] [blame] | 38 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | void oprofile_arch_exit(void) |
| 42 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | } |