1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/compiler.h>
3 
4 static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *name)
5 {
6 	struct ins_ops *ops = NULL;
7 
8 	/* catch all kind of jumps */
9 	if (strchr(name, 'j') ||
10 	    !strncmp(name, "bct", 3) ||
11 	    !strncmp(name, "br", 2))
12 		ops = &jump_ops;
13 	/* override call/returns */
14 	if (!strcmp(name, "bras") ||
15 	    !strcmp(name, "brasl") ||
16 	    !strcmp(name, "basr"))
17 		ops = &call_ops;
18 	if (!strcmp(name, "br"))
19 		ops = &ret_ops;
20 
21 	if (ops)
22 		arch__associate_ins_ops(arch, name, ops);
23 	return ops;
24 }
25 
26 static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
27 {
28 	if (!arch->initialized) {
29 		arch->initialized = true;
30 		arch->associate_instruction_ops = s390__associate_ins_ops;
31 	}
32 
33 	return 0;
34 }
35