linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Mayatskikh <v.mayatskih@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Vivek Goyal <vgoyal@redhat.com>,
	Randy Dunlap <rdunlap@xenotime.net>
Subject: [PATCH 1/5] x86: Introduce ELF_CORE_EXTRACT_REGS
Date: Wed,  2 Jun 2010 09:39:15 +0200	[thread overview]
Message-ID: <1275464359-1566-2-git-send-email-v.mayatskih@gmail.com> (raw)
In-Reply-To: <1275464359-1566-1-git-send-email-v.mayatskih@gmail.com>

There is macro ELF_CORE_COPY_REGS_COMMON, which packs registers into
elf_gregset_t. ELF_CORE_EXTRACT_REGS does contrary action: unpacks
elf_gregset_t.

Signed-off-by: Vitaly Mayatskikh <v.mayatskih@gmail.com>
---
 arch/x86/include/asm/elf.h |   46 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index f2ad216..5e3decb 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -144,6 +144,27 @@ do {						\
 	savesegment(gs, pr_reg[10]);		\
 } while (0);
 
+#define ELF_CORE_EXTRACT_REGS(pr_reg, regs)	\
+do {						\
+	(regs)->bx = (pr_reg)[0];		\
+	(regs)->cx = (pr_reg)[1];		\
+	(regs)->dx = (pr_reg)[2];		\
+	(regs)->si = (pr_reg)[3];		\
+	(regs)->di = (pr_reg)[4];		\
+	(regs)->bp = (pr_reg)[5];		\
+	(regs)->ax = (pr_reg)[6];		\
+	(regs)->ds = (pr_reg)[7];		\
+	(regs)->es = (pr_reg)[8];		\
+	(regs)->fs = (pr_reg)[9];		\
+	(regs)->gs = (pr_reg)[10];		\
+	(regs)->orig_ax = (pr_reg)[11];		\
+	(regs)->ip = (pr_reg)[12];		\
+	(regs)->cs = (pr_reg)[13];		\
+	(regs)->flags = (pr_reg)[14];		\
+	(regs)->sp = (pr_reg)[15];		\
+	(regs)->ss = (pr_reg)[16];		\
+} while (0);
+
 #define ELF_PLATFORM	(utsname()->machine)
 #define set_personality_64bit()	do { } while (0)
 
@@ -221,6 +242,31 @@ do {								\
 	asm("movl %%gs,%0" : "=r" (v)); (pr_reg)[26] = v;	\
 } while (0);
 
+#define ELF_CORE_EXTRACT_REGS(pr_reg, regs)			\
+do {								\
+	(regs)->r15 = (pr_reg)[0];			\
+	(regs)->r14 = (pr_reg)[1];				\
+	(regs)->r13 = (pr_reg)[2];				\
+	(regs)->r12 = (pr_reg)[3];				\
+	(regs)->bp  = (pr_reg)[4];				\
+	(regs)->bx  = (pr_reg)[5];				\
+	(regs)->r11 = (pr_reg)[6];				\
+	(regs)->r10 = (pr_reg)[7];				\
+	(regs)->r9  = (pr_reg)[8];				\
+	(regs)->r8  = (pr_reg)[9];				\
+	(regs)->ax  = (pr_reg)[10];				\
+	(regs)->cx  = (pr_reg)[11];				\
+	(regs)->dx  = (pr_reg)[12];				\
+	(regs)->si  = (pr_reg)[13];				\
+	(regs)->di  = (pr_reg)[14];				\
+	(regs)->orig_ax = (pr_reg)[15];				\
+	(regs)->ip  = (pr_reg)[16];				\
+	(regs)->cs  = (pr_reg)[17];				\
+	(regs)->flags = (pr_reg)[18];				\
+	(regs)->sp  = (pr_reg)[19];				\
+	(regs)->ss  = (pr_reg)[20];				\
+} while (0);
+
 /* I'm not sure if we can use '-' here */
 #define ELF_PLATFORM       ("x86_64")
 extern void set_personality_64bit(void);
-- 
1.7.1


  reply	other threads:[~2010-06-02  9:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-02  7:39 [PATCH 0/5] kdump: extract log buffer and registers from vmcore on NMI button pressing Vitaly Mayatskikh
2010-06-02  7:39 ` Vitaly Mayatskikh [this message]
2010-06-02  7:39 ` [PATCH 2/5] x86: Split __show_regs() Vitaly Mayatskikh
2010-06-02  9:50   ` Pekka Enberg
2010-06-02 10:00     ` Vitaly Mayatskikh
2010-06-02  7:39 ` [PATCH 3/5] vmcore: Introduce dump_old_log() Vitaly Mayatskikh
2010-06-02  7:39 ` [PATCH 4/5] x86: Add new callback for unhandled NMIs Vitaly Mayatskikh
2010-06-02  7:39 ` [PATCH 5/5] Document unknown_nmi_dump_log variable Vitaly Mayatskikh
2010-06-02 15:16 ` [PATCH 0/5] kdump: extract log buffer and registers from vmcore on NMI button pressing Vivek Goyal
2010-06-03  9:01   ` Vitaly Mayatskikh
2010-06-03  9:30     ` Andi Kleen
2010-06-03 12:33       ` Vitaly Mayatskikh
2010-06-03 15:13         ` Andi Kleen
2010-06-04  9:32           ` Vitaly Mayatskikh
2010-06-04 10:15             ` Andi Kleen
2010-06-04 13:58               ` Vitaly Mayatskikh
2010-06-04  9:49           ` Américo Wang
2010-06-04 10:16             ` Andi Kleen
2010-06-04 14:49             ` Vivek Goyal
2010-06-04 14:42     ` Vivek Goyal

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=1275464359-1566-2-git-send-email-v.mayatskih@gmail.com \
    --to=v.mayatskih@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rdunlap@xenotime.net \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).