[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
re: 32-bit distribution for ultrasparc
On Sun, 17 Feb 2008, matthew green wrote:
> > the _LP64 define is set for 64 bit code.
> I wonder which we should use _LP64 or __arch64__.
> i think both are defined by sunpro as well?
> if only one is, we should use that one.
You should use __arch64__ for userland code and _LP64
for kernel code.
__arch64__ is the standard compiler definition to indicate
a 64-bit C language environment.
The kernel contains significant amounts of assembly language
code that needs to know whether it will be linked into a
32-bit or 64-bit environment. The assembler will generate
ELF64 or ELF32 object files based on the flags passed in,
but the C preprocessor is not direcly invoked by the assembler
so assembly code cannot rely on the definition of __arch64__.
Even when creating a 32-bit kernel we need to generate 64-bit
instructions, so you can't rely on __sparcv9__ as any
indicator of address width. Instead, _LP64 was created to
provide a consistent way to determine if the kernel is
being generated with a 32-bit or 64-bit address space.
_LP64 was being defined in the kernel makefiles. I don't
remember adding it to the standard gcc stabs files, so I
wouldn't try to rely on this in userland.
Obviously, linux code is borken since it uses __sparcv9__ to
distinguish 32-bit or 64-bit memory models, instead of the
specific supported instruction set.
Main Index |
Thread Index |