Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4eb5845d authored by Paul Mundt's avatar Paul Mundt
Browse files

sh: kprobes: __kprobes annotations and formatting cleanups.



Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 734db377
Loading
Loading
Loading
Loading
+20 −17
Original line number Original line Diff line number Diff line
@@ -115,19 +115,19 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
	}
	}
}
}


static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
{
{
	kcb->prev_kprobe.kp = kprobe_running();
	kcb->prev_kprobe.kp = kprobe_running();
	kcb->prev_kprobe.status = kcb->kprobe_status;
	kcb->prev_kprobe.status = kcb->kprobe_status;
}
}


static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb)
static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
{
{
	__get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
	__get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
	kcb->kprobe_status = kcb->prev_kprobe.status;
	kcb->kprobe_status = kcb->prev_kprobe.status;
}
}


static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
					 struct kprobe_ctlblk *kcb)
					 struct kprobe_ctlblk *kcb)
{
{
	__get_cpu_var(current_kprobe) = p;
	__get_cpu_var(current_kprobe) = p;
@@ -138,7 +138,7 @@ static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
 * on the next instruction, following branches. Two probes are set if the
 * on the next instruction, following branches. Two probes are set if the
 * branch is conditional.
 * branch is conditional.
 */
 */
static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
{
{
	kprobe_opcode_t *addr = NULL;
	kprobe_opcode_t *addr = NULL;
	saved_current_opcode.addr = (kprobe_opcode_t *) (regs->pc);
	saved_current_opcode.addr = (kprobe_opcode_t *) (regs->pc);
@@ -358,7 +358,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
	return orig_ret_address;
	return orig_ret_address;
}
}


static inline int post_kprobe_handler(struct pt_regs *regs)
static int __kprobes post_kprobe_handler(struct pt_regs *regs)
{
{
	struct kprobe *cur = kprobe_running();
	struct kprobe *cur = kprobe_running();
	struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
	struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
@@ -396,6 +396,7 @@ static inline int post_kprobe_handler(struct pt_regs *regs)
		restore_previous_kprobe(kcb);
		restore_previous_kprobe(kcb);
		goto out;
		goto out;
	}
	}

	reset_current_kprobe();
	reset_current_kprobe();


out:
out:
@@ -463,6 +464,7 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
	default:
	default:
		break;
		break;
	}
	}

	return 0;
	return 0;
}
}


@@ -498,8 +500,8 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
					ret = NOTIFY_STOP;
					ret = NOTIFY_STOP;
				} else {
				} else {
					p = __get_cpu_var(current_kprobe);
					p = __get_cpu_var(current_kprobe);
					if (p->break_handler
					if (p->break_handler &&
					    && p->break_handler(p, args->regs))
					    p->break_handler(p, args->regs))
						ret = NOTIFY_STOP;
						ret = NOTIFY_STOP;
				}
				}
			}
			}
@@ -542,11 +544,11 @@ void __kprobes jprobe_return(void)
int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
{
{
	struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
	struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
	u8 *addr = (u8 *) regs->pc;
	unsigned long stack_addr = kcb->jprobe_saved_r15;
	unsigned long stack_addr = kcb->jprobe_saved_r15;
	u8 *addr = (u8 *)regs->pc;


	if ((addr >= (u8 *) jprobe_return)
	if ((addr >= (u8 *)jprobe_return) &&
	    && (addr <= (u8 *) jprobe_return_end)) {
	    (addr <= (u8 *)jprobe_return_end)) {
		*regs = kcb->jprobe_saved_regs;
		*regs = kcb->jprobe_saved_regs;


		memcpy((kprobe_opcode_t *)stack_addr, kcb->jprobes_stack,
		memcpy((kprobe_opcode_t *)stack_addr, kcb->jprobes_stack,
@@ -556,6 +558,7 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
		preempt_enable_no_resched();
		preempt_enable_no_resched();
		return 1;
		return 1;
	}
	}

	return 0;
	return 0;
}
}