aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/processor.h1
-rw-r--r--arch/s390/kernel/dis.c27
2 files changed, 28 insertions, 0 deletions
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index c40fa91e38a8..31feac630544 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -138,6 +138,7 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
138extern unsigned long thread_saved_pc(struct task_struct *t); 138extern unsigned long thread_saved_pc(struct task_struct *t);
139 139
140extern void show_code(struct pt_regs *regs); 140extern void show_code(struct pt_regs *regs);
141extern int insn_to_mnemonic(unsigned char *instruction, char buf[8]);
141 142
142unsigned long get_wchan(struct task_struct *p); 143unsigned long get_wchan(struct task_struct *p);
143#define task_pt_regs(tsk) ((struct pt_regs *) \ 144#define task_pt_regs(tsk) ((struct pt_regs *) \
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index 1f6b428e2762..c02310b8db09 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -1468,6 +1468,33 @@ static struct insn *find_insn(unsigned char *code)
1468 return NULL; 1468 return NULL;
1469} 1469}
1470 1470
1471/**
1472 * insn_to_mnemonic - decode an s390 instruction
1473 * @instruction: instruction to decode
1474 * @buf: buffer to fill with mnemonic
1475 *
1476 * Decode the instruction at @instruction and store the corresponding
1477 * mnemonic into @buf.
1478 * @buf is left unchanged if the instruction could not be decoded.
1479 * Returns:
1480 * %0 on success, %-ENOENT if the instruction was not found.
1481 */
1482int insn_to_mnemonic(unsigned char *instruction, char buf[8])
1483{
1484 struct insn *insn;
1485
1486 insn = find_insn(instruction);
1487 if (!insn)
1488 return -ENOENT;
1489 if (insn->name[0] == '\0')
1490 snprintf(buf, sizeof(buf), "%s",
1491 long_insn_name[(int) insn->name[1]]);
1492 else
1493 snprintf(buf, sizeof(buf), "%.5s", insn->name);
1494 return 0;
1495}
1496EXPORT_SYMBOL_GPL(insn_to_mnemonic);
1497
1471static int print_insn(char *buffer, unsigned char *code, unsigned long addr) 1498static int print_insn(char *buffer, unsigned char *code, unsigned long addr)
1472{ 1499{
1473 struct insn *insn; 1500 struct insn *insn;