blob: aacc353741c966b551132ebeb767253b7b87e40b [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13/*
14* perf-function-hooks.c
15* DESCRIPTION
16* Hooks for ksapi.ko
17*/
18
19#include <linux/module.h>
20#include <linux/module.h>
21#include <linux/init.h>
22#include <linux/sched.h>
23#include <linux/sysrq.h>
24#include <linux/time.h>
25#include "linux/proc_fs.h"
26#include "linux/kernel_stat.h"
27#include "asm/uaccess.h"
28#include <linux/proc_fs.h>
29#include "cp15_registers.h"
30#include <asm/perftypes.h>
31#include "perf.h"
32
33/*
34* Function Pointers for when the module is installed...
35* Should we use a single "ready" variable for the testing
36* in the functions below, will be safer when module is removed
37* testing for a locked variable...
38*/
39VPVF pp_interrupt_out_ptr;
40VPVF pp_interrupt_in_ptr;
41VPULF pp_process_remove_ptr;
42unsigned int pp_loaded;
43EXPORT_SYMBOL(pp_loaded);
44atomic_t pm_op_lock;
45EXPORT_SYMBOL(pm_op_lock);
46
47/*
48FUNCTION VARIOUS
49
50DESCRIPTION
51Hooks to callinto the module functions after they are loaded. The
52above pointers will be set and then these functions are ready to be
53called.
54
55DEPENDENCIES
56THe per preocess performance monitor needs to be loaded ...
57
58RETURN VALUE
59
60SIDE EFFECTS
61*/
62void perf_mon_interrupt_out(void)
63{
64 if (pp_loaded)
65 (*pp_interrupt_out_ptr)();
66}
67EXPORT_SYMBOL(pp_interrupt_out_ptr);
68
69void perf_mon_interrupt_in(void)
70{
71 if (pp_loaded)
72 (*pp_interrupt_in_ptr)();
73}
74EXPORT_SYMBOL(pp_interrupt_in_ptr);
75
76void per_process_remove(unsigned long pid)
77{
78 if (pp_loaded)
79 (*pp_process_remove_ptr)(pid);
80}
81EXPORT_SYMBOL(pp_process_remove_ptr);