Author Topic: 64-bit program, location of data  (Read 6384 times)

Offline yuma

  • Jr. Member
  • *
  • Posts: 2
64-bit program, location of data
« on: May 06, 2013, 08:22:17 PM »
I have an old 32-bit program that I'm trying to get working under 64-bit. This program is mixed C/assembly and declares a lot of data on the assembly side.

The code accesses this data using it's labels, and this seems to get translated into instructions that use a 32-bit absolute address as a displacement. I'm not as familiar with x86 assembly as others, but 32-bit displacements seem to be the biggest available. This seems to work fine as long as the data lives below the 4GiB mark. My question is, what exactly is preventing this data from being allocated above 4GiB? Is there some guarantee that this data will always be under the 4GiB mark, or will this program fail to build on another machine if/when this data is allocated above 4GiB?

This is on Linux by the way.

Offline yuma

  • Jr. Member
  • *
  • Posts: 2
Re: 64-bit program, location of data
« Reply #1 on: May 07, 2013, 01:08:02 AM »
Found the answer to my own question I think. The AMD64 ABI seems to define some memory models and most of them guarantee data below 2GiB or so.