1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License, version 2, as
4  * published by the Free Software Foundation.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software
13  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
14  *
15  * Copyright IBM Corp. 2008
16  *
17  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18  */
19 
20 #ifndef __ASM_PPC_DISASSEMBLE_H__
21 #define __ASM_PPC_DISASSEMBLE_H__
22 
23 #include <linux/types.h>
24 
get_op(u32 inst)25 static inline unsigned int get_op(u32 inst)
26 {
27 	return inst >> 26;
28 }
29 
get_xop(u32 inst)30 static inline unsigned int get_xop(u32 inst)
31 {
32 	return (inst >> 1) & 0x3ff;
33 }
34 
get_sprn(u32 inst)35 static inline unsigned int get_sprn(u32 inst)
36 {
37 	return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
38 }
39 
get_dcrn(u32 inst)40 static inline unsigned int get_dcrn(u32 inst)
41 {
42 	return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
43 }
44 
get_rt(u32 inst)45 static inline unsigned int get_rt(u32 inst)
46 {
47 	return (inst >> 21) & 0x1f;
48 }
49 
get_rs(u32 inst)50 static inline unsigned int get_rs(u32 inst)
51 {
52 	return (inst >> 21) & 0x1f;
53 }
54 
get_ra(u32 inst)55 static inline unsigned int get_ra(u32 inst)
56 {
57 	return (inst >> 16) & 0x1f;
58 }
59 
get_rb(u32 inst)60 static inline unsigned int get_rb(u32 inst)
61 {
62 	return (inst >> 11) & 0x1f;
63 }
64 
get_rc(u32 inst)65 static inline unsigned int get_rc(u32 inst)
66 {
67 	return inst & 0x1;
68 }
69 
get_ws(u32 inst)70 static inline unsigned int get_ws(u32 inst)
71 {
72 	return (inst >> 11) & 0x1f;
73 }
74 
get_d(u32 inst)75 static inline unsigned int get_d(u32 inst)
76 {
77 	return inst & 0xffff;
78 }
79 
80 #endif /* __ASM_PPC_DISASSEMBLE_H__ */
81