disassemble.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #ifndef __ASM_PPC_DISASSEMBLE_H__
  20. #define __ASM_PPC_DISASSEMBLE_H__
  21. #include <linux/types.h>
  22. static inline unsigned int get_op(u32 inst)
  23. {
  24. return inst >> 26;
  25. }
  26. static inline unsigned int get_xop(u32 inst)
  27. {
  28. return (inst >> 1) & 0x3ff;
  29. }
  30. static inline unsigned int get_sprn(u32 inst)
  31. {
  32. return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
  33. }
  34. static inline unsigned int get_dcrn(u32 inst)
  35. {
  36. return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
  37. }
  38. static inline unsigned int get_rt(u32 inst)
  39. {
  40. return (inst >> 21) & 0x1f;
  41. }
  42. static inline unsigned int get_rs(u32 inst)
  43. {
  44. return (inst >> 21) & 0x1f;
  45. }
  46. static inline unsigned int get_ra(u32 inst)
  47. {
  48. return (inst >> 16) & 0x1f;
  49. }
  50. static inline unsigned int get_rb(u32 inst)
  51. {
  52. return (inst >> 11) & 0x1f;
  53. }
  54. static inline unsigned int get_rc(u32 inst)
  55. {
  56. return inst & 0x1;
  57. }
  58. static inline unsigned int get_ws(u32 inst)
  59. {
  60. return (inst >> 11) & 0x1f;
  61. }
  62. static inline unsigned int get_d(u32 inst)
  63. {
  64. return inst & 0xffff;
  65. }
  66. #endif /* __ASM_PPC_DISASSEMBLE_H__ */