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