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>
16 
__s390_backtrace(void * data,unsigned long address,int reliable)17 static int __s390_backtrace(void *data, unsigned long address, int reliable)
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 
s390_backtrace(struct pt_regs * regs,unsigned int depth)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 
oprofile_arch_init(struct oprofile_operations * ops)35 int __init oprofile_arch_init(struct oprofile_operations *ops)
36 {
37 	ops->backtrace = s390_backtrace;
38 	return 0;
39 }
40 
oprofile_arch_exit(void)41 void oprofile_arch_exit(void)
42 {
43 }
44