1 /* 2 * 3 * honggfuzz - Intel PT decoder 4 * ----------------------------------------- 5 * 6 * Author: Robert Swiecki <swiecki@google.com> 7 * 8 * Copyright 2010-2018 by Google Inc. All Rights Reserved. 9 * 10 * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 * not use this file except in compliance with the License. You may obtain 12 * a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 19 * implied. See the License for the specific language governing 20 * permissions and limitations under the License. 21 * 22 */ 23 24 #ifndef _HF_LINUX_PT_H_ 25 #define _HF_LINUX_PT_H_ 26 27 #include "honggfuzz.h" 28 29 extern void arch_ptAnalyze(run_t* run); 30 extern void perf_ptInit(void); 31 32 #ifndef BIT 33 #define BIT(nr) (1UL << (nr)) 34 #endif 35 36 #define RTIT_CTL_TRACEEN BIT(0) 37 #define RTIT_CTL_CYCLEACC BIT(1) 38 #define RTIT_CTL_OS BIT(2) 39 #define RTIT_CTL_USR BIT(3) 40 #define RTIT_CTL_PWR_EVT_EN BIT(4) 41 #define RTIT_CTL_FUP_ON_PTW BIT(5) 42 #define RTIT_CTL_CR3EN BIT(7) 43 #define RTIT_CTL_TOPA BIT(8) 44 #define RTIT_CTL_MTC_EN BIT(9) 45 #define RTIT_CTL_TSC_EN BIT(10) 46 #define RTIT_CTL_DISRETC BIT(11) 47 #define RTIT_CTL_PTW_EN BIT(12) 48 #define RTIT_CTL_BRANCH_EN BIT(13) 49 #define RTIT_CTL_MTC_RANGE_OFFSET 14 50 #define RTIT_CTL_MTC_RANGE (0x0full << RTIT_CTL_MTC_RANGE_OFFSET) 51 #define RTIT_CTL_CYC_THRESH_OFFSET 19 52 #define RTIT_CTL_CYC_THRESH (0x0full << RTIT_CTL_CYC_THRESH_OFFSET) 53 #define RTIT_CTL_PSB_FREQ_OFFSET 24 54 #define RTIT_CTL_PSB_FREQ (0x0full << RTIT_CTL_PSB_FREQ_OFFSET) 55 #define RTIT_CTL_ADDR0_OFFSET 32 56 #define RTIT_CTL_ADDR0 (0x0full << RTIT_CTL_ADDR0_OFFSET) 57 #define RTIT_CTL_ADDR1_OFFSET 36 58 #define RTIT_CTL_ADDR1 (0x0full << RTIT_CTL_ADDR1_OFFSET) 59 #define RTIT_CTL_ADDR2_OFFSET 40 60 #define RTIT_CTL_ADDR2 (0x0full << RTIT_CTL_ADDR2_OFFSET) 61 #define RTIT_CTL_ADDR3_OFFSET 44 62 #define RTIT_CTL_ADDR3 (0x0full << RTIT_CTL_ADDR3_OFFSET) 63 #define RTIT_STATUS_FILTEREN BIT(0) 64 #define RTIT_STATUS_CONTEXTEN BIT(1) 65 #define RTIT_STATUS_TRIGGEREN BIT(2) 66 #define RTIT_STATUS_BUFFOVF BIT(3) 67 #define RTIT_STATUS_ERROR BIT(4) 68 #define RTIT_STATUS_STOPPED BIT(5) 69 70 #endif /* _HF_LINUX_INTEL_PT_LIB */ 71