1524553f5SAndrew Turner /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3524553f5SAndrew Turner * 4524553f5SAndrew Turner * Copyright (C) 2018 The FreeBSD Foundation. All rights reserved. 5524553f5SAndrew Turner * Copyright (C) 2018, 2019 Andrew Turner. 6524553f5SAndrew Turner * 7524553f5SAndrew Turner * This software was developed by Mitchell Horne under sponsorship of 8524553f5SAndrew Turner * the FreeBSD Foundation. 9524553f5SAndrew Turner * 10524553f5SAndrew Turner * This software was developed by SRI International and the University of 11524553f5SAndrew Turner * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 12524553f5SAndrew Turner * ("CTSRD"), as part of the DARPA CRASH research programme. 13524553f5SAndrew Turner * 14524553f5SAndrew Turner * Redistribution and use in source and binary forms, with or without 15524553f5SAndrew Turner * modification, are permitted provided that the following conditions 16524553f5SAndrew Turner * are met: 17524553f5SAndrew Turner * 1. Redistributions of source code must retain the above copyright 18524553f5SAndrew Turner * notice, this list of conditions and the following disclaimer. 19524553f5SAndrew Turner * 2. Redistributions in binary form must reproduce the above copyright 20524553f5SAndrew Turner * notice, this list of conditions and the following disclaimer in the 21524553f5SAndrew Turner * documentation and/or other materials provided with the distribution. 22524553f5SAndrew Turner * 23524553f5SAndrew Turner * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 24524553f5SAndrew Turner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25524553f5SAndrew Turner * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26524553f5SAndrew Turner * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 27524553f5SAndrew Turner * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28524553f5SAndrew Turner * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29524553f5SAndrew Turner * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30524553f5SAndrew Turner * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31524553f5SAndrew Turner * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32524553f5SAndrew Turner * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33524553f5SAndrew Turner * SUCH DAMAGE. 34524553f5SAndrew Turner */ 35524553f5SAndrew Turner 36524553f5SAndrew Turner #ifndef _SYS_COVERAGE_H_ 37524553f5SAndrew Turner #define _SYS_COVERAGE_H_ 38524553f5SAndrew Turner 39524553f5SAndrew Turner #if !defined(_KERNEL) && !defined(_SYS_KCOV_H_) 40524553f5SAndrew Turner #error Do not include this file directly in userspace, use sys/kcov.h 41524553f5SAndrew Turner #endif 42524553f5SAndrew Turner 43524553f5SAndrew Turner #define COV_CMP_CONST (1 << 0) 44524553f5SAndrew Turner #define COV_CMP_SIZE(x) ((x) << 1) 45524553f5SAndrew Turner #define COV_CMP_MASK (3 << 1) 46524553f5SAndrew Turner #define COV_CMP_GET_SIZE(x) (((x) >> 1) & 3) 47524553f5SAndrew Turner 48524553f5SAndrew Turner #ifdef _KERNEL 49524553f5SAndrew Turner typedef void (*cov_trace_pc_t)(uintptr_t); 50524553f5SAndrew Turner typedef bool (*cov_trace_cmp_t)(uint64_t, uint64_t, uint64_t, uint64_t); 51524553f5SAndrew Turner 52524553f5SAndrew Turner void cov_register_cmp(cov_trace_cmp_t); 53524553f5SAndrew Turner void cov_unregister_cmp(void); 54524553f5SAndrew Turner void cov_register_pc(cov_trace_pc_t); 55524553f5SAndrew Turner void cov_unregister_pc(void); 56524553f5SAndrew Turner #endif 57524553f5SAndrew Turner 58524553f5SAndrew Turner #endif /* _SYS_COVERAGE_H_ */ 59