Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: ac131313@redhat.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa/amd64] Zero fill 32-bit registers
Date: Sat, 28 Feb 2004 10:46:00 -0000	[thread overview]
Message-ID: <200402281046.i1SAkhhe000441@elgar.kettenis.dyndns.org> (raw)
In-Reply-To: <403E9BC3.2030807@redhat.com> (message from Andrew Cagney on Thu, 26 Feb 2004 20:22:11 -0500)

   Date: Thu, 26 Feb 2004 20:22:11 -0500
   From: Andrew Cagney <ac131313@redhat.com>

   Hello,

   For a 64-bit gregset, the code was only modifying the low 32-bits of the 
   register field - leaving the upper 64-bits undefined.

That's not completely unintentional.  The idea is to leave any
"reserved" bits untouched, and in a sense for 32-bit stuff the upper
32 bits are "reserved"; they are not necessarily zero, at least not
for all registers.

To prevent the upper 32 bits being "undefined", typical usage of these
functions is:

      ptrace (PT_GETREGS, ..., &regs, 0);

      amd64_collect_native_gregset (current_regcache, &regs, regnum);

      ptrace (PT_SETREGS, ..., &regs, 0);

   This, among other things, would lead to mysterious 32-bit thread
   failures.

I guess the thread code isn't doing the equivalent of the PT_GETREGS
call.  I think the correct way to fix this is to make sure the buffer
is properly initialized before you pass it to
amd64_collect_native_gregset.

Another problem with your patch is that I'd rather like avoid assuming
that the register buffer is an array of 8-byte registers.

Mark


  reply	other threads:[~2004-02-28 10:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-27  1:22 Andrew Cagney
2004-02-28 10:46 ` Mark Kettenis [this message]
2004-02-28 15:17   ` Andrew Cagney
2004-02-28 17:35     ` Mark Kettenis
2004-02-28 19:18       ` Andrew Cagney
2004-02-28 20:26         ` Mark Kettenis
2004-02-28 20:40           ` Andrew Cagney
2004-02-28 21:56             ` [PATCH] " Mark Kettenis
2004-02-29 23:11               ` Andrew Cagney
2004-02-29 23:45                 ` Mark Kettenis
2004-03-02 16:10                   ` Andrew Cagney
2004-03-19  0:09                     ` Andrew Cagney

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=200402281046.i1SAkhhe000441@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=ac131313@redhat.com \
    --cc=gdb-patches@sources.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