0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef __ASM_PPC_DISASSEMBLE_H__
0010 #define __ASM_PPC_DISASSEMBLE_H__
0011
0012 #include <linux/types.h>
0013
0014 static inline unsigned int get_op(u32 inst)
0015 {
0016 return inst >> 26;
0017 }
0018
0019 static inline unsigned int get_xop(u32 inst)
0020 {
0021 return (inst >> 1) & 0x3ff;
0022 }
0023
0024 static inline unsigned int get_sprn(u32 inst)
0025 {
0026 return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
0027 }
0028
0029 static inline unsigned int get_dcrn(u32 inst)
0030 {
0031 return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
0032 }
0033
0034 static inline unsigned int get_tmrn(u32 inst)
0035 {
0036 return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
0037 }
0038
0039 static inline unsigned int get_rt(u32 inst)
0040 {
0041 return (inst >> 21) & 0x1f;
0042 }
0043
0044 static inline unsigned int get_rs(u32 inst)
0045 {
0046 return (inst >> 21) & 0x1f;
0047 }
0048
0049 static inline unsigned int get_ra(u32 inst)
0050 {
0051 return (inst >> 16) & 0x1f;
0052 }
0053
0054 static inline unsigned int get_rb(u32 inst)
0055 {
0056 return (inst >> 11) & 0x1f;
0057 }
0058
0059 static inline unsigned int get_rc(u32 inst)
0060 {
0061 return inst & 0x1;
0062 }
0063
0064 static inline unsigned int get_ws(u32 inst)
0065 {
0066 return (inst >> 11) & 0x1f;
0067 }
0068
0069 static inline unsigned int get_d(u32 inst)
0070 {
0071 return inst & 0xffff;
0072 }
0073
0074 static inline unsigned int get_oc(u32 inst)
0075 {
0076 return (inst >> 11) & 0x7fff;
0077 }
0078
0079 static inline unsigned int get_tx_or_sx(u32 inst)
0080 {
0081 return (inst) & 0x1;
0082 }
0083
0084 #define IS_XFORM(inst) (get_op(inst) == 31)
0085 #define IS_DSFORM(inst) (get_op(inst) >= 56)
0086
0087
0088
0089
0090 static inline unsigned make_dsisr(unsigned instr)
0091 {
0092 unsigned dsisr;
0093
0094
0095
0096 dsisr = (instr & 0x03ff0000) >> 16;
0097
0098 if (IS_XFORM(instr)) {
0099
0100 dsisr |= (instr & 0x00000006) << 14;
0101
0102 dsisr |= (instr & 0x00000040) << 8;
0103
0104 dsisr |= (instr & 0x00000780) << 3;
0105 } else {
0106
0107 dsisr |= (instr & 0x04000000) >> 12;
0108
0109 dsisr |= (instr & 0x78000000) >> 17;
0110
0111 if (IS_DSFORM(instr))
0112 dsisr |= (instr & 0x00000003) << 18;
0113 }
0114
0115 return dsisr;
0116 }
0117 #endif