xref: /netbsd-src/external/gpl3/binutils/dist/gprofng/src/ABS.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1 /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
2    Contributed by Oracle.
3 
4    This file is part of GNU Binutils.
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3, or (at your option)
9    any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, 51 Franklin Street - Fifth Floor, Boston,
19    MA 02110-1301, USA.  */
20 
21 #ifndef _ABS_H
22 #define _ABS_H
23 
24 /*
25  * Apropos Backtracking Scheme definitions.
26  * Class: com_sun_forte_st_mpmt_timeline_HWCEvent
27  */
28 
29 /* ABS failure codes */
30 typedef enum
31 {
32   ABS_NULL          = 0x00,     /* undefined/disabled/inactive */
33   ABS_UNSUPPORTED   = 0x01,     /* inappropriate HWC event type */
34   ABS_BLOCKED       = 0x02,     /* runtime backtrack blocker reached */
35   ABS_INCOMPLETE    = 0x03,     /* runtime backtrack limit reached */
36   ABS_REG_LOSS      = 0x04,     /* address register contaminated */
37   ABS_INVALID_EA    = 0x05,     /* invalid effective address value */
38   ABS_NO_CTI_INFO   = 0x10,     /* no AnalyzerInfo for validation */
39   ABS_INFO_FAILED   = 0x20,     /* info failed to validate backtrack */
40   ABS_CTI_TARGET    = 0x30,     /* CTI target invalidated backtrack */
41   ABS_CODE_RANGE    = 0xFF      /* reserved ABS code range in Vaddr */
42 } ABS_code;
43 
44 enum {
45   NUM_ABS_RT_CODES = 7,
46   NUM_ABS_PP_CODES = 5
47 };
48 
49 extern const char *ABS_RT_CODES[NUM_ABS_RT_CODES];
50 extern char *ABS_PP_CODES[NUM_ABS_PP_CODES];
51 
52 /* libcollector will mark HWC overflow values that appear to be invalid */
53 /* dbe should check HWC values for errors */
54 #define HWCVAL_ERR_FLAG         (1ULL<<63)
55 #define HWCVAL_SET_ERR(ctr)     ((ctr) | HWCVAL_ERR_FLAG)
56 #define HWCVAL_HAS_ERR(ctr)     (((ctr) & HWCVAL_ERR_FLAG) != 0)
57 #define HWCVAL_CLR_ERR(ctr)     ((ctr) & ~HWCVAL_ERR_FLAG)
58 
59 #define ABS_GET_RT_CODE(EA)     ((EA) & 0x0FLL)
60 #define ABS_GET_PP_CODE(EA)     (((EA) & 0xF0LL) / 0xF)
61 
62 #endif /* _ABS_H */
63