]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/xen/interface/gcov.h
amd64: use register macros for gdb_cpu_getreg()
[FreeBSD/FreeBSD.git] / sys / xen / interface / gcov.h
1 /******************************************************************************
2  * gcov.h
3  *
4  * Coverage structures exported by Xen.
5  * Structure is different from Gcc one.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to
9  * deal in the Software without restriction, including without limitation the
10  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11  * sell copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in
15  * all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  *
25  * Copyright (c) 2013, Citrix Systems R&D Ltd.
26  */
27
28 #ifndef __XEN_PUBLIC_GCOV_H__
29 #define __XEN_PUBLIC_GCOV_H__ __XEN_PUBLIC_GCOV_H__
30
31 #define XENCOV_COUNTERS         5
32 #define XENCOV_TAG_BASE         0x58544300u
33 #define XENCOV_TAG_FILE         (XENCOV_TAG_BASE+0x46u)
34 #define XENCOV_TAG_FUNC         (XENCOV_TAG_BASE+0x66u)
35 #define XENCOV_TAG_COUNTER(n)   (XENCOV_TAG_BASE+0x30u+((n)&0xfu))
36 #define XENCOV_TAG_END          (XENCOV_TAG_BASE+0x2eu)
37 #define XENCOV_IS_TAG_COUNTER(n) \
38     ((n) >= XENCOV_TAG_COUNTER(0) && (n) < XENCOV_TAG_COUNTER(XENCOV_COUNTERS))
39 #define XENCOV_COUNTER_NUM(n) ((n)-XENCOV_TAG_COUNTER(0))
40
41 /*
42  * The main structure for the blob is
43  * BLOB := FILE.. END
44  * FILE := TAG_FILE VERSION STAMP FILENAME COUNTERS FUNCTIONS
45  * FILENAME := LEN characters
46  *   characters are padded to 32 bit
47  * LEN := 32 bit value
48  * COUNTERS := TAG_COUNTER(n) NUM COUNTER..
49  * NUM := 32 bit valie
50  * COUNTER := 64 bit value
51  * FUNCTIONS := TAG_FUNC NUM FUNCTION..
52  * FUNCTION := IDENT CHECKSUM NUM_COUNTERS
53  *
54  * All tagged structures are aligned to 8 bytes
55  */
56
57 /**
58  * File information
59  * Prefixed with XENCOV_TAG_FILE and a string with filename
60  * Aligned to 8 bytes
61  */
62 struct xencov_file
63 {
64     uint32_t tag; /* XENCOV_TAG_FILE */
65     uint32_t version;
66     uint32_t stamp;
67     uint32_t fn_len;
68     char filename[1];
69 };
70
71 /**
72  * Counters information
73  * Prefixed with XENCOV_TAG_COUNTER(n) where n is 0..(XENCOV_COUNTERS-1)
74  * Aligned to 8 bytes
75  */
76 struct xencov_counter
77 {
78     uint32_t tag; /* XENCOV_TAG_COUNTER(n) */
79     uint32_t num;
80     uint64_t values[1];
81 };
82
83 /**
84  * Information for each function
85  * Number of counter is equal to the number of counter structures got before
86  */
87 struct xencov_function
88 {
89     uint32_t ident;
90     uint32_t checksum;
91     uint32_t num_counters[1];
92 };
93
94 /**
95  * Information for all functions
96  * Aligned to 8 bytes
97  */
98 struct xencov_functions
99 {
100     uint32_t tag; /* XENCOV_TAG_FUNC */
101     uint32_t num;
102     struct xencov_function xencov_function[1];
103 };
104
105 /**
106  * Terminator
107  */
108 struct xencov_end
109 {
110     uint32_t tag; /* XENCOV_TAG_END */
111 };
112
113 #endif /* __XEN_PUBLIC_GCOV_H__ */