From owner-svn-src-all@freebsd.org Tue May 30 17:07:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50E7FB888BD; Tue, 30 May 2017 17:07:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2ADEB6FC46; Tue, 30 May 2017 17:07:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4UH7eqL031829; Tue, 30 May 2017 17:07:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4UH7eft031827; Tue, 30 May 2017 17:07:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705301707.v4UH7eft031827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 30 May 2017 17:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r319227 - stable/11/share/man/man7 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 May 2017 17:07:41 -0000 Author: emaste Date: Tue May 30 17:07:40 2017 New Revision: 319227 URL: https://svnweb.freebsd.org/changeset/base/319227 Log: MFC arch.7 man page describing some arch-specific details MFC of r318386, r317938, r317844, r317843, r317840, r317835, r317809, r317790, r317754, r317708, r317681, r312563, r308251, r308130, r307687, r303153, r303134, r303045, r303044, r303033 Changes by br, emaste, jhb, jhibbits, kevlo, kib Sponsored by: The FreeBSD Foundation Added: stable/11/share/man/man7/arch.7 - copied, changed from r303033, head/share/man/man7/arch.7 Modified: stable/11/share/man/man7/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/Makefile ============================================================================== --- stable/11/share/man/man7/Makefile Tue May 30 16:55:15 2017 (r319226) +++ stable/11/share/man/man7/Makefile Tue May 30 17:07:40 2017 (r319227) @@ -7,6 +7,7 @@ PACKAGE=runtime-manuals #MISSING: eqnchar.7 ms.7 term.7 MAN= adding_user.7 \ + arch.7 \ ascii.7 \ bsd.snmpmod.mk.7 \ build.7 \ Copied and modified: stable/11/share/man/man7/arch.7 (from r303033, head/share/man/man7/arch.7) ============================================================================== --- head/share/man/man7/arch.7 Tue Jul 19 17:46:09 2016 (r303033, copy source) +++ stable/11/share/man/man7/arch.7 Tue May 30 17:07:40 2017 (r319227) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved. +.\" Copyright (c) 2016-2017 The FreeBSD Foundation. All rights reserved. .\" .\" This documentation was created by Ed Maste under sponsorship of .\" The FreeBSD Foundation. @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 19, 2016 +.Dd May 16, 2017 .Dt ARCH 7 .Os .Sh NAME @@ -35,9 +35,140 @@ .Sh DESCRIPTION Differences between CPU architectures and platforms supported by .Fx . +.Ss Introduction +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 +If not explicitly mentioned, sizes are in bytes. +The architecture details in this document apply to +.Fx 10.0 +and later, unless otherwise noted. +.Pp +.Fx +uses a flat address space. +Variables of types +.Vt unsigned long , +.Vt uintptr_t , +and +.Vt size_t +and pointers all have the same representation. +.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 +On some architectures, e.g. +.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. +.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 +.It alpha Ta 3.2 Ta 6.4 +.It amd64 Ta 5.1 +.It arm Ta 6.0 +.It armeb Ta 8.0 +.It armv6 Ta 10.0 +.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 +.It pc98 Ta 2.2 Ta 11.x +.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 .Ss Type sizes -On all supported architectures, +All +.Fx +architectures use some variant of the ELF (see +.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 +Compilers define the +.Dv _LP64 +symbol when compiling for an +.Dv LP64 +ABI. +.Pp +Some machines support more that one +.Fx +ABI. +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: +.Bl -column -offset indent "Dv powerpc64" "Sy ILP32 counterpart" +.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 +binaries, even if the CPU implements +.Dv AArch32 +execution state. +.Pp +On all supported architectures: .Bl -column -offset -indent "long long" "Size" .It Sy Type Ta Sy Size .It short Ta 2 @@ -47,26 +178,44 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent ".Sy Architecture" ".Sy sizeof(void *)" ".Sy "sizeof(long double)" -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) -.It amd64 Ta 8 Ta 16 -.It arm Ta 4 Ta 8 -.It armeb Ta 4 Ta 8 -.It armv6 Ta 4 Ta 8 -.It arm64 Ta 8 Ta 16 -.It i386 Ta 4 Ta 12 -.It mips Ta 4 Ta 8 -.It mipsel Ta 4 Ta 8 -.It mipsn32 Ta 4 Ta 8 -.It mips64 Ta 8 Ta 8 -.It mips64el Ta 8 Ta 8 -.It powerpc Ta 4 Ta 8 -.It powerpc64 Ta 8 Ta 8 -.It riscv Ta 8 Ta -.It sparc64 Ta 8 Ta 16 +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 +.Dv arm , +require only 4-byte alignment for 64-bit integers. +.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 +.It amd64 Ta 8 Ta 16 Ta 8 +.It arm Ta 4 Ta 8 Ta 8 +.It armeb 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 +.It powerpc Ta 4 Ta 8 Ta 4 +.It powerpcspe Ta 4 Ta 8 Ta 4 +.It powerpc64 Ta 8 Ta 8 Ta 8 +.It riscv64 Ta 8 Ta 16 Ta 8 +.It riscv64sf Ta 8 Ta 16 Ta 8 +.It sparc64 Ta 8 Ta 16 Ta 8 .El +.Pp +.Sy time_t +is 8 bytes on all supported architectures except i386 and 32-bit +variants of powerpc. .Ss Endianness and Char Signedness -.Bl -column -offset indent ".Sy Architecture" ".Sy Endianness" ".Sy "char Signedness" +.Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char Signedness" .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness .It amd64 Ta little Ta signed .It arm Ta little Ta unsigned @@ -74,54 +223,77 @@ On all supported architectures, .It armv6 Ta little Ta unsigned .It arm64 Ta little Ta unsigned .It i386 Ta little Ta signed -.It mips Ta little Ta signed -.It mipsel Ta big Ta signed -.It mipsn32 Ta little Ta signed -.It mips64 Ta little Ta signed +.It mips Ta big Ta signed +.It mipsel Ta little Ta signed +.It mipselhf Ta little Ta signed +.It mipshf Ta big Ta signed +.It mipsn32 Ta big Ta signed +.It mips64 Ta big Ta signed .It mips64el Ta little Ta signed +.It mips64elhf Ta little Ta signed +.It mips64hf Ta big Ta signed .It powerpc Ta big Ta unsigned +.It powerpcspe Ta big Ta unsigned .It powerpc64 Ta big Ta unsigned -.It riscv Ta little Ta signed +.It riscv64 Ta little Ta signed +.It riscv64sf Ta little Ta signed .It sparc64 Ta big Ta signed .El .Ss Page Size -.Bl -column -offset indent ".Sy Architecture" ".Sy Page Sizes" +.Bl -column -offset indent "Sy Architecture" "Sy Page Sizes" .It Sy Architecture Ta Sy Page Sizes .It amd64 Ta 4K, 2M, 1G .It arm Ta 4K .It armeb Ta 4K -.It armv6 Ta 4K +.It armv6 Ta 4K, 1M .It arm64 Ta 4K, 2M, 1G .It i386 Ta 4K, 2M (PAE), 4M .It mips Ta 4K .It mipsel Ta 4K +.It mipselhf Ta 4K +.It mipshf Ta 4K .It mipsn32 Ta 4K .It mips64 Ta 4K .It mips64el Ta 4K +.It mips64elhf Ta 4K +.It mips64hf Ta 4K .It powerpc Ta 4K +.It powerpcspe Ta 4K .It powerpc64 Ta 4K -.It riscv Ta 4K +.It riscv64 Ta 4K +.It riscv64sf Ta 4K .It sparc64 Ta 8K .El .Ss Floating Point -.Bl -column -offset indent ".Sy Architecture" ".Sy float, double" ".Sy long double" +.Bl -column -offset indent "Sy Architecture" "Sy float, double" "Sy long double" .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 .It armeb Ta soft Ta soft, double precision -.It armv6 Ta hard Ta hard, double precision +.It armv6 Ta hard(1) Ta hard, double precision .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 -.It mipsn32 Ta soft Ta identical to double +.It mipselhf Ta hard Ta identical to double +.It mipshf Ta hard Ta identical to double +.It mipsn32 Ta soft Ta identical to double .It mips64 Ta soft Ta identical to double .It mips64el Ta soft Ta identical to double +.It mips64elhf Ta hard Ta identical to double +.It mips64hf Ta hard Ta identical to double .It powerpc Ta hard Ta hard, double precision +.It powerpcspe Ta hard Ta hard, double precision .It powerpc64 Ta hard Ta hard, double precision -.It riscv Ta +.It riscv64 Ta hard Ta hard, double precision +.It riscv64sf Ta soft Ta soft, double precision .It sparc64 Ta hard Ta hard, quad precision .El +.Pp +(1) Prior to +.Fx 11.0 , +armv6 used the softfp ABI even though it supported only processors +with a floating point unit. .Ss Predefined Macros The compiler provides a number of predefined macros. Some of these provide architecture-specific details and are explained below. @@ -130,20 +302,22 @@ included here. .Pp The full set of predefined macros can be obtained with this command: .Bd -literal -offset indent -cc -x c -Dm -E /dev/null +cc -x c -dM -E /dev/null .Ed .Pp Common type size and endianness macros: -.Bl -column -offset indent "BYTE_ORDER" ".Sy Meaning" +.Bl -column -offset indent "BYTE_ORDER" "Sy Meaning" .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 . -.Dv PDP11_ENDIAN is not used on FreeBSD. +.Dv PDP11_ENDIAN +is not used on +.Fx . .El .Pp Architecture-specific macros: -.Bl -column -offset indent ".Sy Architecture" ".Sy Predefined macros" +.Bl -column -offset indent "Sy Architecture" "Sy Predefined macros" .It Sy Architecture Ta Sy Predefined macros .It amd64 Ta Dv __amd64__, Dv __x86_64__ .It arm Ta Dv __arm__ @@ -153,12 +327,18 @@ Architecture-specific macros: .It i386 Ta Dv __i386__ .It mips Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_o32 .It mipsel Ta Dv __mips__, Dv __mips_o32 +.It mipselhf Ta Dv __mips__, Dv __mips_o32 +.It mipshf Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_o32 .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 +.It mips64elhf Ta Dv __mips__, Dv __mips_n64 +.It mips64hf Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_n64 .It powerpc Ta Dv __powerpc__ +.It powerpcspe Ta Dv __powerpc__, Dv __SPE__ .It powerpc64 Ta Dv __powerpc__, Dv __powerpc64__ -.It riscv Ta Dv __riscv__, Dv __riscv64 +.It riscv64 Ta Dv __riscv__, Dv __riscv64 +.It riscv64sf Ta Dv __riscv__, Dv __riscv64 .It sparc64 Ta Dv __sparc64__ .El .Sh SEE ALSO