Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/kcov.h
- This file was added.
/*- | |||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD | |||||
* | |||||
* Copyright (C) 2018 The FreeBSD Foundation. All rights reserved. | |||||
* | |||||
* This software was developed by Mitchell Horne under sponsorship of | |||||
* the FreeBSD Foundation. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in the | |||||
* documentation and/or other materials provided with the distribution. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* | |||||
* $FreeBSD$ | |||||
*/ | |||||
#ifndef _SYS_KCOV_H_ | |||||
#define _SYS_KCOV_H_ | |||||
#include <sys/ioccom.h> | |||||
#define KCOV_MAXENTRIES (1 << 24) /* 16M */ | |||||
tuexen: Isn't it better to call it `KCOV_MAXSIZE`, since you use it as the size of the buffer, not the… | |||||
Done Inline ActionsUserspace now works in terms of entries when allocating the buffer. I can add KCOV_ENTRIY_SIZE if we think it's useful. andrew: Userspace now works in terms of entries when allocating the buffer. I can add… | |||||
Not Done Inline ActionsI think it would be useful. Please add it... tuexen: I think it would be useful. Please add it... | |||||
#define KCOV_MODE_TRACE_PC 0 | |||||
#define KCOV_MODE_TRACE_CMP 1 | |||||
/* KCOV ioctls */ | |||||
#define KIOENABLE _IOWINT('c', 2) /* Enable coverage recording */ | |||||
#define KIODISABLE _IO('c', 3) /* Disable coverage recording */ | |||||
Not Done Inline ActionsShouldn't it be KCOV_ENTRY_SIZE instead of KCOV_ENTRIY_SIZE? Would it make sense to use sizeof(uint64_t) instead of 8? tuexen: Shouldn't it be `KCOV_ENTRY_SIZE` instead of `KCOV_ENTRIY_SIZE`?
Would it make sense to use… | |||||
#define KIOSETBUFSIZE _IOWINT('c', 4) /* Set the buffer size */ | |||||
#define KCOV_CMP_CONST (1 << 0) | |||||
#define KCOV_CMP_SIZE(x) ((x) << 1) | |||||
#define KCOV_CMP_MASK (3 << 1) | |||||
#define KCOV_CMP_GET_SIZE(x) (((x) >> 1) & 3) | |||||
#endif /* _SYS_KCOV_H_ */ |
Isn't it better to call it KCOV_MAXSIZE, since you use it as the size of the buffer, not the number of entries. Linux uses there a number of entries, so it might be good to be very clear in the name.