3 * interface to x86 model-specific MSR operations
5 * @remark Copyright 2002 OProfile authors
6 * @remark Read the file COPYING
8 * @author Graydon Hoare
11 #ifndef OP_X86_MODEL_H
12 #define OP_X86_MODEL_H
14 #define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0)
15 #define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0)
16 #define CTRL_SET_ACTIVE(n) (n |= (1<<22))
17 #define CTRL_SET_ENABLE(val) (val |= 1<<20)
18 #define CTRL_SET_INACTIVE(n) (n &= ~(1<<22))
19 #define CTRL_SET_KERN(val, k) (val |= ((k & 1) << 17))
20 #define CTRL_SET_UM(val, m) (val |= (m << 8))
21 #define CTRL_SET_USR(val, u) (val |= ((u & 1) << 16))
30 struct op_saved_msr saved;
34 struct op_msr *counters;
35 struct op_msr *controls;
40 /* The model vtable abstracts the differences between
41 * various x86 CPU models' perfctr support.
43 struct op_x86_model_spec {
44 unsigned int num_counters;
45 unsigned int num_controls;
46 int (*init)(struct oprofile_operations *ops);
48 void (*fill_in_addresses)(struct op_msrs * const msrs);
49 void (*setup_ctrs)(struct op_msrs const * const msrs);
50 int (*check_ctrs)(struct pt_regs * const regs,
51 struct op_msrs const * const msrs);
52 void (*start)(struct op_msrs const * const msrs);
53 void (*stop)(struct op_msrs const * const msrs);
54 void (*shutdown)(struct op_msrs const * const msrs);
57 extern struct op_x86_model_spec const op_ppro_spec;
58 extern struct op_x86_model_spec const op_p4_spec;
59 extern struct op_x86_model_spec const op_p4_ht2_spec;
60 extern struct op_x86_model_spec const op_amd_spec;
61 extern struct op_x86_model_spec op_arch_perfmon_spec;
63 #endif /* OP_X86_MODEL_H */