Skip to content

Commit

Permalink
x86: use wrmsrl in kprobes.c, step.c
Browse files Browse the repository at this point in the history
Where x86_32 passed zero in the high 32 bits, use wrmsrl which
will zero extend for us.  This allows ifdefs for 32/64 bit to
be eliminated.

Eliminate ifdef in step.c.  Similar cleanup was done when unifying
kprobes_32|64.c and wrmsr() was chosen there over wrmsrl().  This
patch changes these to wrmsrl.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Harvey Harrison authored and Ingo Molnar committed Jan 30, 2008
1 parent e8c10ef commit f13bd3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,13 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
static void __kprobes clear_btf(void)
{
if (test_thread_flag(TIF_DEBUGCTLMSR))
wrmsr(MSR_IA32_DEBUGCTLMSR, 0, 0);
wrmsrl(MSR_IA32_DEBUGCTLMSR, 0);
}

static void __kprobes restore_btf(void)
{
if (test_thread_flag(TIF_DEBUGCTLMSR))
wrmsr(MSR_IA32_DEBUGCTLMSR, current->thread.debugctlmsr, 0);
wrmsrl(MSR_IA32_DEBUGCTLMSR, current->thread.debugctlmsr);
}

static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
Expand Down
4 changes: 0 additions & 4 deletions arch/x86/kernel/step.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,7 @@ static void write_debugctlmsr(struct task_struct *child, unsigned long val)
if (child != current)
return;

#ifdef CONFIG_X86_64
wrmsrl(MSR_IA32_DEBUGCTLMSR, val);
#else
wrmsr(MSR_IA32_DEBUGCTLMSR, val, 0);
#endif
}

/*
Expand Down

0 comments on commit f13bd3e

Please sign in to comment.