From: Carmelo AMOROSO Date: Wed, 1 Dec 2010 13:27:07 +0000 (+0100) Subject: sh: Add support for tracing sys_cacheflush system call X-Git-Tag: v4.6~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8e56504749a4a5a79d40d115ae46718b4c949a4;p=strace sh: Add support for tracing sys_cacheflush system call * linux/sh/syscallent.h: Update sys_cacheflush entry. * linux/syscall.h [SH] (sys_cacheflush): New function declaration. * system.c [SH] (cacheflush_flags): New xlat structure. [SH] (sys_cacheflush): New function. Signed-off-by: Carmelo Amoroso Reviewed-by: Angelo Castello --- diff --git a/linux/sh/syscallent.h b/linux/sh/syscallent.h index 2291131a..f3b59db6 100644 --- a/linux/sh/syscallent.h +++ b/linux/sh/syscallent.h @@ -153,7 +153,7 @@ { 5, TP, sys_clone, "clone" }, /* 120 */ { 2, 0, sys_setdomainname, "setdomainname" }, /* 121 */ { 1, 0, sys_uname, "uname" }, /* 122 */ - { 3, 0, printargs, "cacheflush" }, /* 123 */ + { 3, 0, sys_cacheflush, "cacheflush" }, /* 123 */ { 1, 0, sys_adjtimex, "adjtimex" }, /* 124 */ { 3, 0, sys_mprotect, "mprotect" }, /* 125 */ { 3, TS, sys_sigprocmask, "sigprocmask" }, /* 126 */ diff --git a/linux/syscall.h b/linux/syscall.h index 679697fb..e7348ff4 100644 --- a/linux/syscall.h +++ b/linux/syscall.h @@ -322,7 +322,7 @@ int sys_sysmips(); int sys_setpgrp(), sys_gethostname(), sys_getdtablesize(), sys_utimes(); int sys_capget(), sys_capset(); -#ifdef M68K +#if defined M68K || defined SH int sys_cacheflush(); #endif diff --git a/system.c b/system.c index e16a6be4..f0641c30 100644 --- a/system.c +++ b/system.c @@ -343,6 +343,38 @@ sys_cacheflush(struct tcb *tcp) #endif +#ifdef SH +static const struct xlat cacheflush_flags[] = { +#ifdef CACHEFLUSH_D_INVAL + { CACHEFLUSH_D_INVAL, "CACHEFLUSH_D_INVAL" }, +#endif +#ifdef CACHEFLUSH_D_WB + { CACHEFLUSH_D_WB, "CACHEFLUSH_D_WB" }, +#endif +#ifdef CACHEFLUSH_D_PURGE + { CACHEFLUSH_D_PURGE, "CACHEFLUSH_D_PURGE" }, +#endif +#ifdef CACHEFLUSH_I + { CACHEFLUSH_I, "CACHEFLUSH_I" }, +#endif + { 0, NULL }, +}; + +int +sys_cacheflush(struct tcb *tcp) +{ + if (entering(tcp)) { + /* addr */ + tprintf("%#lx, ", tcp->u_arg[0]); + /* len */ + tprintf("%lu, ", tcp->u_arg[1]); + /* flags */ + printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???"); + } + return 0; +} +#endif /* SH */ + #endif /* LINUX */ #ifdef SUNOS4