Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Walfred Tedeschi <walfred.tedeschi@intel.com>
Cc: eliz@gnu.org, gdb-patches@sourceware.org
Subject: Re: [PATCH V3 1/2] ABI changes for MPX.
Date: Sun, 07 Feb 2016 06:29:00 -0000	[thread overview]
Message-ID: <20160207062903.GA15342@adacore.com> (raw)
In-Reply-To: <1452688799-15633-2-git-send-email-walfred.tedeschi@intel.com>

Walfred,

On Wed, Jan 13, 2016 at 01:39:58PM +0100, Walfred Tedeschi wrote:
> Code reflects what is presented in the ABI document:
> https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI
> Here new class POINTER was added.  GDB code is modified to mirror
> this new class. (page 134)
> 
> In addition to that set bound registers to INIT state (access to
> all memory) before performing the inferior function call.
> 
> 2016-01-13  Walfred Tedeschi  <walfred.tedeschi@intel.com>
> 
> 	* amd64-tdep.c (amd64_reg_class): Add new class AMD64_POINTER.
> 	(amd64_merge_classes): Add AMD64_POINTER to merging classes rules.
> 	(amd64_classify): Add AMD64_POINTER.
> 	(amd64_return_value): Add AMD64_POINTER.
> 	(amd64_push_arguments): Add new AMD64_POINTER class.
> 	(amd64_push_dummy_call): Set bound registers to INIT state before
> 	performing the call.

I think you need to update the following piece of code as well (in
amd64_push_arguments):

      /* Calculate the number of integer and SSE registers needed for
         this argument.  */
      for (j = 0; j < 2; j++)
        {
          if (theclass[j] == AMD64_INTEGER)
            needed_integer_regs++;

Otherwise, you'll have a discrepancy between needed_integer_regs
and integer_reg.

As far as I understand, POINTER and INTEGER arguments are passed
exactly the same way. The distinction appears to only be useful
for bound register handling. And since this patch unilaterally
sets the bound registers to zero, we could have done it without
adding the extra register classification (and thus reducing
the maintenance cost of having to handle both). I'm really tempted
to suggest we drop the new class altogether, avoiding the risk
of having missed another spot where we needd to add POINTER class
handling, and just keep the change which sets the bound registers
to zero. If, one day, someone decides to enhance the debugger
to handle the bound registers more closely to what the ABI suggests,
I think we could have a separate function that would tell us if
a given type is of class POINTER or not, rather than adding a class.

Am I understanding the situation correctly?

> gdb/doc/ChangeLog:
> 
> 	* gdb.texinfo (Intel Memory Protection Extension): Add entry for
> 	inferior function calls for MPX.


> @@ -693,6 +701,7 @@ amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
>      amd64_classify_aggregate (type, theclass);
>  }
>  
> +
>  static enum return_value_convention
>  amd64_return_value (struct gdbarch *gdbarch, struct value *function,
>  		    struct type *type, struct regcache *regcache,

There is no reason to add a new line, here, so let's avoid this
unnecessary change.

-- 
Joel


      parent reply	other threads:[~2016-02-07  6:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13 12:40 [PATCH V3 0/2] MPX ABI adaptations Walfred Tedeschi
2016-01-13 12:40 ` [PATCH V3 2/2] Add mpx-bnd-init-on-return set/show command for inferior calls Walfred Tedeschi
2016-01-13 16:09   ` Eli Zaretskii
2016-01-13 16:12     ` Tedeschi, Walfred
2016-02-02 16:47   ` Tedeschi, Walfred
2016-02-07  7:06   ` Joel Brobecker
2016-02-08 12:55     ` Walfred Tedeschi
2016-01-13 12:40 ` [PATCH V3 1/2] ABI changes for MPX Walfred Tedeschi
2016-01-13 15:59   ` Eli Zaretskii
2016-02-07  6:29   ` Joel Brobecker [this message]

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=20160207062903.GA15342@adacore.com \
    --to=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=walfred.tedeschi@intel.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