x86: set bp field in pt_regs properly

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, October 13, 2008 - 11:07 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=097a07...
Commit:     097a0788df71b0f3328c70ab5f4e41c27ee66817
Parent:     2c44e66843cd50c5ef4f4271fbd63a4f4bf4d083
Author:     Glauber Costa <gcosta@redhat.com>
AuthorDate: Thu Aug 14 17:33:12 2008 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon Oct 13 10:21:27 2008 +0200

    x86: set bp field in pt_regs properly
    
    Save rbp twice: One is for marking the stack frame, as usual (already
    there), and the other, to fill pt_regs properly. This is because bx
    comes right before the last saved register in that structure, and not
    bp. If the base pointer were in the place bx is today, this would not
    be needed.
    
    Signed-off-by: Glauber Costa <gcosta@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/entry_64.S |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index cf3a0b2..25bb3f9 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -667,6 +667,13 @@ END(stub_rt_sigreturn)
 	SAVE_ARGS
 	leaq -ARGOFFSET(%rsp),%rdi	# arg1 for handler
 	pushq %rbp
+	/*
+	 * Save rbp twice: One is for marking the stack frame, as usual, and the
+	 * other, to fill pt_regs properly. This is because bx comes right
+	 * before the last saved register in that structure, and not bp. If the
+	 * base pointer were in the place bx is today, this would not be needed.
+	 */
+	movq %rbp, -8(%rsp)
 	CFI_ADJUST_CFA_OFFSET	8
 	CFI_REL_OFFSET		rbp, 0
 	movq %rsp,%rbp
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
x86: set bp field in pt_regs properly, Linux Kernel Mailing ..., (Mon Oct 13, 11:07 am)