Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cacheflush.c 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (c) 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
  3. * Copyright (c) 2010 Mike Frysinger <vapier@gentoo.org>
  4. * Copyright (c) 2010 Carmelo Amoroso <carmelo.amoroso@st.com>
  5. * Copyright (c) 2015 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
  6. * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
  7. * Copyright (c) 2014-2019 The strace developers.
  8. * All rights reserved.
  9. *
  10. * SPDX-License-Identifier: LGPL-2.1-or-later
  11. */
  12. #include "defs.h"
  13. #ifdef HAVE_ASM_CACHECTL_H
  14. # include <asm/cachectl.h>
  15. #endif
  16. #ifdef M68K
  17. # include "xlat/cacheflush_scope.h"
  18. static const struct xlat cacheflush_flags[] = {
  19. # ifdef FLUSH_CACHE_BOTH
  20. XLAT(FLUSH_CACHE_BOTH),
  21. # endif
  22. # ifdef FLUSH_CACHE_DATA
  23. XLAT(FLUSH_CACHE_DATA),
  24. # endif
  25. # ifdef FLUSH_CACHE_INSN
  26. XLAT(FLUSH_CACHE_INSN),
  27. # endif
  28. XLAT_END
  29. };
  30. SYS_FUNC(cacheflush)
  31. {
  32. /* addr */
  33. printaddr(tcp->u_arg[0]);
  34. tprints(", ");
  35. /* scope */
  36. printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
  37. tprints(", ");
  38. /* flags */
  39. printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
  40. /* len */
  41. tprintf(", %lu", tcp->u_arg[3]);
  42. return RVAL_DECODED;
  43. }
  44. #endif /* M68K */
  45. #if defined(BFIN) || defined(CSKY)
  46. static const struct xlat cacheflush_flags[] = {
  47. XLAT(ICACHE),
  48. XLAT(DCACHE),
  49. XLAT(BCACHE),
  50. XLAT_END
  51. };
  52. SYS_FUNC(cacheflush)
  53. {
  54. /* start addr */
  55. printaddr(tcp->u_arg[0]);
  56. /* length */
  57. tprintf(", %lu, ", tcp->u_arg[1]);
  58. /* flags */
  59. printxval(cacheflush_flags, tcp->u_arg[2], "?CACHE");
  60. return RVAL_DECODED;
  61. }
  62. #endif /* BFIN || CSKY */
  63. #ifdef SH
  64. static const struct xlat cacheflush_flags[] = {
  65. # ifdef CACHEFLUSH_D_INVAL
  66. XLAT(CACHEFLUSH_D_INVAL),
  67. # endif
  68. # ifdef CACHEFLUSH_D_WB
  69. XLAT(CACHEFLUSH_D_WB),
  70. # endif
  71. # ifdef CACHEFLUSH_D_PURGE
  72. XLAT(CACHEFLUSH_D_PURGE),
  73. # endif
  74. # ifdef CACHEFLUSH_I
  75. XLAT(CACHEFLUSH_I),
  76. # endif
  77. XLAT_END
  78. };
  79. SYS_FUNC(cacheflush)
  80. {
  81. /* addr */
  82. printaddr(tcp->u_arg[0]);
  83. /* len */
  84. tprintf(", %lu, ", tcp->u_arg[1]);
  85. /* flags */
  86. printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???");
  87. return RVAL_DECODED;
  88. }
  89. #endif /* SH */
  90. #ifdef NIOS2
  91. SYS_FUNC(cacheflush)
  92. {
  93. /* addr */
  94. printaddr(tcp->u_arg[0]);
  95. /* len */
  96. tprintf(", %lu, ", tcp->u_arg[3]);
  97. /* scope and flags (cache type) are currently ignored */
  98. return RVAL_DECODED;
  99. }
  100. #endif /* NIOS2 */