[11/12] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls
diff mbox series

Message ID 1579214991-19602-12-git-send-email-aleksandar.markovic@rt-rk.com
State New
Headers show
Series
  • linux-user: Add support for fs, fd,and kcov ioctls
Related show

Commit Message

Aleksandar Markovic Jan. 16, 2020, 10:49 p.m. UTC
From: Aleksandar Markovic <amarkovic@wavecomp.com>

KCOV_ENABLE and KCOV_DISABLE play the role in kernel coverage
tracing. These ioctls do not use the third argument of ioctl()
system call and are straightforward to implement in QEMU.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 5 +++++
 linux-user/syscall.c      | 3 +++
 linux-user/syscall_defs.h | 4 ++++
 3 files changed, 12 insertions(+)

Comments

Laurent Vivier Jan. 22, 2020, 2:16 p.m. UTC | #1
Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> KCOV_ENABLE and KCOV_DISABLE play the role in kernel coverage
> tracing. These ioctls do not use the third argument of ioctl()
> system call and are straightforward to implement in QEMU.
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 5 +++++
>  linux-user/syscall.c      | 3 +++
>  linux-user/syscall_defs.h | 4 ++++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index d72cd76..39b3825 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -552,3 +552,8 @@
>    IOCTL_IGNORE(TIOCSTART)
>    IOCTL_IGNORE(TIOCSTOP)
>  #endif
> +
> +#ifdef CONFIG_KCOV
> +  IOCTL(KCOV_ENABLE, 0, TYPE_NULL)
> +  IOCTL(KCOV_DISABLE, 0, TYPE_NULL)
> +#endif
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 171c0ca..6edcb0d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -73,6 +73,9 @@
>  #ifdef CONFIG_SENDFILE
>  #include <sys/sendfile.h>
>  #endif
> +#ifdef CONFIG_KCOV
> +#include <sys/kcov.h>
> +#endif
>  
>  #define termios host_termios
>  #define winsize host_winsize
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 46dc565..c8999ef 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2461,6 +2461,10 @@ struct target_mtpos {
>  #define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct target_mtget)
>  #define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct target_mtpos)
>  
> +/* kcov ioctls */
> +#define TARGET_KCOV_ENABLE     TARGET_IO('c', 100)
> +#define TARGET_KCOV_DISABLE    TARGET_IO('c', 101)
> +
>  struct target_sysinfo {
>      abi_long uptime;                /* Seconds since boot */
>      abi_ulong loads[3];             /* 1, 5, and 15 minute load averages */
> 

Applied to my linux-user branch.

Thanks,
Laurent

Patch
diff mbox series

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index d72cd76..39b3825 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -552,3 +552,8 @@ 
   IOCTL_IGNORE(TIOCSTART)
   IOCTL_IGNORE(TIOCSTOP)
 #endif
+
+#ifdef CONFIG_KCOV
+  IOCTL(KCOV_ENABLE, 0, TYPE_NULL)
+  IOCTL(KCOV_DISABLE, 0, TYPE_NULL)
+#endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 171c0ca..6edcb0d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -73,6 +73,9 @@ 
 #ifdef CONFIG_SENDFILE
 #include <sys/sendfile.h>
 #endif
+#ifdef CONFIG_KCOV
+#include <sys/kcov.h>
+#endif
 
 #define termios host_termios
 #define winsize host_winsize
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 46dc565..c8999ef 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2461,6 +2461,10 @@  struct target_mtpos {
 #define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct target_mtget)
 #define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct target_mtpos)
 
+/* kcov ioctls */
+#define TARGET_KCOV_ENABLE     TARGET_IO('c', 100)
+#define TARGET_KCOV_DISABLE    TARGET_IO('c', 101)
+
 struct target_sysinfo {
     abi_long uptime;                /* Seconds since boot */
     abi_ulong loads[3];             /* 1, 5, and 15 minute load averages */