lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed,  2 Jun 2010 09:39:15 +0200
From:	Vitaly Mayatskikh <v.mayatskih@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, Vivek Goyal <vgoyal@...hat.com>,
	Randy Dunlap <rdunlap@...otime.net>
Subject: [PATCH 1/5] x86: Introduce ELF_CORE_EXTRACT_REGS

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@...il.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ