summaryrefslogtreecommitdiff
path: root/us_manager/sspt/sspt_proc.h
blob: 600d2d84e755bd6692ba18bc3b0cca492d9e9a52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef __SSPT_PROC__
#define __SSPT_PROC__

/*
 *  Dynamic Binary Instrumentation Module based on KProbes
 *  modules/driver/sspt/sspt_proc.h
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * Copyright (C) Samsung Electronics, 2013
 *
 * 2013         Vyacheslav Cherkashin <v.cherkashin@samsung.com>
 *
 */

#include <linux/types.h>
#include "sspt_file.h"

struct slot_manager;
struct task_struct;

enum US_FLAGS {
	US_UNREGS_PROBE,
	US_DISARM
};

struct sspt_proc {
	struct list_head list;
	pid_t tgid;
	struct task_struct *task;
	struct dentry *dentry;
	struct slot_manager *sm;
	struct list_head file_list;
	unsigned first_install:1;
};


struct sspt_proc *sspt_proc_create(struct dentry* dentry, struct task_struct *task);
struct sspt_proc *sspt_proc_copy(struct sspt_proc *proc, struct task_struct *task);
void sspt_proc_free(struct sspt_proc *proc);

struct sspt_proc *sspt_proc_get_new(struct task_struct *task);
struct sspt_proc *sspt_proc_get_by_task(struct task_struct *task);
struct sspt_proc *sspt_proc_get_by_task_or_new(struct task_struct *task);
void sspt_proc_free_all(void);

void sspt_proc_add_ip_data(struct sspt_proc *proc, struct dentry* dentry,
		char *name, struct ip_data *ip_d);
struct sspt_file *sspt_proc_find_file(struct sspt_proc *proc, struct dentry *dentry);
struct sspt_file *sspt_proc_find_file_or_new(struct sspt_proc *proc,
		struct dentry *dentry, char *name);

void sspt_proc_install_page(struct sspt_proc *proc, unsigned long page_addr);
void sspt_proc_install(struct sspt_proc *proc);
int sspt_proc_uninstall(struct sspt_proc *proc, struct task_struct *task, enum US_FLAGS flag);

#endif /* __SSPT_PROC__ */