ptdump.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2014 ARM Ltd.
  4. */
  5. #ifndef __ASM_PTDUMP_H
  6. #define __ASM_PTDUMP_H
  7. #include <linux/ptdump.h>
  8. #ifdef CONFIG_PTDUMP_CORE
  9. #include <linux/mm_types.h>
  10. #include <linux/seq_file.h>
  11. struct addr_marker {
  12. unsigned long start_address;
  13. char *name;
  14. };
  15. struct ptdump_info {
  16. struct mm_struct *mm;
  17. const struct addr_marker *markers;
  18. unsigned long base_addr;
  19. };
  20. struct ptdump_prot_bits {
  21. u64 mask;
  22. u64 val;
  23. const char *set;
  24. const char *clear;
  25. };
  26. struct ptdump_pg_level {
  27. const struct ptdump_prot_bits *bits;
  28. char name[4];
  29. int num;
  30. u64 mask;
  31. };
  32. /*
  33. * The page dumper groups page table entries of the same type into a single
  34. * description. It uses pg_state to track the range information while
  35. * iterating over the pte entries. When the continuity is broken it then
  36. * dumps out a description of the range.
  37. */
  38. struct ptdump_pg_state {
  39. struct ptdump_state ptdump;
  40. struct ptdump_pg_level *pg_level;
  41. struct seq_file *seq;
  42. const struct addr_marker *marker;
  43. const struct mm_struct *mm;
  44. unsigned long start_address;
  45. int level;
  46. u64 current_prot;
  47. bool check_wx;
  48. unsigned long wx_pages;
  49. unsigned long uxn_pages;
  50. };
  51. void ptdump_walk(struct seq_file *s, struct ptdump_info *info);
  52. void note_page(struct ptdump_state *pt_st, unsigned long addr, int level,
  53. u64 val);
  54. #ifdef CONFIG_PTDUMP_DEBUGFS
  55. #define EFI_RUNTIME_MAP_END DEFAULT_MAP_WINDOW_64
  56. void __init ptdump_debugfs_register(struct ptdump_info *info, const char *name);
  57. #else
  58. static inline void ptdump_debugfs_register(struct ptdump_info *info,
  59. const char *name) { }
  60. #endif /* CONFIG_PTDUMP_DEBUGFS */
  61. #else
  62. static inline void note_page(struct ptdump_state *pt_st, unsigned long addr,
  63. int level, u64 val) { }
  64. #endif /* CONFIG_PTDUMP_CORE */
  65. #endif /* __ASM_PTDUMP_H */