linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls
authorAleksandar Markovic <amarkovic@wavecomp.com>
Thu, 16 Jan 2020 22:49:50 +0000 (23:49 +0100)
committerLaurent Vivier <laurent@vivier.eu>
Wed, 22 Jan 2020 14:15:18 +0000 (15:15 +0100)
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>
Message-Id: <1579214991-19602-12-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/ioctls.h
linux-user/syscall.c
linux-user/syscall_defs.h

index 29969e2f2f27f9e294b619b4ed44f901aa299f23..6220dd8cf791a1524d844e71ab5110b624541cde 100644 (file)
   IOCTL_IGNORE(TIOCSTART)
   IOCTL_IGNORE(TIOCSTOP)
 #endif
+
+#ifdef CONFIG_KCOV
+  IOCTL(KCOV_ENABLE, 0, TYPE_NULL)
+  IOCTL(KCOV_DISABLE, 0, TYPE_NULL)
+#endif
index 249e4b95fc9f0a24f0164a8302e1f212ee802f43..c5bda60b45dee4c76c3de9989aa3a808d6204998 100644 (file)
@@ -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
index b3acf85a6b23a64aa98c77b7b0e54dc1633baf56..7b0b60d253d9a5a527ceae89a366636cf374ba3f 100644 (file)
@@ -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 */