dis.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Disassemble s390 instructions.
  3. *
  4. * Copyright IBM Corp. 2007
  5. * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
  6. */
  7. #ifndef __ASM_S390_DIS_H__
  8. #define __ASM_S390_DIS_H__
  9. /* Type of operand */
  10. #define OPERAND_GPR 0x1 /* Operand printed as %rx */
  11. #define OPERAND_FPR 0x2 /* Operand printed as %fx */
  12. #define OPERAND_AR 0x4 /* Operand printed as %ax */
  13. #define OPERAND_CR 0x8 /* Operand printed as %cx */
  14. #define OPERAND_VR 0x10 /* Operand printed as %vx */
  15. #define OPERAND_DISP 0x20 /* Operand printed as displacement */
  16. #define OPERAND_BASE 0x40 /* Operand printed as base register */
  17. #define OPERAND_INDEX 0x80 /* Operand printed as index register */
  18. #define OPERAND_PCREL 0x100 /* Operand printed as pc-relative symbol */
  19. #define OPERAND_SIGNED 0x200 /* Operand printed as signed value */
  20. #define OPERAND_LENGTH 0x400 /* Operand printed as length (+1) */
  21. struct s390_operand {
  22. int bits; /* The number of bits in the operand. */
  23. int shift; /* The number of bits to shift. */
  24. int flags; /* One bit syntax flags. */
  25. };
  26. struct s390_insn {
  27. const char name[5];
  28. unsigned char opfrag;
  29. unsigned char format;
  30. };
  31. static inline int insn_length(unsigned char code)
  32. {
  33. return ((((int) code + 64) >> 7) + 1) << 1;
  34. }
  35. void show_code(struct pt_regs *regs);
  36. void print_fn_code(unsigned char *code, unsigned long len);
  37. int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len);
  38. struct s390_insn *find_insn(unsigned char *code);
  39. static inline int is_known_insn(unsigned char *code)
  40. {
  41. return !!find_insn(code);
  42. }
  43. #endif /* __ASM_S390_DIS_H__ */