blob: f9fc5829c5166f27e216aa0af27083f05f3711ab [file] [log] [blame]
Dmitry V. Levin38a34c92015-12-17 17:56:48 +00001/*
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>
Elliott Hughes39bac052017-05-25 16:56:11 -07007 * Copyright (c) 2014-2017 The strace developers.
Dmitry V. Levin38a34c92015-12-17 17:56:48 +00008 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +000033#include "defs.h"
34
35#ifdef HAVE_ASM_CACHECTL_H
36# include <asm/cachectl.h>
37#endif
38
39#ifdef M68K
40# include "xlat/cacheflush_scope.h"
41
42static const struct xlat cacheflush_flags[] = {
43#ifdef FLUSH_CACHE_BOTH
44 XLAT(FLUSH_CACHE_BOTH),
45#endif
46#ifdef FLUSH_CACHE_DATA
47 XLAT(FLUSH_CACHE_DATA),
48#endif
49#ifdef FLUSH_CACHE_INSN
50 XLAT(FLUSH_CACHE_INSN),
51#endif
52 XLAT_END
53};
54
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000055SYS_FUNC(cacheflush)
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +000056{
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +000057 /* addr */
58 printaddr(tcp->u_arg[0]);
59 tprints(", ");
60 /* scope */
61 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
62 tprints(", ");
63 /* flags */
64 printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
65 /* len */
66 tprintf(", %lu", tcp->u_arg[3]);
67
68 return RVAL_DECODED;
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +000069}
70#endif /* M68K */
71
72#ifdef BFIN
73static const struct xlat cacheflush_flags[] = {
74 XLAT(ICACHE),
75 XLAT(DCACHE),
76 XLAT(BCACHE),
77 XLAT_END
78};
79
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000080SYS_FUNC(cacheflush)
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +000081{
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +000082 /* start addr */
83 printaddr(tcp->u_arg[0]);
84 /* length */
Dmitry V. Levin2eb56d12016-05-16 21:31:54 +000085 tprintf(", %lu, ", tcp->u_arg[1]);
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +000086 /* flags */
Dmitry V. Levin2eb56d12016-05-16 21:31:54 +000087 printxval(cacheflush_flags, tcp->u_arg[2], "?CACHE");
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +000088
89 return RVAL_DECODED;
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +000090}
91#endif /* BFIN */
92
93#ifdef SH
94static const struct xlat cacheflush_flags[] = {
95#ifdef CACHEFLUSH_D_INVAL
96 XLAT(CACHEFLUSH_D_INVAL),
97#endif
98#ifdef CACHEFLUSH_D_WB
99 XLAT(CACHEFLUSH_D_WB),
100#endif
101#ifdef CACHEFLUSH_D_PURGE
102 XLAT(CACHEFLUSH_D_PURGE),
103#endif
104#ifdef CACHEFLUSH_I
105 XLAT(CACHEFLUSH_I),
106#endif
107 XLAT_END
108};
109
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000110SYS_FUNC(cacheflush)
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +0000111{
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +0000112 /* addr */
113 printaddr(tcp->u_arg[0]);
114 /* len */
115 tprintf(", %lu, ", tcp->u_arg[1]);
116 /* flags */
117 printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???");
118
119 return RVAL_DECODED;
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +0000120}
121#endif /* SH */
Ezequiel Garciabd8dd772015-04-18 17:33:27 -0300122
123#ifdef NIOS2
124SYS_FUNC(cacheflush)
125{
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +0000126 /* addr */
127 printaddr(tcp->u_arg[0]);
128 /* len */
129 tprintf(", %lu, ", tcp->u_arg[3]);
130 /* scope and flags (cache type) are currently ignored */
131
132 return RVAL_DECODED;
Ezequiel Garciabd8dd772015-04-18 17:33:27 -0300133}
134#endif /* NIOS2 */