From: Harvey Harrison <harvey.harrison@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Roland McGrath <roland@redhat.com>, Ingo Molnar <mingo@elte.hu>,
LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH] x86: Rename stack_pointer to kernel_trap_sp
Date: Thu, 17 Jan 2008 20:28:49 -0800 [thread overview]
Message-ID: <1200630529.5724.116.camel@brick> (raw)
In-Reply-To: <47901E89.4060001@zytor.com>
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>
---
arch/x86/oprofile/backtrace.c | 2 +-
include/asm-x86/ptrace.h | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index 0ca4815..e2095cb 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -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)
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h
index 79d5b8f..d9e04b4 100644
--- a/include/asm-x86/ptrace.h
+++ b/include/asm-x86/ptrace.h
@@ -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;
--
1.5.4.rc2.1164.g6451
next prev parent reply other threads:[~2008-01-18 4:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-17 23:04 [PATCH] x86: Use v8086_mode helper, trivial unification Harvey Harrison
2008-01-17 23:02 ` H. Peter Anvin
2008-01-17 23:26 ` Harvey Harrison
2008-01-18 0:59 ` H. Peter Anvin
2008-01-18 1:14 ` Harvey Harrison
2008-01-18 1:14 ` H. Peter Anvin
2008-01-18 1:23 ` Harvey Harrison
2008-01-18 1:15 ` Harvey Harrison
2008-01-18 1:37 ` Roland McGrath
2008-01-18 1:36 ` H. Peter Anvin
2008-01-18 2:02 ` Harvey Harrison
2008-01-18 2:21 ` Harvey Harrison
2008-01-18 3:35 ` H. Peter Anvin
2008-01-18 4:28 ` Harvey Harrison [this message]
2008-01-18 9:07 ` [PATCH] x86: Rename stack_pointer to kernel_trap_sp Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1200630529.5724.116.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox