2 * Copyright (c) 2013-2018, Intel Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12 * * Neither the name of Intel Corporation nor the names of its contributors
13 * may be used to endorse or promote products derived from this software
14 * without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
38 /* Keeping track of the last-ip in Intel PT packets. */
43 /* Flags governing the handling of IP updates and queries:
45 * - we have seen an IP update.
48 /* - the IP has been suppressed in the last update. */
49 uint32_t suppressed:1;
53 /* Initialize (or reset) the last-ip. */
54 extern void pt_last_ip_init(struct pt_last_ip *last_ip);
58 * If @ip is not NULL, provides the last-ip in @ip on success.
60 * Returns zero on success.
61 * Returns -pte_internal if @last_ip is NULL.
62 * Returns -pte_noip if there is no last-ip.
63 * Returns -pte_ip_suppressed if the last-ip has been suppressed.
65 extern int pt_last_ip_query(uint64_t *ip, const struct pt_last_ip *last_ip);
69 * Updates @last_ip based on @packet and, if non-null, @config.
71 * Returns zero on success.
72 * Returns -pte_internal if @last_ip or @packet is NULL.
73 * Returns -pte_bad_packet if @packet appears to be corrupted.
75 extern int pt_last_ip_update_ip(struct pt_last_ip *last_ip,
76 const struct pt_packet_ip *packet,
77 const struct pt_config *config);
79 #endif /* PT_LAST_IP_H */