From: Blaisorblade <blaisorblade@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com>, linux-kernel@vger.kernel.org
Subject: Re: [uml-devel] [PATCH 3/8] UML - Fix missing x86_64 register definitions
Date: Sun, 1 Oct 2006 16:49:07 +0200 [thread overview]
Message-ID: <200610011649.08382.blaisorblade@yahoo.it> (raw)
In-Reply-To: <200609251834.k8PIYWLu005031@ccure.user-mode-linux.org>
On Monday 25 September 2006 20:34, Jeff Dike wrote:
> The UML/x86_64 headers were missing ptrace support for some segment
> registers. The underlying problem was that the x86_64 kernel uses
> user_regs_struct rather than the ptrace register definitions in ptrace.
> This patch switches UML/x86_64 to using user_regs_struct for its
> definitions of the host's registers.
> Signed-off-by: Jeff Dike <jdike@addtoit.com>
> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> ---
>
> arch/um/include/sysdep-x86_64/ptrace.h | 43 +++++++++++++++++++++--
> arch/um/include/sysdep-x86_64/sc.h | 2 -
> include/asm-um/ptrace-x86_64.h | 3 +
> 3 files changed, 44 insertions(+), 4 deletions(-)
>
> diff -puN
> arch/um/include/sysdep-x86_64/ptrace.h~uml-fix-missing-x86_64-register-defi
>nitions arch/um/include/sysdep-x86_64/ptrace.h ---
> a/arch/um/include/sysdep-x86_64/ptrace.h~uml-fix-missing-x86_64-register-de
>finitions +++ a/arch/um/include/sysdep-x86_64/ptrace.h
> @@ -50,6 +50,21 @@
> #define HOST_FS 25
> #define HOST_GS 26
>
> +/* Also defined in asm/ptrace-x86_64.h, but not in libc headers. So,
> these + * are already defined for kernel code, but not for userspace code.
> + */
> +#ifndef FS_BASE
> +/* These aren't defined in ptrace.h, but exist in struct user_regs_struct,
> + * which is what x86_64 ptrace actually uses.
> + */
> +#define FS_BASE (HOST_FS_BASE * sizeof(long))
> +#define GS_BASE (HOST_GS_BASE * sizeof(long))
> +#define DS (HOST_DS * sizeof(long))
> +#define ES (HOST_ES * sizeof(long))
> +#define FS (HOST_FS * sizeof(long))
> +#define GS (HOST_GS * sizeof(long))
> +#endif
> +
> #define REGS_FS_BASE(r) ((r)[HOST_FS_BASE])
> #define REGS_GS_BASE(r) ((r)[HOST_GS_BASE])
> #define REGS_DS(r) ((r)[HOST_DS])
> diff -puN
> include/asm-um/ptrace-x86_64.h~uml-fix-missing-x86_64-register-definitions
> include/asm-um/ptrace-x86_64.h ---
> a/include/asm-um/ptrace-x86_64.h~uml-fix-missing-x86_64-register-definition
>s +++ a/include/asm-um/ptrace-x86_64.h
> @@ -16,12 +16,15 @@
>
> #define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
>
> +/* Also defined in sysdep/ptrace.h, so may already be defined. */
> +#ifndef FS_BASE
> #define FS_BASE (21 * sizeof(unsigned long))
> #define GS_BASE (22 * sizeof(unsigned long))
> #define DS (23 * sizeof(unsigned long))
> #define ES (24 * sizeof(unsigned long))
> #define FS (25 * sizeof(unsigned long))
> #define GS (26 * sizeof(unsigned long))
> +#endif
>
> #define PT_REGS_RBX(r) UPT_RBX(&(r)->regs)
> #define PT_REGS_RCX(r) UPT_RCX(&(r)->regs)
The patch is ok for me, but frankly, this hunk could be further cleaned up -
there is an awful hardcoded duplication of code which could be removed (the
definition could be split away from <sysdep/ptrace.h> if inclusion order hell
starts).
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale!
http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2006-10-01 14:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-25 18:34 [uml-devel] [PATCH 3/8] UML - Fix missing x86_64 register definitions Jeff Dike
2006-10-01 14:49 ` Blaisorblade [this message]
2006-10-01 15:11 ` Jeff Dike
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=200610011649.08382.blaisorblade@yahoo.it \
--to=blaisorblade@yahoo.it \
--cc=jdike@addtoit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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