Commit ef451288 authored by Thomas Gleixner's avatar Thomas Gleixner

x86: time_32/64.c unify profile_pc

The code is identical except for the formatting and a useless
#ifdef. Make it the same.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 08047c4f
...@@ -34,23 +34,22 @@ unsigned long profile_pc(struct pt_regs *regs) ...@@ -34,23 +34,22 @@ unsigned long profile_pc(struct pt_regs *regs)
{ {
unsigned long pc = instruction_pointer(regs); unsigned long pc = instruction_pointer(regs);
#ifdef CONFIG_SMP
if (!user_mode_vm(regs) && in_lock_functions(pc)) { if (!user_mode_vm(regs) && in_lock_functions(pc)) {
#ifdef CONFIG_FRAME_POINTER #ifdef CONFIG_FRAME_POINTER
return *(unsigned long *)(regs->bp + sizeof(long)); return *(unsigned long *)(regs->bp + sizeof(long));
#else #else
unsigned long *sp = (unsigned long *)&regs->sp; unsigned long *sp = (unsigned long *)regs->sp;
/*
/* Return address is either directly at stack pointer * Return address is either directly at stack pointer
or above a saved flags. Eflags has bits 22-31 zero, * or above a saved flags. Eflags has bits 22-31 zero,
kernel addresses don't. */ * kernel addresses don't.
*/
if (sp[0] >> 22) if (sp[0] >> 22)
return sp[0]; return sp[0];
if (sp[1] >> 22) if (sp[1] >> 22)
return sp[1]; return sp[1];
#endif #endif
} }
#endif
return pc; return pc;
} }
EXPORT_SYMBOL(profile_pc); EXPORT_SYMBOL(profile_pc);
......
...@@ -34,14 +34,16 @@ unsigned long profile_pc(struct pt_regs *regs) ...@@ -34,14 +34,16 @@ unsigned long profile_pc(struct pt_regs *regs)
{ {
unsigned long pc = instruction_pointer(regs); unsigned long pc = instruction_pointer(regs);
/* Assume the lock function has either no stack frame or a copy
of flags from PUSHF
Eflags always has bits 22 and up cleared unlike kernel addresses. */
if (!user_mode_vm(regs) && in_lock_functions(pc)) { if (!user_mode_vm(regs) && in_lock_functions(pc)) {
#ifdef CONFIG_FRAME_POINTER #ifdef CONFIG_FRAME_POINTER
return *(unsigned long *)(regs->bp + sizeof(long)); return *(unsigned long *)(regs->bp + sizeof(long));
#else #else
unsigned long *sp = (unsigned long *)regs->sp; unsigned long *sp = (unsigned long *)regs->sp;
/*
* Return address is either directly at stack pointer
* or above a saved flags. Eflags has bits 22-31 zero,
* kernel addresses don't.
*/
if (sp[0] >> 22) if (sp[0] >> 22)
return sp[0]; return sp[0];
if (sp[1] >> 22) if (sp[1] >> 22)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment