xref: /linux/include/uapi/linux/kcov.h (revision ded97d2c2b2c5f1dcced0bc57133f7753b037dfc)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
25c9a8750SDmitry Vyukov #ifndef _LINUX_KCOV_IOCTLS_H
35c9a8750SDmitry Vyukov #define _LINUX_KCOV_IOCTLS_H
45c9a8750SDmitry Vyukov 
55c9a8750SDmitry Vyukov #include <linux/types.h>
65c9a8750SDmitry Vyukov 
75c9a8750SDmitry Vyukov #define KCOV_INIT_TRACE			_IOR('c', 1, unsigned long)
85c9a8750SDmitry Vyukov #define KCOV_ENABLE			_IO('c', 100)
95c9a8750SDmitry Vyukov #define KCOV_DISABLE			_IO('c', 101)
105c9a8750SDmitry Vyukov 
11*ded97d2cSVictor Chibotaru enum {
12*ded97d2cSVictor Chibotaru 	/*
13*ded97d2cSVictor Chibotaru 	 * Tracing coverage collection mode.
14*ded97d2cSVictor Chibotaru 	 * Covered PCs are collected in a per-task buffer.
15*ded97d2cSVictor Chibotaru 	 * In new KCOV version the mode is chosen by calling
16*ded97d2cSVictor Chibotaru 	 * ioctl(fd, KCOV_ENABLE, mode). In older versions the mode argument
17*ded97d2cSVictor Chibotaru 	 * was supposed to be 0 in such a call. So, for reasons of backward
18*ded97d2cSVictor Chibotaru 	 * compatibility, we have chosen the value KCOV_TRACE_PC to be 0.
19*ded97d2cSVictor Chibotaru 	 */
20*ded97d2cSVictor Chibotaru 	KCOV_TRACE_PC = 0,
21*ded97d2cSVictor Chibotaru 	/* Collecting comparison operands mode. */
22*ded97d2cSVictor Chibotaru 	KCOV_TRACE_CMP = 1,
23*ded97d2cSVictor Chibotaru };
24*ded97d2cSVictor Chibotaru 
25*ded97d2cSVictor Chibotaru /*
26*ded97d2cSVictor Chibotaru  * The format for the types of collected comparisons.
27*ded97d2cSVictor Chibotaru  *
28*ded97d2cSVictor Chibotaru  * Bit 0 shows whether one of the arguments is a compile-time constant.
29*ded97d2cSVictor Chibotaru  * Bits 1 & 2 contain log2 of the argument size, up to 8 bytes.
30*ded97d2cSVictor Chibotaru  */
31*ded97d2cSVictor Chibotaru #define KCOV_CMP_CONST          (1 << 0)
32*ded97d2cSVictor Chibotaru #define KCOV_CMP_SIZE(n)        ((n) << 1)
33*ded97d2cSVictor Chibotaru #define KCOV_CMP_MASK           KCOV_CMP_SIZE(3)
34*ded97d2cSVictor Chibotaru 
355c9a8750SDmitry Vyukov #endif /* _LINUX_KCOV_IOCTLS_H */
36