0001
0002
0003
0004
0005
0006 #include <stdio.h>
0007 #include <stdlib.h>
0008
0009 #include "../event.h"
0010 #include "misc.h"
0011 #include "utils.h"
0012
0013
0014 #define EventCode 0x46880
0015
0016 extern void thirty_two_instruction_loop_with_ll_sc(u64 loops, u64 *ll_sc_target);
0017
0018
0019
0020
0021
0022 static int mmcr1_comb(void)
0023 {
0024 struct event event;
0025 u64 *intr_regs;
0026 u64 dummy;
0027
0028
0029 SKIP_IF(check_pvr_for_sampling_tests());
0030
0031
0032 event_init_sampling(&event, EventCode);
0033 event.attr.sample_regs_intr = platform_extended_mask;
0034 FAIL_IF(event_open(&event));
0035 event.mmap_buffer = event_sample_buf_mmap(event.fd, 1);
0036
0037 FAIL_IF(event_enable(&event));
0038
0039
0040 thirty_two_instruction_loop_with_ll_sc(10000000, &dummy);
0041
0042 FAIL_IF(event_disable(&event));
0043
0044
0045 FAIL_IF(!collect_samples(event.mmap_buffer));
0046
0047 intr_regs = get_intr_regs(&event, event.mmap_buffer);
0048
0049
0050 FAIL_IF(!intr_regs);
0051
0052
0053
0054
0055
0056 FAIL_IF(EV_CODE_EXTRACT(event.attr.config, comb) !=
0057 get_mmcr1_comb(get_reg_value(intr_regs, "MMCR1"), 4));
0058
0059 event_close(&event);
0060 return 0;
0061 }
0062
0063 int main(void)
0064 {
0065 return test_harness(mmcr1_comb, "mmcr1_comb");
0066 }