From bd27e675d33d829fdb89a8604e0aba6f9f38ab79 Mon Sep 17 00:00:00 2001 From: Aleksandar Markovic Date: Thu, 16 Jan 2020 23:49:50 +0100 Subject: [PATCH] linux-user: Add support for KCOV_ ioctls 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 Signed-off-by: Aleksandar Markovic Message-Id: <1579214991-19602-12-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier --- 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 29969e2f2f..6220dd8cf7 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -534,3 +534,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 249e4b95fc..c5bda60b45 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -73,6 +73,9 @@ #ifdef CONFIG_SENDFILE #include #endif +#ifdef CONFIG_KCOV +#include +#endif #define termios host_termios #define winsize host_winsize diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index b3acf85a6b..7b0b60d253 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2434,6 +2434,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 */