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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*
* Dynamic Binary Instrumentation Module based on KProbes
* modules/uprobe/arch/asm-arm/swap_uprobes.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, 2006-2010
*
* 2008-2009 Alexey Gerenkov <a.gerenkov@samsung.com> User-Space
* Probes initial implementation; Support x86/ARM/MIPS for both user and kernel spaces.
* 2010 Ekaterina Gorelkina <e.gorelkina@samsung.com>: redesign module for separating core and arch parts
*
*/
#ifndef _ARM_SWAP_UPROBES_H
#define _ARM_SWAP_UPROBES_H
struct kprobe;
struct task_struct;
struct uprobe;
struct uretprobe;
struct uretprobe_instance;
struct arch_specific_tramp {
unsigned long tramp_arm[UPROBES_TRAMP_LEN];
unsigned long tramp_thumb[UPROBES_TRAMP_LEN];
void *utramp;
};
static inline u32 swap_get_urp_float(struct pt_regs *regs)
{
return regs->ARM_r0;
}
static inline u64 swap_get_urp_double(struct pt_regs *regs)
{
return regs->ARM_r0 | (u64)regs->ARM_r1 << 32;
}
static inline void arch_ujprobe_return(void)
{
}
int arch_prepare_uprobe(struct uprobe *up);
int setjmp_upre_handler(struct kprobe *p, struct pt_regs *regs);
static inline int longjmp_break_uhandler(struct kprobe *p, struct pt_regs *regs)
{
return 0;
}
void arch_opcode_analysis_uretprobe(struct uretprobe *rp);
void arch_prepare_uretprobe(struct uretprobe_instance *ri, struct pt_regs *regs);
int arch_disarm_urp_inst(struct uretprobe_instance *ri,
struct task_struct *task);
unsigned long arch_get_trampoline_addr(struct kprobe *p, struct pt_regs *regs);
void arch_set_orig_ret_addr(unsigned long orig_ret_addr, struct pt_regs *regs);
static inline unsigned long swap_get_uarg(struct pt_regs *regs, unsigned long n)
{
u32 *ptr, addr = 0;
switch (n) {
case 0:
return regs->ARM_r0;
case 1:
return regs->ARM_r1;
case 2:
return regs->ARM_r2;
case 3:
return regs->ARM_r3;
}
ptr = (u32 *)regs->ARM_sp + n - 4;
if (get_user(addr, ptr))
printk("failed to dereference a pointer, ptr=%p\n", ptr);
return addr;
}
int swap_arch_init_uprobes(void);
void swap_arch_exit_uprobes(void);
#endif /* _ARM_SWAP_UPROBES_H */
|