panwrap.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * © Copyright 2017 The BiOpenly Community
  3. *
  4. * This program is free software and is provided to you under the terms of the
  5. * GNU General Public License version 2 as published by the Free Software
  6. * Foundation, and any use by you of this program is subject to the terms
  7. * of such GNU license.
  8. *
  9. * A copy of the license is included with the program, and can also be obtained
  10. * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  11. * Boston, MA 02110-1301, USA.
  12. *
  13. */
  14. /*
  15. * Various bits and pieces of this borrowed from the freedreno project, which
  16. * borrowed from the lima project.
  17. */
  18. #ifndef __WRAP_H__
  19. #define __WRAP_H__
  20. #include <dlfcn.h>
  21. #include <panloader-util.h>
  22. struct panwrap_flag_info {
  23. u64 flag;
  24. const char *name;
  25. };
  26. #define PROLOG(func) \
  27. static typeof(func) *orig_##func = NULL; \
  28. if (!orig_##func) \
  29. orig_##func = __rd_dlsym_helper(#func); \
  30. void __attribute__((format (printf, 1, 2))) panwrap_log(const char *format, ...);
  31. void __attribute__((format (printf, 1, 2))) panwrap_log_cont(const char *format, ...);
  32. void panwrap_freeze_time();
  33. void panwrap_unfreeze_time();
  34. void panwrap_log_decoded_flags(const struct panwrap_flag_info *flag_info,
  35. u64 flags);
  36. void panwrap_log_hexdump(const void *data, size_t size, const char *indent);
  37. void panwrap_log_hexdump_trimmed(const void *data, size_t size, const char *ident);
  38. void * __rd_dlsym_helper(const char *name);
  39. #endif /* __WRAP_H__ */