public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: Sandra Loosemore <sandra@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, richard.guenther@gmail.com
Subject: Re: [PATCH v2 12/13] Document the x86 address spaces
Date: Thu, 22 Oct 2015 20:30:00 -0000	[thread overview]
Message-ID: <56294634.1060205@redhat.com> (raw)
In-Reply-To: <56285741.4070303@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 60 bytes --]

I believe I've addressed all of your comments like so.


r~

[-- Attachment #2: 0001-Document-the-x86-address-spaces.patch --]
[-- Type: text/x-patch, Size: 2761 bytes --]

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index e54fe67..5793868 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1240,8 +1240,8 @@ As an extension, GNU C supports named address spaces as
 defined in the N1275 draft of ISO/IEC DTR 18037.  Support for named
 address spaces in GCC will evolve as the draft technical report
 changes.  Calling conventions for any target might also change.  At
-present, only the AVR, SPU, M32C, and RL78 targets support address
-spaces other than the generic address space.
+present, only the AVR, SPU, M32C, RL78, and i386/x86_64 targets support
+address spaces other than the generic address space.
 
 Address space identifiers may be used exactly like any other C type
 qualifier (e.g., @code{const} or @code{volatile}).  See the N1275
@@ -1430,6 +1430,49 @@ It may use runtime library
 support, or generate special machine instructions to access that address
 space.
 
+@subsection x86 Named Address Spaces
+@cindex x86 named address spaces
+
+On the x86 target, variables may be declared as being relative
+to the @code{%fs} or @code{%gs} segments.
+
+@table @code
+@item __seg_fs
+@itemx __seg_gs
+@cindex @code{__seg_fs} x86 named address space
+@cindex @code{__seg_gs} x86 named address space
+The object is accessed with the respective segment override prefix.
+
+The respective segment base must be set via some method specific to
+the operating system.  Rather than require an expensive system call
+to retrieve the segment base, these address spaces are not considered
+to be subspaces of the generic (flat) address space.  This means that
+explicit casts are required to convert pointers between these address
+spaces and the generic address space.  In practice the application
+should cast to @code{uintptr_t} and apply the segment base offset
+that it installed previously.
+
+The preprocessor symbols @code{__SEG_FS} and @code{__SEG_GS} are
+defined when these address spaces are supported.
+
+@item __seg_tls
+@cindex @code{__seg_tls} x86 named address space
+Some operating systems define either the @code{%fs} or @code{%gs}
+segment as the thread-local storage base for each thread.  Objects
+within this address space are accessed with the appropriate
+segment override prefix.
+
+The pointer located at address 0 within the segment contains the
+offset of the segment within the generic address space.  Thus this
+address space is considered a subspace of the generic address space,
+and the known segment offset is applied when converting addresses
+to and from the generic address space.
+
+The preprocessor symbol @code{__SEG_TLS} is defined when this
+address space is supported.
+
+@end table
+
 @node Zero Length
 @section Arrays of Length Zero
 @cindex arrays of length zero

  reply	other threads:[~2015-10-22 20:25 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20 21:27 [PATCH v2 00/13] Address space support for x86 Richard Henderson
2015-10-20 21:28 ` [PATCH v2 13/13] Add hook for modifying debug info for address spaces Richard Henderson
2015-10-21 13:55   ` Jeff Law
2015-10-21 14:57   ` H.J. Lu
2015-10-21 17:23     ` Richard Henderson
2015-10-21 17:25       ` H.J. Lu
2015-10-21 17:51         ` Richard Henderson
2015-10-21 18:36           ` H.J. Lu
2015-10-21 16:22   ` Ulrich Weigand
2015-10-21 19:13     ` Richard Henderson
2015-10-22 14:19       ` Ulrich Weigand
2015-10-20 21:28 ` [PATCH v2 11/13] Test case for conversion from __seg_tls:0 Richard Henderson
2015-11-09 14:46   ` Richard Biener
2015-11-09 17:55     ` Thomas Schwinge
2015-10-20 21:28 ` [PATCH v2 12/13] Document the x86 address spaces Richard Henderson
2015-10-22  4:59   ` Sandra Loosemore
2015-10-22 20:30     ` Richard Henderson [this message]
2015-10-23 17:16       ` Sandra Loosemore
2015-10-20 21:28 ` [PATCH v2 10/13] Avoid CSE of MEMs in different " Richard Henderson
2015-10-21 13:49   ` Jeff Law
2015-10-21 17:12     ` Richard Henderson
2015-10-22  7:48       ` Richard Biener
2015-10-20 21:28 ` [PATCH v2 07/13] i386: Add address space for tls Richard Henderson
2015-10-20 21:28 ` [PATCH v2 08/13] Add TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID Richard Henderson
2015-10-21 13:59   ` Jeff Law
2015-10-21 20:51     ` Richard Henderson
2015-10-21 21:29       ` Jeff Law
2015-10-22  3:27   ` Sandra Loosemore
2015-10-22  7:59     ` Richard Biener
2015-10-23 17:08       ` Sandra Loosemore
2015-10-22 19:17     ` Richard Henderson
2015-10-20 21:28 ` [PATCH v2 09/13] Fix PR 66768 Richard Henderson
2015-10-21 13:56   ` Jeff Law
2015-10-21 17:55     ` Richard Henderson
2015-10-20 21:28 ` [PATCH v2 01/13] Change default of non-overlapping address space conversion Richard Henderson
2015-10-21 14:03   ` Jeff Law
2015-10-20 21:28 ` [PATCH v2 05/13] i386: Add address spaces for fs/gs segments Richard Henderson
2015-10-20 21:28 ` [PATCH v2 04/13] i386: Disallow address spaces with string insns Richard Henderson
2015-10-20 21:28 ` [PATCH v2 02/13] Relax ADDR_SPACE_GENERIC_P checks for default address space hooks Richard Henderson
2015-10-21 14:02   ` Jeff Law
2015-10-21 20:50     ` Richard Henderson
2015-10-20 21:28 ` [PATCH v2 06/13] i386: Replace ix86_address_seg with addr_space_t Richard Henderson
2015-10-20 21:34 ` [PATCH v2 03/13] i386: Handle address spaces in movabs patterns Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56294634.1060205@redhat.com \
    --to=rth@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    --cc=sandra@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).