aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuzuki K. Poulose <suzuki@in.ibm.com>2013-08-29 05:05:48 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-10-24 11:16:48 -0400
commit648ae35c54b147c3b25d212f2936bb1cb91ea7d0 (patch)
tree32b1571120c4b0984968e924225375f2a248cdb1
parentf616d6760716f702b3aa459fd20c8d8cce693abd (diff)
s390/dis: move common definitions to a header file
The patch moves some of the definitions to a header file. No functional changes involved. I have retained the Copyright Statement from the original file. Signed-off-by: Suzuki K Poulose <suzuki@in.ibm.com> [Heiko Carstens: rename s390-dis.h to dis.h] Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/dis.h42
-rw-r--r--arch/s390/kernel/dis.c29
2 files changed, 43 insertions, 28 deletions
diff --git a/arch/s390/include/asm/dis.h b/arch/s390/include/asm/dis.h
new file mode 100644
index 000000000000..6f73119ef27e
--- /dev/null
+++ b/arch/s390/include/asm/dis.h
@@ -0,0 +1,42 @@
1/*
2 * Disassemble s390 instructions.
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
6 */
7
8#ifndef __ASM_S390_DIS_H__
9#define __ASM_S390_DIS_H__
10
11/* Type of operand */
12#define OPERAND_GPR 0x1 /* Operand printed as %rx */
13#define OPERAND_FPR 0x2 /* Operand printed as %fx */
14#define OPERAND_AR 0x4 /* Operand printed as %ax */
15#define OPERAND_CR 0x8 /* Operand printed as %cx */
16#define OPERAND_DISP 0x10 /* Operand printed as displacement */
17#define OPERAND_BASE 0x20 /* Operand printed as base register */
18#define OPERAND_INDEX 0x40 /* Operand printed as index register */
19#define OPERAND_PCREL 0x80 /* Operand printed as pc-relative symbol */
20#define OPERAND_SIGNED 0x100 /* Operand printed as signed value */
21#define OPERAND_LENGTH 0x200 /* Operand printed as length (+1) */
22
23
24struct s390_operand {
25 int bits; /* The number of bits in the operand. */
26 int shift; /* The number of bits to shift. */
27 int flags; /* One bit syntax flags. */
28};
29
30struct s390_insn {
31 const char name[5];
32 unsigned char opfrag;
33 unsigned char format;
34};
35
36
37static inline int insn_length(unsigned char code)
38{
39 return ((((int) code + 64) >> 7) + 1) << 1;
40}
41
42#endif /* __ASM_S390_DIS_H__ */
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index 5fb278eb5e46..ce554f3ec445 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -23,6 +23,7 @@
23#include <linux/kdebug.h> 23#include <linux/kdebug.h>
24 24
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/dis.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <linux/atomic.h> 28#include <linux/atomic.h>
28#include <asm/mathemu.h> 29#include <asm/mathemu.h>
@@ -37,17 +38,6 @@
37#define ONELONG "%016lx: " 38#define ONELONG "%016lx: "
38#endif /* CONFIG_64BIT */ 39#endif /* CONFIG_64BIT */
39 40
40#define OPERAND_GPR 0x1 /* Operand printed as %rx */
41#define OPERAND_FPR 0x2 /* Operand printed as %fx */
42#define OPERAND_AR 0x4 /* Operand printed as %ax */
43#define OPERAND_CR 0x8 /* Operand printed as %cx */
44#define OPERAND_DISP 0x10 /* Operand printed as displacement */
45#define OPERAND_BASE 0x20 /* Operand printed as base register */
46#define OPERAND_INDEX 0x40 /* Operand printed as index register */
47#define OPERAND_PCREL 0x80 /* Operand printed as pc-relative symbol */
48#define OPERAND_SIGNED 0x100 /* Operand printed as signed value */
49#define OPERAND_LENGTH 0x200 /* Operand printed as length (+1) */
50
51enum { 41enum {
52 UNUSED, /* Indicates the end of the operand list */ 42 UNUSED, /* Indicates the end of the operand list */
53 R_8, /* GPR starting at position 8 */ 43 R_8, /* GPR starting at position 8 */
@@ -155,18 +145,6 @@ enum {
155 INSTR_S_00, INSTR_S_RD, 145 INSTR_S_00, INSTR_S_RD,
156}; 146};
157 147
158struct s390_operand {
159 int bits; /* The number of bits in the operand. */
160 int shift; /* The number of bits to shift. */
161 int flags; /* One bit syntax flags. */
162};
163
164struct s390_insn {
165 const char name[5];
166 unsigned char opfrag;
167 unsigned char format;
168};
169
170static const struct s390_operand operands[] = 148static const struct s390_operand operands[] =
171{ 149{
172 [UNUSED] = { 0, 0, 0 }, 150 [UNUSED] = { 0, 0, 0 },
@@ -1608,11 +1586,6 @@ static unsigned int extract_operand(unsigned char *code,
1608 return val; 1586 return val;
1609} 1587}
1610 1588
1611static inline int insn_length(unsigned char code)
1612{
1613 return ((((int) code + 64) >> 7) + 1) << 1;
1614}
1615
1616static struct s390_insn *find_insn(unsigned char *code) 1589static struct s390_insn *find_insn(unsigned char *code)
1617{ 1590{
1618 unsigned char opfrag = code[1]; 1591 unsigned char opfrag = code[1];