2017-05-05 17:23:57 +00:00
|
|
|
.\" Copyright (c) 2016-2017 The FreeBSD Foundation. All rights reserved.
|
2016-07-19 17:46:09 +00:00
|
|
|
.\"
|
|
|
|
.\" This documentation was created by Ed Maste under sponsorship of
|
|
|
|
.\" The FreeBSD Foundation.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2018-07-23 19:39:20 +00:00
|
|
|
.Dd July 23, 2018
|
2016-07-19 17:46:09 +00:00
|
|
|
.Dt ARCH 7
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm arch
|
|
|
|
.Nd Architecture-specific details
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
Differences between CPU architectures and platforms supported by
|
|
|
|
.Fx .
|
2017-05-04 21:31:50 +00:00
|
|
|
.Ss Introduction
|
2017-05-05 18:21:33 +00:00
|
|
|
This document is a quick reference of key ABI details of
|
|
|
|
.Fx
|
|
|
|
architecture ports.
|
|
|
|
For full details consult the processor-specific ABI supplement
|
|
|
|
documentation.
|
|
|
|
.Pp
|
2017-05-04 11:57:52 +00:00
|
|
|
If not explicitly mentioned, sizes are in bytes.
|
2017-05-05 16:40:45 +00:00
|
|
|
The architecture details in this document apply to
|
|
|
|
.Fx 10.0
|
|
|
|
and later, unless otherwise noted.
|
2017-05-04 21:31:50 +00:00
|
|
|
.Pp
|
2017-05-05 17:23:57 +00:00
|
|
|
.Fx
|
2017-05-05 18:36:41 +00:00
|
|
|
uses a flat address space.
|
|
|
|
Variables of types
|
2017-05-05 17:23:57 +00:00
|
|
|
.Vt unsigned long ,
|
|
|
|
.Vt uintptr_t ,
|
2017-05-04 21:31:50 +00:00
|
|
|
and
|
|
|
|
.Vt size_t
|
2017-05-05 18:36:41 +00:00
|
|
|
and pointers all have the same representation.
|
2017-05-04 21:31:50 +00:00
|
|
|
.Pp
|
|
|
|
In order to maximize compatibility with future pointer integrity mechanisms,
|
|
|
|
manipulations of pointers as integers should be performed via
|
|
|
|
.Vt uintptr_t
|
|
|
|
or
|
|
|
|
.Vt intptr_t
|
|
|
|
and no other types.
|
|
|
|
In particular,
|
|
|
|
.Vt long
|
|
|
|
and
|
|
|
|
.Vt ptrdiff_t
|
|
|
|
should be avoided.
|
|
|
|
.Pp
|
2017-11-15 23:51:17 +00:00
|
|
|
On some architectures, e.g.,
|
2017-05-04 21:31:50 +00:00
|
|
|
.Dv sparc64 ,
|
|
|
|
.Dv powerpc
|
|
|
|
and AIM variants of
|
|
|
|
.Dv 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.
|
|
|
|
.Pp
|
|
|
|
On each architecture, the main user mode thread's stack starts near
|
|
|
|
the highest user address and grows down.
|
2017-05-05 16:40:45 +00:00
|
|
|
.Pp
|
|
|
|
.Fx
|
|
|
|
architecture support varies by release.
|
|
|
|
This table shows the first
|
|
|
|
.Fx
|
|
|
|
release to support each architecture, and, for discontinued
|
|
|
|
architectures, the final release.
|
|
|
|
.Pp
|
|
|
|
.Bl -column -offset indent "Sy Architecture" "Sy Initial Release" "Sy Final Release"
|
|
|
|
.It Sy Architecture Ta Sy Initial Release Ta Sy Final Release
|
2017-05-16 23:15:40 +00:00
|
|
|
.It alpha Ta 3.2 Ta 6.4
|
2017-05-05 16:40:45 +00:00
|
|
|
.It amd64 Ta 5.1
|
|
|
|
.It arm Ta 6.0
|
2018-07-23 21:09:57 +00:00
|
|
|
.It armeb Ta 8.0 Ta 11.x
|
2017-05-05 16:40:45 +00:00
|
|
|
.It armv6 Ta 10.0
|
2018-01-31 23:16:19 +00:00
|
|
|
.It armv7 Ta 12.0
|
2017-05-05 16:40:45 +00:00
|
|
|
.It arm64 Ta 11.0
|
|
|
|
.It ia64 Ta 5.0 Ta 10.x
|
|
|
|
.It i386 Ta 1.0
|
|
|
|
.It mips Ta 8.0
|
|
|
|
.It mipsel Ta 9.0
|
|
|
|
.It mipselhf Ta 12.0
|
|
|
|
.It mipshf Ta 12.0
|
|
|
|
.It mipsn32 Ta 9.0
|
|
|
|
.It mips64 Ta 9.0
|
|
|
|
.It mips64el Ta 9.0
|
|
|
|
.It mips64elhf Ta 12.0
|
|
|
|
.It mips64hf Ta 12.0
|
2017-05-08 14:17:10 +00:00
|
|
|
.It pc98 Ta 2.2 Ta 11.x
|
2017-05-05 16:40:45 +00:00
|
|
|
.It powerpc Ta 6.0
|
|
|
|
.It powerpcspe Ta 12.0
|
|
|
|
.It powerpc64 Ta 6.0
|
|
|
|
.It riscv64 Ta 12.0
|
|
|
|
.It riscv64sf Ta 12.0
|
|
|
|
.It sparc64 Ta 5.0
|
|
|
|
.El
|
2016-07-19 17:46:09 +00:00
|
|
|
.Ss Type sizes
|
2017-05-05 17:23:57 +00:00
|
|
|
All
|
|
|
|
.Fx
|
|
|
|
architectures use some variant of the ELF (see
|
2017-05-04 21:31:50 +00:00
|
|
|
.Xr elf 5 )
|
|
|
|
.Sy Application Binary Interface
|
|
|
|
(ABI) for the machine processor.
|
|
|
|
All supported ABIs can be divided into two groups:
|
|
|
|
.Bl -tag -width "Dv ILP32"
|
|
|
|
.It Dv ILP32
|
|
|
|
.Vt int ,
|
|
|
|
.Vt long ,
|
|
|
|
.Vt void *
|
|
|
|
types machine representations all have 4-byte size.
|
|
|
|
.It Dv LP64
|
|
|
|
.Vt int
|
|
|
|
type machine representation uses 4 bytes,
|
|
|
|
while
|
|
|
|
.Vt long
|
|
|
|
and
|
|
|
|
.Vt void *
|
|
|
|
are 8 bytes.
|
|
|
|
.El
|
2017-05-05 17:23:57 +00:00
|
|
|
Compilers define the
|
2017-05-04 21:31:50 +00:00
|
|
|
.Dv _LP64
|
|
|
|
symbol when compiling for an
|
|
|
|
.Dv LP64
|
|
|
|
ABI.
|
|
|
|
.Pp
|
2017-05-05 17:23:57 +00:00
|
|
|
Some machines support more that one
|
|
|
|
.Fx
|
|
|
|
ABI.
|
2017-05-04 21:31:50 +00:00
|
|
|
Typically these are 64-bit machines, where the
|
|
|
|
.Dq native
|
|
|
|
.Dv LP64
|
|
|
|
execution environment is accompanied by the
|
|
|
|
.Dq legacy
|
|
|
|
.Dv ILP32
|
|
|
|
environment, which was historical 32-bit predecessor for 64-bit evolution.
|
|
|
|
Examples are:
|
2017-05-05 17:23:57 +00:00
|
|
|
.Bl -column -offset indent "Dv powerpc64" "Sy ILP32 counterpart"
|
2017-05-04 21:31:50 +00:00
|
|
|
.It Sy LP64 Ta Sy ILP32 counterpart
|
|
|
|
.It Dv amd64 Ta Dv i386
|
|
|
|
.It Dv powerpc64 Ta Dv powerpc
|
|
|
|
.It Dv mips64* Ta Dv mips*
|
|
|
|
.El
|
|
|
|
.Dv arm64
|
|
|
|
currently does not support execution of
|
|
|
|
.Dv armv6
|
2018-01-31 23:16:19 +00:00
|
|
|
or
|
|
|
|
.Dv armv7
|
2017-05-04 21:31:50 +00:00
|
|
|
binaries, even if the CPU implements
|
|
|
|
.Dv AArch32
|
|
|
|
execution state.
|
|
|
|
.Pp
|
2017-05-04 11:57:52 +00:00
|
|
|
On all supported architectures:
|
2016-07-19 17:46:09 +00:00
|
|
|
.Bl -column -offset -indent "long long" "Size"
|
|
|
|
.It Sy Type Ta Sy Size
|
|
|
|
.It short Ta 2
|
|
|
|
.It int Ta 4
|
|
|
|
.It long Ta sizeof(void*)
|
|
|
|
.It long long Ta 8
|
|
|
|
.It float Ta 4
|
|
|
|
.It double Ta 8
|
|
|
|
.El
|
2017-05-05 18:36:41 +00:00
|
|
|
Integers are represented in two's complement.
|
2017-05-04 21:31:50 +00:00
|
|
|
Alignment of integer and pointer types is natural, that is,
|
2017-05-05 17:23:57 +00:00
|
|
|
the address of the variable must be congruent to zero modulo the type size.
|
|
|
|
Most ILP32 ABIs, except
|
|
|
|
.Dv arm ,
|
|
|
|
require only 4-byte alignment for 64-bit integers.
|
2017-05-04 11:57:52 +00:00
|
|
|
.Pp
|
|
|
|
Machine-dependent type sizes:
|
|
|
|
.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t"
|
|
|
|
.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
|
2017-05-02 14:52:35 +00:00
|
|
|
.It amd64 Ta 8 Ta 16 Ta 8
|
|
|
|
.It arm Ta 4 Ta 8 Ta 8
|
|
|
|
.It armv6 Ta 4 Ta 8 Ta 8
|
|
|
|
.It arm64 Ta 8 Ta 16 Ta 8
|
|
|
|
.It i386 Ta 4 Ta 12 Ta 4
|
|
|
|
.It mips Ta 4 Ta 8 Ta 8
|
|
|
|
.It mipsel Ta 4 Ta 8 Ta 8
|
|
|
|
.It mipselhf Ta 4 Ta 8 Ta 8
|
|
|
|
.It mipshf Ta 4 Ta 8 Ta 8
|
|
|
|
.It mipsn32 Ta 4 Ta 8 Ta 8
|
|
|
|
.It mips64 Ta 8 Ta 8 Ta 8
|
|
|
|
.It mips64el Ta 8 Ta 8 Ta 8
|
|
|
|
.It mips64elhf Ta 8 Ta 8 Ta 8
|
|
|
|
.It mips64hf Ta 8 Ta 8 Ta 8
|
2017-06-26 02:25:19 +00:00
|
|
|
.It powerpc Ta 4 Ta 8 Ta 8
|
|
|
|
.It powerpcspe Ta 4 Ta 8 Ta 8
|
2017-05-02 14:52:35 +00:00
|
|
|
.It powerpc64 Ta 8 Ta 8 Ta 8
|
2017-05-03 16:55:02 +00:00
|
|
|
.It riscv64 Ta 8 Ta 16 Ta 8
|
|
|
|
.It riscv64sf Ta 8 Ta 16 Ta 8
|
2017-05-02 14:52:35 +00:00
|
|
|
.It sparc64 Ta 8 Ta 16 Ta 8
|
2016-07-19 17:46:09 +00:00
|
|
|
.El
|
2017-05-04 11:57:52 +00:00
|
|
|
.Pp
|
|
|
|
.Sy time_t
|
2017-10-04 14:39:55 +00:00
|
|
|
is 8 bytes on all supported architectures except i386.
|
2016-07-19 17:46:09 +00:00
|
|
|
.Ss Endianness and Char Signedness
|
2016-07-21 16:58:53 +00:00
|
|
|
.Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char Signedness"
|
2016-07-19 17:46:09 +00:00
|
|
|
.It Sy Architecture Ta Sy Endianness Ta Sy char Signedness
|
|
|
|
.It amd64 Ta little Ta signed
|
|
|
|
.It arm Ta little Ta unsigned
|
|
|
|
.It armv6 Ta little Ta unsigned
|
2018-01-31 23:16:19 +00:00
|
|
|
.It armv7 Ta little Ta unsigned
|
2016-07-19 17:46:09 +00:00
|
|
|
.It arm64 Ta little Ta unsigned
|
|
|
|
.It i386 Ta little Ta signed
|
2016-07-19 20:11:50 +00:00
|
|
|
.It mips Ta big Ta signed
|
|
|
|
.It mipsel Ta little Ta signed
|
2016-10-31 15:33:58 +00:00
|
|
|
.It mipselhf Ta little Ta signed
|
|
|
|
.It mipshf Ta big Ta signed
|
2016-07-19 20:11:50 +00:00
|
|
|
.It mipsn32 Ta big Ta signed
|
|
|
|
.It mips64 Ta big Ta signed
|
2016-07-19 17:46:09 +00:00
|
|
|
.It mips64el Ta little Ta signed
|
2016-10-31 15:33:58 +00:00
|
|
|
.It mips64elhf Ta little Ta signed
|
|
|
|
.It mips64hf Ta big Ta signed
|
2016-07-19 17:46:09 +00:00
|
|
|
.It powerpc Ta big Ta unsigned
|
2017-05-02 21:33:27 +00:00
|
|
|
.It powerpcspe Ta big Ta unsigned
|
2016-07-19 17:46:09 +00:00
|
|
|
.It powerpc64 Ta big Ta unsigned
|
2017-05-03 16:55:02 +00:00
|
|
|
.It riscv64 Ta little Ta signed
|
|
|
|
.It riscv64sf Ta little Ta signed
|
2016-07-19 17:46:09 +00:00
|
|
|
.It sparc64 Ta big Ta signed
|
|
|
|
.El
|
|
|
|
.Ss Page Size
|
2016-07-21 09:37:17 +00:00
|
|
|
.Bl -column -offset indent "Sy Architecture" "Sy Page Sizes"
|
2016-07-19 17:46:09 +00:00
|
|
|
.It Sy Architecture Ta Sy Page Sizes
|
|
|
|
.It amd64 Ta 4K, 2M, 1G
|
|
|
|
.It arm Ta 4K
|
2016-07-19 19:50:30 +00:00
|
|
|
.It armv6 Ta 4K, 1M
|
2018-01-31 23:16:19 +00:00
|
|
|
.It armv7 Ta 4K, 1M
|
2016-07-19 17:46:09 +00:00
|
|
|
.It arm64 Ta 4K, 2M, 1G
|
|
|
|
.It i386 Ta 4K, 2M (PAE), 4M
|
|
|
|
.It mips Ta 4K
|
|
|
|
.It mipsel Ta 4K
|
2016-10-31 15:33:58 +00:00
|
|
|
.It mipselhf Ta 4K
|
|
|
|
.It mipshf Ta 4K
|
2016-07-19 17:46:09 +00:00
|
|
|
.It mipsn32 Ta 4K
|
|
|
|
.It mips64 Ta 4K
|
|
|
|
.It mips64el Ta 4K
|
2016-10-31 15:33:58 +00:00
|
|
|
.It mips64elhf Ta 4K
|
|
|
|
.It mips64hf Ta 4K
|
2016-07-19 17:46:09 +00:00
|
|
|
.It powerpc Ta 4K
|
2017-05-02 21:33:27 +00:00
|
|
|
.It powerpcspe Ta 4K
|
2016-07-19 17:46:09 +00:00
|
|
|
.It powerpc64 Ta 4K
|
2017-05-03 16:55:02 +00:00
|
|
|
.It riscv64 Ta 4K
|
|
|
|
.It riscv64sf Ta 4K
|
2016-07-19 17:46:09 +00:00
|
|
|
.It sparc64 Ta 8K
|
|
|
|
.El
|
|
|
|
.Ss Floating Point
|
2016-07-21 09:37:17 +00:00
|
|
|
.Bl -column -offset indent "Sy Architecture" "Sy float, double" "Sy long double"
|
2016-07-19 17:46:09 +00:00
|
|
|
.It Sy Architecture Ta Sy float, double Ta Sy long double
|
|
|
|
.It amd64 Ta hard Ta hard, 80 bit
|
|
|
|
.It arm Ta soft Ta soft, double precision
|
2017-05-05 16:40:45 +00:00
|
|
|
.It armv6 Ta hard(1) Ta hard, double precision
|
2018-01-31 23:16:19 +00:00
|
|
|
.It armv7 Ta hard(1) Ta hard, double precision
|
2016-07-19 17:46:09 +00:00
|
|
|
.It arm64 Ta hard Ta soft, quad precision
|
|
|
|
.It i386 Ta hard Ta hard, 80 bit
|
|
|
|
.It mips Ta soft Ta identical to double
|
|
|
|
.It mipsel Ta soft Ta identical to double
|
2016-10-31 15:33:58 +00:00
|
|
|
.It mipselhf Ta hard Ta identical to double
|
|
|
|
.It mipshf Ta hard Ta identical to double
|
|
|
|
.It mipsn32 Ta soft Ta identical to double
|
2016-07-19 17:46:09 +00:00
|
|
|
.It mips64 Ta soft Ta identical to double
|
|
|
|
.It mips64el Ta soft Ta identical to double
|
2016-10-31 15:33:58 +00:00
|
|
|
.It mips64elhf Ta hard Ta identical to double
|
|
|
|
.It mips64hf Ta hard Ta identical to double
|
2016-07-19 17:46:09 +00:00
|
|
|
.It powerpc Ta hard Ta hard, double precision
|
2017-05-02 21:33:27 +00:00
|
|
|
.It powerpcspe Ta hard Ta hard, double precision
|
2016-07-19 17:46:09 +00:00
|
|
|
.It powerpc64 Ta hard Ta hard, double precision
|
2017-01-21 07:07:50 +00:00
|
|
|
.It riscv64 Ta hard Ta hard, double precision
|
|
|
|
.It riscv64sf Ta soft Ta soft, double precision
|
2016-07-19 17:46:09 +00:00
|
|
|
.It sparc64 Ta hard Ta hard, quad precision
|
|
|
|
.El
|
2017-05-05 16:40:45 +00:00
|
|
|
.Pp
|
|
|
|
(1) Prior to
|
|
|
|
.Fx 11.0 ,
|
|
|
|
armv6 used the softfp ABI even though it supported only processors
|
|
|
|
with a floating point unit.
|
2016-07-19 17:46:09 +00:00
|
|
|
.Ss Predefined Macros
|
|
|
|
The compiler provides a number of predefined macros.
|
|
|
|
Some of these provide architecture-specific details and are explained below.
|
|
|
|
Other macros, including those required by the language standard, are not
|
|
|
|
included here.
|
|
|
|
.Pp
|
|
|
|
The full set of predefined macros can be obtained with this command:
|
|
|
|
.Bd -literal -offset indent
|
2016-10-20 20:16:10 +00:00
|
|
|
cc -x c -dM -E /dev/null
|
2016-07-19 17:46:09 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Common type size and endianness macros:
|
2016-07-21 09:37:17 +00:00
|
|
|
.Bl -column -offset indent "BYTE_ORDER" "Sy Meaning"
|
2016-07-19 17:46:09 +00:00
|
|
|
.It Sy Macro Ta Sy Meaning
|
|
|
|
.It Dv __LP64__ Ta 64-bit (8-byte) long and pointer, 32-bit (4-byte) int
|
|
|
|
.It Dv __ILP32__ Ta 32-bit (4-byte) int, long and pointer
|
|
|
|
.It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN .
|
2016-07-21 09:37:17 +00:00
|
|
|
.Dv PDP11_ENDIAN
|
|
|
|
is not used on
|
|
|
|
.Fx .
|
2016-07-19 17:46:09 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Architecture-specific macros:
|
2016-07-21 09:37:17 +00:00
|
|
|
.Bl -column -offset indent "Sy Architecture" "Sy Predefined macros"
|
2016-07-19 17:46:09 +00:00
|
|
|
.It Sy Architecture Ta Sy Predefined macros
|
|
|
|
.It amd64 Ta Dv __amd64__, Dv __x86_64__
|
|
|
|
.It arm Ta Dv __arm__
|
|
|
|
.It armv6 Ta Dv __arm__, Dv __ARM_ARCH >= 6
|
2018-01-31 23:16:19 +00:00
|
|
|
.It armv7 Ta Dv __arm__, Dv __ARM_ARCH >= 7
|
2016-07-19 17:46:09 +00:00
|
|
|
.It arm64 Ta Dv __aarch64__
|
|
|
|
.It i386 Ta Dv __i386__
|
|
|
|
.It mips Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_o32
|
|
|
|
.It mipsel Ta Dv __mips__, Dv __mips_o32
|
2016-10-31 15:33:58 +00:00
|
|
|
.It mipselhf Ta Dv __mips__, Dv __mips_o32
|
|
|
|
.It mipshf Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_o32
|
2016-07-19 17:46:09 +00:00
|
|
|
.It mipsn32 Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_n32
|
|
|
|
.It mips64 Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_n64
|
|
|
|
.It mips64el Ta Dv __mips__, Dv __mips_n64
|
2016-10-31 15:33:58 +00:00
|
|
|
.It mips64elhf Ta Dv __mips__, Dv __mips_n64
|
|
|
|
.It mips64hf Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_n64
|
2016-07-19 17:46:09 +00:00
|
|
|
.It powerpc Ta Dv __powerpc__
|
2017-05-02 21:33:27 +00:00
|
|
|
.It powerpcspe Ta Dv __powerpc__, Dv __SPE__
|
2016-07-19 17:46:09 +00:00
|
|
|
.It powerpc64 Ta Dv __powerpc__, Dv __powerpc64__
|
2017-08-07 14:09:57 +00:00
|
|
|
.It riscv64 Ta Dv __riscv, Dv __riscv_xlen == 64
|
|
|
|
.It riscv64sf Ta Dv __riscv, Dv __riscv_xlen == 64
|
2016-07-19 17:46:09 +00:00
|
|
|
.It sparc64 Ta Dv __sparc64__
|
|
|
|
.El
|
2018-07-23 19:39:20 +00:00
|
|
|
.Pp
|
|
|
|
Compilers may define additional variants of architecture-specific macros.
|
|
|
|
The macros above are preferred for use in
|
|
|
|
.Fx .
|
2017-11-13 00:32:44 +00:00
|
|
|
.Ss Important Xr make 1 variables
|
|
|
|
Most of the externally settable variables are defined in the
|
|
|
|
.Xr build 7
|
|
|
|
man page.
|
|
|
|
These variables are not otherwise documented and are used extensively
|
|
|
|
in the build system.
|
|
|
|
.Bl -column -offset indent "Sy Variable" "Sy Meaning and usage"
|
|
|
|
.It Dv MACHINE Represent the hardware platform.
|
|
|
|
This is the same as the native platform's
|
|
|
|
.Xr uname 1
|
|
|
|
.Fl m
|
|
|
|
output.
|
|
|
|
It defines both the userland / kernel interface, as well as the
|
|
|
|
bootloader / kernel interface.
|
|
|
|
It should only be used in these contexts.
|
|
|
|
Each CPU architecture may have multiple hardware platforms it supports
|
|
|
|
where
|
|
|
|
.Dv MACHINE
|
|
|
|
differs among them.
|
|
|
|
It is used to collect together all the files from
|
|
|
|
.Xr config 8
|
|
|
|
to build the kernel.
|
|
|
|
It is often the same as
|
|
|
|
.Dv MACHINE_ARCH
|
|
|
|
just as one CPU architecture can be implemented by many different
|
|
|
|
hardware platforms, one hardware platform may support multiple CPU
|
|
|
|
architecture family members, though with different binaries.
|
2017-11-15 23:51:17 +00:00
|
|
|
For example,
|
2017-11-13 00:32:44 +00:00
|
|
|
.Dv MACHINE
|
|
|
|
of i386 supported the IBM-AT hardware platform while the
|
|
|
|
.Dv MACHINE
|
|
|
|
of pc98 supported the Japanese company NEC's PC-9801 and PC-9821
|
|
|
|
hardware platforms.
|
|
|
|
Both of these hardware platforms supported only the
|
|
|
|
.Dv MACHINE_ARCH
|
|
|
|
of i386 where they shared a common ABI, except for certain kernel /
|
|
|
|
userland interfaces relating to underlying hardware platform
|
|
|
|
differences in bus architecture, device enumeration and boot interface.
|
2017-11-15 00:06:18 +00:00
|
|
|
Generally,
|
|
|
|
.Dv MACHINE
|
|
|
|
should only be used in src/sys and src/stand or in system imagers or
|
|
|
|
installers.
|
2017-11-13 00:32:44 +00:00
|
|
|
.It Dv MACHINE_ARCH Represents the CPU processor architecture.
|
|
|
|
This is the same as the native platforms
|
|
|
|
.Xr uname 1
|
|
|
|
.Fl p
|
|
|
|
output.
|
|
|
|
It defines the CPU instruction family supported.
|
|
|
|
It may also encode a variation in the byte ordering of multi-byte
|
|
|
|
integers (endian).
|
|
|
|
It may also encode a variation in the size of the integer or pointer.
|
|
|
|
It may also encode a ISA revision.
|
|
|
|
It may also encode hard versus soft floating point ABI and usage.
|
2017-11-16 00:19:44 +00:00
|
|
|
It may also encode a variant ABI when the other factors do not
|
|
|
|
uniquely define the ABI (e.g., MIPS' n32 ABI).
|
2017-11-13 00:32:44 +00:00
|
|
|
It, along with
|
2017-11-16 00:19:44 +00:00
|
|
|
.Dv MACHINE ,
|
|
|
|
defines the ABI used by the system.
|
2017-11-13 00:32:44 +00:00
|
|
|
For example, the MIPS CPU processor family supports 9 different
|
2017-11-15 23:51:17 +00:00
|
|
|
combinations encoding pointer size, endian and hard versus soft float (for
|
2017-11-13 00:32:44 +00:00
|
|
|
8 combinations) as well as N32 (which only ever had one variation of
|
|
|
|
all these).
|
|
|
|
Generally, the plain CPU name specifies the most common (or at least
|
|
|
|
first) variant of the CPU.
|
|
|
|
This is why mips and mips64 imply 'big endian' while 'arm' and 'armv7'
|
|
|
|
imply little endian.
|
|
|
|
If we ever were to support the so-called x32 ABI (using 32-bit
|
|
|
|
pointers on the amd64 architecture), it would most likely be encoded
|
|
|
|
as amd64-x32.
|
2018-02-05 23:29:50 +00:00
|
|
|
It is unfortunate that amd64 specifies the 64-bit evolution of the x86
|
2017-11-13 00:32:44 +00:00
|
|
|
platform (it matches the 'first rule') as everybody else uses x86_64.
|
|
|
|
There is no standard name for the processor: each OS selects its own
|
|
|
|
conventions.
|
2017-11-15 00:06:18 +00:00
|
|
|
.It Dv MACHINE_CPUARCH Represents the source location for a given
|
|
|
|
.Dv MACHINE_ARCH .
|
|
|
|
For example,
|
|
|
|
.Dv MACHINE_CPUARCH
|
|
|
|
is defined to be mips for all the flavors of mips that we support
|
|
|
|
since we support them all with a shared set of sources.
|
2017-11-15 15:00:02 +00:00
|
|
|
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).
|
2017-11-13 00:32:44 +00:00
|
|
|
.It Dv CPUTYPE Sets the flavor of
|
|
|
|
.Dv MACHINE_ARCH
|
|
|
|
to build.
|
|
|
|
It is used to optimize the build for a specific CPU / core that the
|
|
|
|
binaries run on.
|
2017-11-15 23:51:17 +00:00
|
|
|
Generally, this does not change the ABI, though it can be a fine line
|
2017-11-13 00:32:44 +00:00
|
|
|
between optimization for specific cases.
|
2017-11-15 23:51:17 +00:00
|
|
|
.It Dv TARGET Used to set
|
|
|
|
.Dv MACHINE
|
|
|
|
in the top level Makefile for cross building.
|
2017-11-13 00:32:44 +00:00
|
|
|
Unused outside of that scope.
|
|
|
|
It is not passed down to the rest of the build.
|
2017-11-15 23:51:17 +00:00
|
|
|
Makefiles outside of the top level should not use it at all (though
|
2017-11-13 00:32:44 +00:00
|
|
|
some have their own private copy for hysterical raisons).
|
2017-11-15 15:00:02 +00:00
|
|
|
.It Dv TARGET_ARCH Used to set
|
2017-11-15 23:51:17 +00:00
|
|
|
.Dv MACHINE_ARCH
|
|
|
|
by the top level Makefile for cross building.
|
2017-11-13 00:32:44 +00:00
|
|
|
Like
|
|
|
|
.Dv TARGET , it is unused outside of that scope.
|
|
|
|
.El
|
2016-07-19 17:46:09 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr src.conf 5 ,
|
|
|
|
.Xr build 7
|
|
|
|
.Sh HISTORY
|
|
|
|
An
|
|
|
|
.Nm
|
|
|
|
manual page appeared in
|
|
|
|
.Fx 12 .
|