Skip to content

Commit ef45128

Browse files
committed
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: Thomas Gleixner <tglx@linutronix.de>
1 parent 08047c4 commit ef45128

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

arch/x86/kernel/time_32.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,22 @@ unsigned long profile_pc(struct pt_regs *regs)
3434
{
3535
unsigned long pc = instruction_pointer(regs);
3636

37-
#ifdef CONFIG_SMP
3837
if (!user_mode_vm(regs) && in_lock_functions(pc)) {
3938
#ifdef CONFIG_FRAME_POINTER
4039
return *(unsigned long *)(regs->bp + sizeof(long));
4140
#else
42-
unsigned long *sp = (unsigned long *)&regs->sp;
43-
44-
/* Return address is either directly at stack pointer
45-
or above a saved flags. Eflags has bits 22-31 zero,
46-
kernel addresses don't. */
41+
unsigned long *sp = (unsigned long *)regs->sp;
42+
/*
43+
* Return address is either directly at stack pointer
44+
* or above a saved flags. Eflags has bits 22-31 zero,
45+
* kernel addresses don't.
46+
*/
4747
if (sp[0] >> 22)
4848
return sp[0];
4949
if (sp[1] >> 22)
5050
return sp[1];
5151
#endif
5252
}
53-
#endif
5453
return pc;
5554
}
5655
EXPORT_SYMBOL(profile_pc);

arch/x86/kernel/time_64.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ unsigned long profile_pc(struct pt_regs *regs)
3434
{
3535
unsigned long pc = instruction_pointer(regs);
3636

37-
/* Assume the lock function has either no stack frame or a copy
38-
of flags from PUSHF
39-
Eflags always has bits 22 and up cleared unlike kernel addresses. */
4037
if (!user_mode_vm(regs) && in_lock_functions(pc)) {
4138
#ifdef CONFIG_FRAME_POINTER
4239
return *(unsigned long *)(regs->bp + sizeof(long));
4340
#else
4441
unsigned long *sp = (unsigned long *)regs->sp;
42+
/*
43+
* Return address is either directly at stack pointer
44+
* or above a saved flags. Eflags has bits 22-31 zero,
45+
* kernel addresses don't.
46+
*/
4547
if (sp[0] >> 22)
4648
return sp[0];
4749
if (sp[1] >> 22)

0 commit comments

Comments
 (0)