x86/oprofile: Moving nmi_cpu_save/restore_mpx_registers() in nmi_int.c

This patch moves some code in nmi_int.c to get a single separate
multiplexing code section.

Signed-off-by: Robert Richter <robert.richter@amd.com>
This commit is contained in:
Robert Richter 2009-07-09 14:38:49 +02:00
parent 48fb4b4671
commit d0f585dd20

View File

@ -147,6 +147,30 @@ static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)
per_cpu(switch_index, cpu) = 0;
}
static void nmi_cpu_save_mpx_registers(struct op_msrs *msrs)
{
struct op_msr *multiplex = msrs->multiplex;
int i;
for (i = 0; i < model->num_counters; ++i) {
int virt = op_x86_phys_to_virt(i);
if (multiplex[virt].addr)
rdmsrl(multiplex[virt].addr, multiplex[virt].saved);
}
}
static void nmi_cpu_restore_mpx_registers(struct op_msrs *msrs)
{
struct op_msr *multiplex = msrs->multiplex;
int i;
for (i = 0; i < model->num_counters; ++i) {
int virt = op_x86_phys_to_virt(i);
if (multiplex[virt].addr)
wrmsrl(multiplex[virt].addr, multiplex[virt].saved);
}
}
#else
inline int op_x86_phys_to_virt(int phys) { return phys; }
@ -252,34 +276,6 @@ static int nmi_setup(void)
return 0;
}
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
static void nmi_cpu_save_mpx_registers(struct op_msrs *msrs)
{
struct op_msr *multiplex = msrs->multiplex;
int i;
for (i = 0; i < model->num_counters; ++i) {
int virt = op_x86_phys_to_virt(i);
if (multiplex[virt].addr)
rdmsrl(multiplex[virt].addr, multiplex[virt].saved);
}
}
static void nmi_cpu_restore_mpx_registers(struct op_msrs *msrs)
{
struct op_msr *multiplex = msrs->multiplex;
int i;
for (i = 0; i < model->num_counters; ++i) {
int virt = op_x86_phys_to_virt(i);
if (multiplex[virt].addr)
wrmsrl(multiplex[virt].addr, multiplex[virt].saved);
}
}
#endif
static void nmi_cpu_restore_registers(struct op_msrs *msrs)
{
struct op_msr *counters = msrs->counters;