Skip to content

Commit

Permalink
x86: rename stack_pointer to kernel_trap_sp
Browse files Browse the repository at this point in the history
Choose a less generic name for such a special case.  Add
a comment explaining the odd use in X86_32.

Change the one user of stack_pointer.

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 dbe3533 commit f6e8e28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/x86/oprofile/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void
x86_backtrace(struct pt_regs * const regs, unsigned int depth)
{
struct frame_head *head = (struct frame_head *)frame_pointer(regs);
unsigned long stack = stack_pointer(regs);
unsigned long stack = kernel_trap_sp(regs);

if (!user_mode_vm(regs)) {
if (depth)
Expand Down
8 changes: 7 additions & 1 deletion include/asm-x86/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,13 @@ static inline int v8086_mode(struct pt_regs *regs)
#endif
}

static inline unsigned long stack_pointer(struct pt_regs *regs)
/*
* X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
* when it traps. So regs will be the current sp.
*
* This is valid only for kernel mode traps.
*/
static inline unsigned long kernel_trap_sp(struct pt_regs *regs)
{
#ifdef CONFIG_X86_32
return (unsigned long)regs;
Expand Down

0 comments on commit f6e8e28

Please sign in to comment.