lkml.org 
[lkml]   [2007]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86: Unify cosmetic kprobes{32|64}.c
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@redhat.com, masami.hiramatsu.pt@hitachi.com



\
 
 \ /
  Last update: 2007-12-17 16:19    [W:0.063 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site