Dmitry V. Levin | 38a34c9 | 2015-12-17 17:56:48 +0000 | [diff] [blame] | 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> |
Elliott Hughes | 39bac05 | 2017-05-25 16:56:11 -0700 | [diff] [blame] | 7 | * Copyright (c) 2014-2017 The strace developers. |
Dmitry V. Levin | 38a34c9 | 2015-12-17 17:56:48 +0000 | [diff] [blame] | 8 | * 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. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 33 | #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 | |
| 42 | static 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. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 55 | SYS_FUNC(cacheflush) |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 56 | { |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 57 | /* 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. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 69 | } |
| 70 | #endif /* M68K */ |
| 71 | |
| 72 | #ifdef BFIN |
| 73 | static const struct xlat cacheflush_flags[] = { |
| 74 | XLAT(ICACHE), |
| 75 | XLAT(DCACHE), |
| 76 | XLAT(BCACHE), |
| 77 | XLAT_END |
| 78 | }; |
| 79 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 80 | SYS_FUNC(cacheflush) |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 81 | { |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 82 | /* start addr */ |
| 83 | printaddr(tcp->u_arg[0]); |
| 84 | /* length */ |
Dmitry V. Levin | 2eb56d1 | 2016-05-16 21:31:54 +0000 | [diff] [blame] | 85 | tprintf(", %lu, ", tcp->u_arg[1]); |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 86 | /* flags */ |
Dmitry V. Levin | 2eb56d1 | 2016-05-16 21:31:54 +0000 | [diff] [blame] | 87 | printxval(cacheflush_flags, tcp->u_arg[2], "?CACHE"); |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 88 | |
| 89 | return RVAL_DECODED; |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 90 | } |
| 91 | #endif /* BFIN */ |
| 92 | |
| 93 | #ifdef SH |
| 94 | static 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. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 110 | SYS_FUNC(cacheflush) |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 111 | { |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 112 | /* 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. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 120 | } |
| 121 | #endif /* SH */ |
Ezequiel Garcia | bd8dd77 | 2015-04-18 17:33:27 -0300 | [diff] [blame] | 122 | |
| 123 | #ifdef NIOS2 |
| 124 | SYS_FUNC(cacheflush) |
| 125 | { |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 126 | /* 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 Garcia | bd8dd77 | 2015-04-18 17:33:27 -0300 | [diff] [blame] | 133 | } |
| 134 | #endif /* NIOS2 */ |