xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Tim Deegan <tim@xen.org>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 2/3] xen/types: Correct the definition of uintptr_t
Date: Mon, 1 Aug 2016 17:08:01 +0100	[thread overview]
Message-ID: <9918b61f-6e19-bc9b-1bf6-4e6fa6166d3f@citrix.com> (raw)
In-Reply-To: <579F8C2D02000078001016D5@prv-mh.provo.novell.com>

On 01/08/16 16:51, Jan Beulich wrote:
>>>> On 01.08.16 at 15:14, <andrew.cooper3@citrix.com> wrote:
>> uintptr_t is specified as unsigned int in 32bit, not unsigned long.  This is
>> why, when copying inttypes.h from GCC, the use of PRIxPTR and similar is
>> broken for 32bit builds.
> I don't think this is strictly the case, i.e. doing it this way still ties
> us to internal workings of the compiler (as there is room for targets
> to customize base types used for derived ones). Could you try
> whether ...

This is the entire point I am trying to make that what we are doing is
currently unsafe if we are not using the header files to match the
compiler in use.

>
>> --- a/xen/include/xen/types.h
>> +++ b/xen/include/xen/types.h
>> @@ -59,7 +59,11 @@ typedef __u32 __be32;
>>  typedef __u64 __le64;
>>  typedef __u64 __be64;
>>  
>> +#if BITS_PER_LONG == 64
>>  typedef unsigned long uintptr_t;
>> +#elif BITS_PER_LONG == 32
>> +typedef unsigned int uintptr_t;
>> +#endif
> ...
>
> typedef unsigned int __attribute__((__mode__(__pointer__))) uintptr_t;
>
> works both ways (32- and 64-bit)?

It does appear to work.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-01 16:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01 13:14 [PATCH 1/3] xen/types: Alter typedef for bool_t Andrew Cooper
2016-08-01 13:14 ` [PATCH 2/3] xen/types: Correct the definition of uintptr_t Andrew Cooper
2016-08-01 15:51   ` Jan Beulich
2016-08-01 16:08     ` Andrew Cooper [this message]
2016-08-01 16:26       ` Jan Beulich
2016-08-01 16:34         ` [PATCH v2 " Andrew Cooper
2016-08-02  7:19           ` Jan Beulich
2016-08-01 13:14 ` [PATCH 3/3] xen/common: Sort the obj build order Andrew Cooper
2016-08-01 15:52   ` Jan Beulich
2016-08-01 15:44 ` [PATCH 1/3] xen/types: Alter typedef for bool_t Jan Beulich

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=9918b61f-6e19-bc9b-1bf6-4e6fa6166d3f@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /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).