Re: [PATCH] x86: Unify cosmetic kprobes{32|64}.c

From: Masami Hiramatsu
Date: Mon Dec 17 2007 - 10:17:13 EST


Hi Harvey,

Harvey Harrison wrote:
> diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c
> index f4ba584..2a8acd6 100644
> --- a/arch/x86/kernel/kprobes_32.c
> +++ b/arch/x86/kernel/kprobes_32.c
> @@ -234,7 +234,7 @@ static int __kprobes is_IF_modifier(kprobe_opcode_t opcode)
>
> int __kprobes arch_prepare_kprobe(struct kprobe *p)
> {
> - /* insn: must be on special executable page on i386. */
> + /* insn: must be on special executable page on x86_32|64. */
> p->ainsn.insn = get_insn_slot();
> if (!p->ainsn.insn)
> return -ENOMEM;
> @@ -373,13 +373,21 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
> static __always_inline void clear_btf(void)
> {
> if (test_thread_flag(TIF_DEBUGCTLMSR))
> +#ifdef CONFIG_X86_32
> wrmsr(MSR_IA32_DEBUGCTLMSR, 0, 0);
> +#else
> + wrmsrl(MSR_IA32_DEBUGCTLMSR, 0);
> +#endif
> }
>
> static __always_inline void restore_btf(void)
> {
> if (test_thread_flag(TIF_DEBUGCTLMSR))
> +#ifdef CONFIG_X86_32
> wrmsr(MSR_IA32_DEBUGCTLMSR, current->thread.debugctlmsr, 0);
> +#else
> + wrmsrl(MSR_IA32_DEBUGCTLMSR, current->thread.debugctlmsr);
> +#endif
> }

I think you can use wrmsr() on X86_64 too.
So, we can merge it to wrmsr().


--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@xxxxxxxxxx, masami.hiramatsu.pt@xxxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/