1/* $OpenBSD: kcov.h,v 1.9 2023/07/29 06:52:08 anton Exp $ */
2
3/*
4 * Copyright (c) 2018 Anton Lindqvist <anton@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef _SYS_KCOV_H_
20#define _SYS_KCOV_H_
21
22#include <sys/ioccom.h>
23
24#define KIOSETBUFSIZE _IOW('K', 1, unsigned long)
25#define KIOENABLE _IOW('K', 2, int)
26#define KIODISABLE _IO('K', 3)
27#define KIOREMOTEATTACH _IOW('K', 4, struct kio_remote_attach *)
28
29#define KCOV_MODE_NONE 0
30#define KCOV_MODE_TRACE_PC 1
31#define KCOV_MODE_TRACE_CMP 2
32
33#define KCOV_REMOTE_COMMON 0
34
35struct kio_remote_attach {
36 int subsystem;
37 int id;
38};
39
40#ifdef _KERNEL
41
42struct proc;
43
44extern int kcov_cold;
45
46void kcov_exit(struct proc *);
47int kcov_vnode(struct vnode *);
48void kcov_remote_register(int, void *);
49void kcov_remote_unregister(int, void *);
50void kcov_remote_enter(int, void *);
51void kcov_remote_leave(int, void *);
52
53#endif /* _KERNEL */
54
55#endif /* !_SYS_KCOV_H_ */