Segment register support for the i386
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Fri Dec 31 23:54:00 GMT 1999
> 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
More information about the Gcc
mailing list