[PATCH] powerpc: Add oprofile calltrace support
[powerpc.git] / arch / powerpc / oprofile / op_model_power4.c
index c4ee547..38db2ef 100644 (file)
 #include <linux/oprofile.h>
 #include <linux/init.h>
 #include <linux/smp.h>
+#include <asm/firmware.h>
 #include <asm/ptrace.h>
 #include <asm/system.h>
 #include <asm/processor.h>
 #include <asm/cputable.h>
-#include <asm/systemcfg.h>
 #include <asm/rtas.h>
 #include <asm/oprofile_impl.h>
 #include <asm/reg.h>
@@ -233,8 +233,7 @@ static unsigned long get_pc(struct pt_regs *regs)
        mmcra = mfspr(SPRN_MMCRA);
 
        /* Were we in the hypervisor? */
-       if ((systemcfg->platform == PLATFORM_PSERIES_LPAR) &&
-           (mmcra & MMCRA_SIHV))
+       if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & MMCRA_SIHV))
                /* function descriptor madness */
                return *((unsigned long *)hypervisor_bucket);
 
@@ -254,7 +253,7 @@ static unsigned long get_pc(struct pt_regs *regs)
                return (unsigned long)__va(pc);
 
        /* Not sure where we were */
-       if (pc < KERNELBASE)
+       if (!is_kernel_addr(pc))
                /* function descriptor madness */
                return *((unsigned long *)kernel_unknown_bucket);
 
@@ -266,7 +265,7 @@ static int get_kernel(unsigned long pc)
        int is_kernel;
 
        if (!mmcra_has_sihv) {
-               is_kernel = (pc >= KERNELBASE);
+               is_kernel = is_kernel_addr(pc);
        } else {
                unsigned long mmcra = mfspr(SPRN_MMCRA);
                is_kernel = ((mmcra & MMCRA_SIPR) == 0);
@@ -294,7 +293,7 @@ static void power4_handle_interrupt(struct pt_regs *regs,
                val = ctr_read(i);
                if (val < 0) {
                        if (oprofile_running && ctr[i].enabled) {
-                               oprofile_add_pc(pc, is_kernel, i);
+                               oprofile_add_ext_sample(pc, regs, i, is_kernel);
                                ctr_write(i, reset_value[i]);
                        } else {
                                ctr_write(i, 0);