Home | History | Annotate | Download | only in strace
      1 /*
      2  * Copyright (c) 1999 Andreas Schwab <schwab (at) issan.cs.uni-dortmund.de>
      3  * Copyright (c) 2010 Mike Frysinger <vapier (at) gentoo.org>
      4  * Copyright (c) 2010 Carmelo Amoroso <carmelo.amoroso (at) st.com>
      5  * Copyright (c) 2015 Ezequiel Garcia <ezequiel (at) vanguardiasur.com.ar>
      6  * Copyright (c) 2014-2015 Dmitry V. Levin <ldv (at) altlinux.org>
      7  * Copyright (c) 2014-2017 The strace developers.
      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 
     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 
     55 SYS_FUNC(cacheflush)
     56 {
     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;
     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 
     80 SYS_FUNC(cacheflush)
     81 {
     82 	/* start addr */
     83 	printaddr(tcp->u_arg[0]);
     84 	/* length */
     85 	tprintf(", %lu, ", tcp->u_arg[1]);
     86 	/* flags */
     87 	printxval(cacheflush_flags, tcp->u_arg[2], "?CACHE");
     88 
     89 	return RVAL_DECODED;
     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 
    110 SYS_FUNC(cacheflush)
    111 {
    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;
    120 }
    121 #endif /* SH */
    122 
    123 #ifdef NIOS2
    124 SYS_FUNC(cacheflush)
    125 {
    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;
    133 }
    134 #endif /* NIOS2 */
    135