This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Segment register support for the i386
- To: kettenis at wins dot uva dot nl
- Subject: Re: Segment register support for the i386
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 30 Dec 1999 22:02:09 +0100
- CC: gcc at gcc dot gnu dot org
- References: <199912301755.SAA01528@delius.kettenis.local>
> Well, not exactly. While the "address space attribute" approach would
> be nice to have, it isn't that easy to implement, since there seems to
> be no support for pointer attributes in GCC.
They would not be pointer attributes. Instead, they would be type
attributes:
struct TLS{
fill_in something;
and something_else;
}__attribute__((segment("gs")));
struct TLS *tls;
then you do
tls->something++;
and it knows to use a segment prefix on each reference.
Alternatively, they could be qualifiers, like const, volatile,
restrict - although this sounds like a major new extension.
> It would be nice if I could write:
>
> register struct thread_descr *__thread_self __asm__("%gs");
>
> such that I could use the same C code as in the Sparc case to access
> and manipulate the thread descriptor.
No, that would not be nice. What if I do:
int i;
__thread_self = &i;
That does not *at all* do what it looks like it would do (if it does
anything at all).
> That's why I'm not sure if this approach is acceptable, and I'd like
> to hear what other people think of this proposal before spending too
> much time on finishing my current implementation. I can imagine that
> people say that this extension is really an ugly hack that should
> never be allowed in GCC.
I would be such a person :(
Regards,
Martin