qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Magdsick" <kmagnum@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts
Date: Mon, 25 Jun 2007 22:03:41 -0400	[thread overview]
Message-ID: <cd8ecdef0706251903v6b15eb44r6045452fe271bd13@mail.gmail.com> (raw)
In-Reply-To: <f43fc5580706251352p18b10d13ifac7b7b1fb9d52b6@mail.gmail.com>

Depends on if you're using the LP64 model (64-bit Linux, many other
*NIX) or the LLP64 model (Win64).

I guess Microsoft decided there was more code written for their system
that assumed longs were 32-bit than code that assumed pointers could
be stored in (unsigned) longs.  For 64-bit  MS Windows code, pointers
are 64-bit, longs are 32-bit, and long longs are 64-bit.

With proper support from the compiler, it's theoretically possible on
x86-64 systems to use 32-bit pointers in long mode (16 general purpose
64-bit registers).  (There's an instruction prefix that will cause the
CPU to perform 32-bit pointer calculations in the 64-bit address
space.) I'm not aware of any systems that use this, however.  (Getting
the speed boost from fewer register spills while not paying the space
cost of 64-bit pointers sounds very attractive in many applications,
though.)  I'm not sure if any of the C standards forbid longs being
larger than pointers.

There are even more strange beasts out there.  I think IBM AS/400 LIC
uses 128-bit pointers.  (The LIC code gets compiled to native code and
appended to the LIC binary the first time the LIC binary is run on a
new system, and IBM decided to build a lot of future compatibility
into LIC.)  I'm not sure how big longs are on those systems, but I
wouldn't be surprised if longs are 32-bits or 64-bits and pointers
128-bits.

In any case, I'm a big fan of using more descriptive types (such as
the C99 types) to express yourself more clearly for both the compiler
and for other coders.


Cheers,
-Karl

On 6/25/07, Blue Swirl <blauwirbel@gmail.com> wrote:
> On 6/25/07, Michal Schulz <michal.schulz@gmx.de> wrote:
[snip]
> > One from me, if you like... Just don't use the "unsigned long" type. The
> > intptr_t type would be better (it's 32-bit on 32-bit systems and 64-bit on
> > 64-bit systems).
>
> Nice, I didn't know about that. But how is this any different from
> unsigned long?

  parent reply	other threads:[~2007-06-26  2:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-25 20:16 [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts Blue Swirl
2007-06-25 20:26 ` Michal Schulz
2007-06-25 20:52   ` Blue Swirl
2007-06-25 21:08     ` Michal Schulz
2007-06-26  2:03     ` Karl Magdsick [this message]
2007-06-26  8:00       ` Thiemo Seufer
2007-06-26 13:54       ` Paul Brook
2007-06-27 10:26         ` Blue Swirl
2007-06-27 10:32           ` Julian Seward
2007-06-27 11:10             ` Thiemo Seufer
2007-06-27 11:20               ` Julian Seward
2007-06-27 12:18                 ` Marius Groeger
2007-06-27 12:32                   ` Thiemo Seufer
2007-07-06 19:20           ` Rob Landley
2007-06-29 14:26       ` Gwenole Beauchesne
2007-06-25 20:28 ` Thiemo Seufer
2007-06-25 20:53   ` Blue Swirl

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=cd8ecdef0706251903v6b15eb44r6045452fe271bd13@mail.gmail.com \
    --to=kmagnum@gmail.com \
    --cc=qemu-devel@nongnu.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).