8.1.2 x86 64-bit processors
AMD has enhanced the 32-bit x86 instruction set to a 64-bit instruction
set called x86-64, which is implemented in their AMD64
processors.(24) On AMD64 systems
GCC generates 64-bit code by default. The option -m32
allows
32-bit code to be generated instead.
The AMD64 processor has several different memory models for programs
running in 64-bit mode. The default model is the small code model,
which allows code and data up to 2GB in size. The medium code
model allows unlimited data sizes and can be selected with
-mcmodel=medium
. There is also a large code model, which
supports an unlimited code size in addition to unlimited data size. It
is not currently implemented in GCC since the medium code model is
sufficient for all practical purposes--executables with sizes greater
than 2GB are not encountered in practice.
A special kernel code model -mcmodel=kernel
is provided for
system-level code, such as the Linux kernel. An important point to note
is that by default on the AMD64 there is a 128-byte area of memory
allocated below the stack pointer for temporary data, referred to as the
"red-zone", which is not supported by the Linux kernel. Compilation
of the Linux kernel on the AMD64 requires the options
-mcmodel=kernel -mno-red-zone
.