| Main index | Section 7 | Options |
If not explicitly mentioned, sizes are in bytes. The architecture details in this document apply to FreeBSD 13.0 and later, unless otherwise noted.
FreeBSD uses a flat address space. Variables of types unsigned long, uintptr_t, and size_t and pointers all have the same representation.
In order to maximize compatibility with future pointer integrity mechanisms, manipulations of pointers as integers should be performed via uintptr_t or intptr_t and no other types. In particular, long and ptrdiff_t should be avoided.
On some architectures, e.g., powerpc and AIM variants of powerpc64, the kernel uses a separate address space. On other architectures, kernel and a user mode process share a single address space. The kernel is located at the highest addresses.
On each architecture, the main user mode thread's stack starts near the highest user address and grows down.
FreeBSD architecture support varies by release. This table shows currently supported CPU architectures along with the first FreeBSD release to support each architecture.
| Architecture | Initial Release |
aarch64 | 11.0 |
amd64 | 5.1 |
armv6 | 10.0 |
armv7 | 12.0 |
i386 | 1.0 |
powerpc | 6.0 |
powerpcspe | 12.0 |
powerpc64 | 9.0 |
powerpc64le | 13.0 |
riscv64 | 12.0 |
Discontinued architectures are shown in the following table.
| Architecture | Initial Release | Final Release |
alpha | 3.2 | 6.4 |
arm | 6.0 | 12.4 |
armeb | 8.0 | 11.4 |
ia64 | 5.0 | 10.4 |
mips | 8.0 | 13.x |
mipsel | 9.0 | 13.x |
mipselhf | 12.0 | 13.x |
mipshf | 12.0 | 13.x |
mipsn32 | 9.0 | 13.x |
mips64 | 9.0 | 13.x |
mips64el | 9.0 | 13.x |
mips64elhf | 12.0 | 13.x |
mips64hf | 12.0 | 13.x |
pc98 | 2.2 | 11.4 |
riscv64sf | 12.0 | 13.x |
sparc64 | 5.0 | 12.4 |
| ILP32 | int, long, void * types machine representations all have 4-byte size. |
| LP64 | int type machine representation uses 4 bytes, while long and void * are 8 bytes. |
Some machines support more than one FreeBSD ABI. Typically these are 64-bit machines, where the "native" LP64 execution environment is accompanied by the "legacy" ILP32 environment, which was the historical 32-bit predecessor for 64-bit evolution. Examples are:
| LP64 | ILP32 counterpart |
| amd64 | i386 |
| powerpc64 | powerpc |
| aarch64 | armv6/armv7 |
aarch64 will support execution of armv6 or armv7 binaries if the CPU implements AArch32 execution state, however older armv4 and armv5 binaries aren't supported.
On all supported architectures:
| Type | Size |
short | 2 |
int | 4 |
long | sizeof(void*) |
long long | 8 |
float | 4 |
double | 8 |
Integers are represented in two's complement. Alignment of integer and pointer types is natural, that is, the address of the variable must be congruent to zero modulo the type size. Most ILP32 ABIs, except arm, require only 4-byte alignment for 64-bit integers.
Machine-dependent type sizes:
| Architecture | void * | long double | time_t |
aarch64 | 8 | 16 | 8 |
amd64 | 8 | 16 | 8 |
armv6 | 4 | 8 | 8 |
armv7 | 4 | 8 | 8 |
i386 | 4 | 12 | 4 |
powerpc | 4 | 8 | 8 |
powerpcspe | 4 | 8 | 8 |
powerpc64 | 8 | 8 | 8 |
powerpc64le | 8 | 8 | 8 |
riscv64 | 8 | 16 | 8 |
time_t is 8 bytes on all supported architectures except i386.
| Architecture | Endianness | char Signedness |
aarch64 | little | unsigned |
amd64 | little | signed |
armv6 | little | unsigned |
armv7 | little | unsigned |
i386 | little | signed |
powerpc | big | unsigned |
powerpcspe | big | unsigned |
powerpc64 | big | unsigned |
powerpc64le | little | unsigned |
riscv64 | little | signed |
| Architecture | Page Sizes |
aarch64 | 4K, 2M, 1G |
amd64 | 4K, 2M, 1G |
armv6 | 4K, 1M |
armv7 | 4K, 1M |
i386 | 4K, 2M (PAE), 4M |
powerpc | 4K |
powerpcspe | 4K |
powerpc64 | 4K |
powerpc64le | 4K |
riscv64 | 4K, 2M, 1G |
| Architecture | float, double | long double |
aarch64 | hard | soft, quad precision |
amd64 | hard | hard, 80 bit |
armv6 | hard | hard, double precision |
armv7 | hard | hard, double precision |
i386 | hard | hard, 80 bit |
powerpc | hard | hard, double precision |
powerpcspe | hard | hard, double precision |
powerpc64 | hard | hard, double precision |
powerpc64le | hard | hard, double precision |
riscv64 | hard | hard, quad precision |
| MACHINE | MACHINE_CPUARCH | MACHINE_ARCH |
arm64 | aarch64 | aarch64 |
amd64 | amd64 | amd64 |
arm | arm | armv6, armv7 |
i386 | i386 | i386 |
powerpc | powerpc | powerpc, powerpcspe, powerpc64, powerpc64le |
riscv | riscv | riscv64 |
The full set of predefined macros can be obtained with this command:
cc -x c -dM -E /dev/null
Common type size and endianness macros:
| Macro | Meaning |
| __LP64__ | 64-bit (8-byte) long and pointer, 32-bit (4-byte) int |
| __ILP32__ | 32-bit (4-byte) int, long and pointer |
| BYTE_ORDER | Either BIG_ENDIAN or LITTLE_ENDIAN. PDP11_ENDIAN is not used on FreeBSD . |
Architecture-specific macros:
| Architecture | Predefined macros |
aarch64 | __aarch64__ |
amd64 | __amd64__, __x86_64__ |
armv6 | __arm__, __ARM_ARCH >= 6 |
armv7 | __arm__, __ARM_ARCH >= 7 |
i386 | __i386__ |
powerpc | __powerpc__ |
powerpcspe | __powerpc__, __SPE__ |
powerpc64 | __powerpc__, __powerpc64__ |
powerpc64le | __powerpc__, __powerpc64__ |
riscv64 | __riscv, __riscv_xlen == 64 |
Compilers may define additional variants of architecture-specific macros. The macros above are preferred for use in FreeBSD .
| MACHINE |
Represents the hardware platform.
This is the same as the native platform's
uname(1)
|
| MACHINE_ARCH |
Represents the CPU processor architecture.
This is the same as the native platforms
uname(1)
|
| MACHINE_CPUARCH | |
| Represents the source location for a given MACHINE_ARCH. It is generally the common prefix for all the MACHINE_ARCH that share the same implementation, though 'riscv' breaks this rule. While amd64 and i386 are closely related, MACHINE_CPUARCH is not x86 for them. The FreeBSD source base supports amd64 and i386 with two distinct source bases living in subdirectories named amd64 and i386 (though behind the scenes there's some sharing that fits into this framework). | |
| CPUTYPE | Sets the flavor of MACHINE_ARCH to build. It is used to optimize the build for a specific CPU / core that the binaries run on. Generally, this does not change the ABI, though it can be a fine line between optimization for specific cases. |
| TARGET | Used to set MACHINE in the top level Makefile for cross building. Unused outside of that scope. It is not passed down to the rest of the build. Makefiles outside of the top level should not use it at all (though some have their own private copy for hysterical raisons). |
| TARGET_ARCH | Used to set MACHINE_ARCH by the top level Makefile for cross building. Like TARGET, it is unused outside of that scope. |
| ARCH (7) | February 4, 2025 |
| Main index | Section 7 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Our grievance is not just against Unix itself, but against the cult of Unix zealots who defend and nurture it. They take the heat, disease, and pestilence as givens, and, as ancient shamans did, display their wounds, some self-inflicted, as proof of their power and wizardry. We aim, through bluntness and humor, to show them that they pray to a tin god, and that science, not religion, is the path to useful and friendly technology. | ” |
| — The Unix Haters' handbook | ||