blob: b95984154dbad1427701e6c97a46e7bcfa5b014d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* arch/sparc64/kernel/kprobes.c
2 *
3 * Copyright (C) 2004 David S. Miller <davem@davemloft.net>
4 */
5
6#include <linux/config.h>
7#include <linux/kernel.h>
8#include <linux/kprobes.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <asm/kdebug.h>
10#include <asm/signal.h>
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -070011#include <asm/cacheflush.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
13/* We do not have hardware single-stepping on sparc64.
14 * So we implement software single-stepping with breakpoint
15 * traps. The top-level scheme is similar to that used
16 * in the x86 kprobes implementation.
17 *
18 * In the kprobe->ainsn.insn[] array we store the original
19 * instruction at index zero and a break instruction at
20 * index one.
21 *
22 * When we hit a kprobe we:
23 * - Run the pre-handler
24 * - Remember "regs->tnpc" and interrupt level stored in
25 * "regs->tstate" so we can restore them later
26 * - Disable PIL interrupts
27 * - Set regs->tpc to point to kprobe->ainsn.insn[0]
28 * - Set regs->tnpc to point to kprobe->ainsn.insn[1]
29 * - Mark that we are actively in a kprobe
30 *
31 * At this point we wait for the second breakpoint at
32 * kprobe->ainsn.insn[1] to hit. When it does we:
33 * - Run the post-handler
34 * - Set regs->tpc to "remembered" regs->tnpc stored above,
35 * restore the PIL interrupt level in "regs->tstate" as well
36 * - Make any adjustments necessary to regs->tnpc in order
37 * to handle relative branches correctly. See below.
38 * - Mark that we are no longer actively in a kprobe.
39 */
40
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -080041DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
42DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
43
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -070044int __kprobes arch_prepare_kprobe(struct kprobe *p)
Linus Torvalds1da177e2005-04-16 15:20:36 -070045{
46 return 0;
47}
48
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -070049void __kprobes arch_copy_kprobe(struct kprobe *p)
Linus Torvalds1da177e2005-04-16 15:20:36 -070050{
51 p->ainsn.insn[0] = *p->addr;
52 p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2;
Rusty Lynch7e1048b2005-06-23 00:09:25 -070053 p->opcode = *p->addr;
54}
55
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -070056void __kprobes arch_arm_kprobe(struct kprobe *p)
Rusty Lynch7e1048b2005-06-23 00:09:25 -070057{
58 *p->addr = BREAKPOINT_INSTRUCTION;
59 flushi(p->addr);
60}
61
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -070062void __kprobes arch_disarm_kprobe(struct kprobe *p)
Rusty Lynch7e1048b2005-06-23 00:09:25 -070063{
64 *p->addr = p->opcode;
65 flushi(p->addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070066}
67
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -070068void __kprobes arch_remove_kprobe(struct kprobe *p)
Linus Torvalds1da177e2005-04-16 15:20:36 -070069{
70}
71
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -080072static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -070073{
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -080074 kcb->prev_kprobe.kp = kprobe_running();
75 kcb->prev_kprobe.status = kcb->kprobe_status;
76 kcb->prev_kprobe.orig_tnpc = kcb->kprobe_orig_tnpc;
77 kcb->prev_kprobe.orig_tstate_pil = kcb->kprobe_orig_tstate_pil;
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -070078}
79
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -080080static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb)
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -070081{
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -080082 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
83 kcb->kprobe_status = kcb->prev_kprobe.status;
84 kcb->kprobe_orig_tnpc = kcb->prev_kprobe.orig_tnpc;
85 kcb->kprobe_orig_tstate_pil = kcb->prev_kprobe.orig_tstate_pil;
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -070086}
87
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -080088static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
89 struct kprobe_ctlblk *kcb)
Linus Torvalds1da177e2005-04-16 15:20:36 -070090{
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -080091 __get_cpu_var(current_kprobe) = p;
92 kcb->kprobe_orig_tnpc = regs->tnpc;
93 kcb->kprobe_orig_tstate_pil = (regs->tstate & TSTATE_PIL);
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -070094}
95
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -080096static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs,
97 struct kprobe_ctlblk *kcb)
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -070098{
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 regs->tstate |= TSTATE_PIL;
100
101 /*single step inline, if it a breakpoint instruction*/
102 if (p->opcode == BREAKPOINT_INSTRUCTION) {
103 regs->tpc = (unsigned long) p->addr;
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800104 regs->tnpc = kcb->kprobe_orig_tnpc;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 } else {
106 regs->tpc = (unsigned long) &p->ainsn.insn[0];
107 regs->tnpc = (unsigned long) &p->ainsn.insn[1];
108 }
109}
110
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -0700111static int __kprobes kprobe_handler(struct pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112{
113 struct kprobe *p;
114 void *addr = (void *) regs->tpc;
115 int ret = 0;
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800116 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 if (kprobe_running()) {
119 /* We *are* holding lock here, so this is safe.
120 * Disarm the probe we just hit, and ignore it.
121 */
122 p = get_kprobe(addr);
123 if (p) {
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800124 if (kcb->kprobe_status == KPROBE_HIT_SS) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 regs->tstate = ((regs->tstate & ~TSTATE_PIL) |
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800126 kcb->kprobe_orig_tstate_pil);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 unlock_kprobes();
128 goto no_kprobe;
129 }
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -0700130 /* We have reentered the kprobe_handler(), since
131 * another probe was hit while within the handler.
132 * We here save the original kprobes variables and
133 * just single step on the instruction of the new probe
134 * without calling any user handlers.
135 */
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800136 save_previous_kprobe(kcb);
137 set_current_kprobe(p, regs, kcb);
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -0700138 p->nmissed++;
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800139 kcb->kprobe_status = KPROBE_REENTER;
140 prepare_singlestep(p, regs, kcb);
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -0700141 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 } else {
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800143 p = __get_cpu_var(current_kprobe);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 if (p->break_handler && p->break_handler(p, regs))
145 goto ss_probe;
146 }
147 /* If it's not ours, can't be delete race, (we hold lock). */
148 goto no_kprobe;
149 }
150
151 lock_kprobes();
152 p = get_kprobe(addr);
153 if (!p) {
154 unlock_kprobes();
155 if (*(u32 *)addr != BREAKPOINT_INSTRUCTION) {
156 /*
157 * The breakpoint instruction was removed right
158 * after we hit it. Another cpu has removed
159 * either a probepoint or a debugger breakpoint
160 * at this address. In either case, no further
161 * handling of this interrupt is appropriate.
162 */
163 ret = 1;
164 }
165 /* Not one of ours: let kernel handle it */
166 goto no_kprobe;
167 }
168
Ananth N Mavinakayanahalli66ff2d02005-11-07 01:00:07 -0800169 /*
170 * This preempt_disable() matches the preempt_enable_no_resched()
171 * in post_kprobes_handler()
172 */
173 preempt_disable();
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800174 set_current_kprobe(p, regs, kcb);
175 kcb->kprobe_status = KPROBE_HIT_ACTIVE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176 if (p->pre_handler && p->pre_handler(p, regs))
177 return 1;
178
179ss_probe:
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800180 prepare_singlestep(p, regs, kcb);
181 kcb->kprobe_status = KPROBE_HIT_SS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 return 1;
183
184no_kprobe:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 return ret;
186}
187
188/* If INSN is a relative control transfer instruction,
189 * return the corrected branch destination value.
190 *
191 * The original INSN location was REAL_PC, it actually
192 * executed at PC and produced destination address NPC.
193 */
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -0700194static unsigned long __kprobes relbranch_fixup(u32 insn, unsigned long real_pc,
195 unsigned long pc,
196 unsigned long npc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197{
198 /* Branch not taken, no mods necessary. */
199 if (npc == pc + 0x4UL)
200 return real_pc + 0x4UL;
201
202 /* The three cases are call, branch w/prediction,
203 * and traditional branch.
204 */
205 if ((insn & 0xc0000000) == 0x40000000 ||
206 (insn & 0xc1c00000) == 0x00400000 ||
207 (insn & 0xc1c00000) == 0x00800000) {
208 /* The instruction did all the work for us
209 * already, just apply the offset to the correct
210 * instruction location.
211 */
212 return (real_pc + (npc - pc));
213 }
214
215 return real_pc + 0x4UL;
216}
217
218/* If INSN is an instruction which writes it's PC location
219 * into a destination register, fix that up.
220 */
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -0700221static void __kprobes retpc_fixup(struct pt_regs *regs, u32 insn,
222 unsigned long real_pc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223{
224 unsigned long *slot = NULL;
225
226 /* Simplest cast is call, which always uses %o7 */
227 if ((insn & 0xc0000000) == 0x40000000) {
228 slot = &regs->u_regs[UREG_I7];
229 }
230
231 /* Jmpl encodes the register inside of the opcode */
232 if ((insn & 0xc1f80000) == 0x81c00000) {
233 unsigned long rd = ((insn >> 25) & 0x1f);
234
235 if (rd <= 15) {
236 slot = &regs->u_regs[rd];
237 } else {
238 /* Hard case, it goes onto the stack. */
239 flushw_all();
240
241 rd -= 16;
242 slot = (unsigned long *)
243 (regs->u_regs[UREG_FP] + STACK_BIAS);
244 slot += rd;
245 }
246 }
247 if (slot != NULL)
248 *slot = real_pc;
249}
250
251/*
252 * Called after single-stepping. p->addr is the address of the
253 * instruction whose first byte has been replaced by the breakpoint
254 * instruction. To avoid the SMP problems that can occur when we
255 * temporarily put back the original opcode to single-step, we
256 * single-stepped a copy of the instruction. The address of this
257 * copy is p->ainsn.insn.
258 *
259 * This function prepares to return from the post-single-step
260 * breakpoint trap.
261 */
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800262static void __kprobes resume_execution(struct kprobe *p,
263 struct pt_regs *regs, struct kprobe_ctlblk *kcb)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264{
265 u32 insn = p->ainsn.insn[0];
266
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800267 regs->tpc = kcb->kprobe_orig_tnpc;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 regs->tnpc = relbranch_fixup(insn,
269 (unsigned long) p->addr,
270 (unsigned long) &p->ainsn.insn[0],
271 regs->tnpc);
272 retpc_fixup(regs, insn, (unsigned long) p->addr);
273
274 regs->tstate = ((regs->tstate & ~TSTATE_PIL) |
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800275 kcb->kprobe_orig_tstate_pil);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276}
277
278static inline int post_kprobe_handler(struct pt_regs *regs)
279{
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800280 struct kprobe *cur = kprobe_running();
281 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
282
283 if (!cur)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 return 0;
285
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800286 if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) {
287 kcb->kprobe_status = KPROBE_HIT_SSDONE;
288 cur->post_handler(cur, regs, 0);
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -0700289 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800291 resume_execution(cur, regs, kcb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -0700293 /*Restore back the original saved kprobes variables and continue. */
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800294 if (kcb->kprobe_status == KPROBE_REENTER) {
295 restore_previous_kprobe(kcb);
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -0700296 goto out;
297 }
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800298 reset_current_kprobe();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 unlock_kprobes();
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -0700300out:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301 preempt_enable_no_resched();
302
303 return 1;
304}
305
306/* Interrupts disabled, kprobe_lock held. */
307static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
308{
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800309 struct kprobe *cur = kprobe_running();
310 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
311
312 if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313 return 1;
314
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800315 if (kcb->kprobe_status & KPROBE_HIT_SS) {
316 resume_execution(cur, regs, kcb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800318 reset_current_kprobe();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319 unlock_kprobes();
320 preempt_enable_no_resched();
321 }
322 return 0;
323}
324
325/*
326 * Wrapper routine to for handling exceptions.
327 */
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -0700328int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
329 unsigned long val, void *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330{
331 struct die_args *args = (struct die_args *)data;
Ananth N Mavinakayanahalli66ff2d02005-11-07 01:00:07 -0800332 int ret = NOTIFY_DONE;
333
334 preempt_disable();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 switch (val) {
336 case DIE_DEBUG:
337 if (kprobe_handler(args->regs))
Ananth N Mavinakayanahalli66ff2d02005-11-07 01:00:07 -0800338 ret = NOTIFY_STOP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 break;
340 case DIE_DEBUG_2:
341 if (post_kprobe_handler(args->regs))
Ananth N Mavinakayanahalli66ff2d02005-11-07 01:00:07 -0800342 ret = NOTIFY_STOP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 break;
344 case DIE_GPF:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 case DIE_PAGE_FAULT:
346 if (kprobe_running() &&
347 kprobe_fault_handler(args->regs, args->trapnr))
Ananth N Mavinakayanahalli66ff2d02005-11-07 01:00:07 -0800348 ret = NOTIFY_STOP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349 break;
350 default:
351 break;
352 }
Ananth N Mavinakayanahalli66ff2d02005-11-07 01:00:07 -0800353 preempt_enable();
354 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355}
356
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -0700357asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
358 struct pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359{
360 BUG_ON(trap_level != 0x170 && trap_level != 0x171);
361
362 if (user_mode(regs)) {
363 local_irq_enable();
364 bad_trap(regs, trap_level);
365 return;
366 }
367
368 /* trap_level == 0x170 --> ta 0x70
369 * trap_level == 0x171 --> ta 0x71
370 */
371 if (notify_die((trap_level == 0x170) ? DIE_DEBUG : DIE_DEBUG_2,
372 (trap_level == 0x170) ? "debug" : "debug_2",
373 regs, 0, trap_level, SIGTRAP) != NOTIFY_STOP)
374 bad_trap(regs, trap_level);
375}
376
377/* Jprobes support. */
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -0700378int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379{
380 struct jprobe *jp = container_of(p, struct jprobe, kp);
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800381 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800383 kcb->jprobe_saved_regs_location = regs;
384 memcpy(&(kcb->jprobe_saved_regs), regs, sizeof(*regs));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385
386 /* Save a whole stack frame, this gets arguments
387 * pushed onto the stack after using up all the
388 * arg registers.
389 */
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800390 memcpy(&(kcb->jprobe_saved_stack),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391 (char *) (regs->u_regs[UREG_FP] + STACK_BIAS),
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800392 sizeof(kcb->jprobe_saved_stack));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393
394 regs->tpc = (unsigned long) jp->entry;
395 regs->tnpc = ((unsigned long) jp->entry) + 0x4UL;
396 regs->tstate |= TSTATE_PIL;
397
398 return 1;
399}
400
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -0700401void __kprobes jprobe_return(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 __asm__ __volatile__(
404 ".globl jprobe_return_trap_instruction\n"
405"jprobe_return_trap_instruction:\n\t"
406 "ta 0x70");
407}
408
409extern void jprobe_return_trap_instruction(void);
410
411extern void __show_regs(struct pt_regs * regs);
412
Prasanna S Panchamukhi05e14cb2005-09-06 15:19:30 -0700413int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414{
415 u32 *addr = (u32 *) regs->tpc;
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800416 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417
418 if (addr == (u32 *) jprobe_return_trap_instruction) {
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800419 if (kcb->jprobe_saved_regs_location != regs) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 printk("JPROBE: Current regs (%p) does not match "
421 "saved regs (%p).\n",
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800422 regs, kcb->jprobe_saved_regs_location);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 printk("JPROBE: Saved registers\n");
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800424 __show_regs(kcb->jprobe_saved_regs_location);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 printk("JPROBE: Current registers\n");
426 __show_regs(regs);
427 BUG();
428 }
429 /* Restore old register state. Do pt_regs
430 * first so that UREG_FP is the original one for
431 * the stack frame restore.
432 */
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800433 memcpy(regs, &(kcb->jprobe_saved_regs), sizeof(*regs));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434
435 memcpy((char *) (regs->u_regs[UREG_FP] + STACK_BIAS),
Ananth N Mavinakayanahallif215d982005-11-07 01:00:11 -0800436 &(kcb->jprobe_saved_stack),
437 sizeof(kcb->jprobe_saved_stack));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438
439 return 1;
440 }
441 return 0;
442}
Prasanna S Panchamukhie539c232005-06-23 00:09:39 -0700443
Rusty Lynch67729262005-07-05 18:54:50 -0700444/* architecture specific initialization */
445int arch_init_kprobes(void)
446{
447 return 0;
448}