[RFC,v2,15/27] Add Infinity THREAD_SELF macros to sysdeps/sparc/nptl/tls.h
Commit Message
This commit adds Infinity THREAD_SELF macros for sparc.
---
sysdeps/sparc/nptl/tls.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
Comments
Gary Benson <gbenson@redhat.com> writes:
> +/* Magic for Infinity to know how to do THREAD_SELF. */
> +# define I8_THREAD_SELF I8_TS_REGISTER
> +# if __WORDSIZE == 32
> +# define I8_TS_REG_OFFSET 10 * 4
> +# else
> +# define I8_TS_REG_OFFSET (6 * 8) + (__WORDSIZE==64?0:4)
__WORDSIZE is always 64 here.
Andreas.
Hi Andreas,
Andreas Schwab wrote:
> Gary Benson <gbenson@redhat.com> writes:
> > +/* Magic for Infinity to know how to do THREAD_SELF. */
> > +# define I8_THREAD_SELF I8_TS_REGISTER
> > +# if __WORDSIZE == 32
> > +# define I8_TS_REG_OFFSET 10 * 4
> > +# else
> > +# define I8_TS_REG_OFFSET (6 * 8) + (__WORDSIZE==64?0:4)
>
> __WORDSIZE is always 64 here.
I was trying to make sense of what sparc is doing for libthread_db
too. It has:
# define DB_THREAD_SELF \
REGISTER (32, 32, 10 * 4, 0) \
REGISTER (64, __WORDSIZE, (6 * 8) + (__WORDSIZE==64?0:4), 0)
Similarly s390 has:
# define DB_THREAD_SELF REGISTER (32, 32, 18 * 4, 0) \
REGISTER (64, __WORDSIZE, 18 * 8, 0)
Could the __WORDSIZE in both of those be replaced with 64?
Thanks,
Gary
Gary Benson <gbenson@redhat.com> writes:
> I was trying to make sense of what sparc is doing for libthread_db
> too. It has:
>
> # define DB_THREAD_SELF \
> REGISTER (32, 32, 10 * 4, 0) \
> REGISTER (64, __WORDSIZE, (6 * 8) + (__WORDSIZE==64?0:4), 0)
>
> Similarly s390 has:
>
> # define DB_THREAD_SELF REGISTER (32, 32, 18 * 4, 0) \
> REGISTER (64, __WORDSIZE, 18 * 8, 0)
>
> Could the __WORDSIZE in both of those be replaced with 64?
No, of course not. It is 32 in a 32-bit process.
Andreas.
Andreas Schwab wrote:
> Gary Benson <gbenson@redhat.com> writes:
> > I was trying to make sense of what sparc is doing for libthread_db
> > too. It has:
> >
> > # define DB_THREAD_SELF \
> > REGISTER (32, 32, 10 * 4, 0) \
> > REGISTER (64, __WORDSIZE, (6 * 8) + (__WORDSIZE==64?0:4), 0)
> >
> > Similarly s390 has:
> >
> > # define DB_THREAD_SELF REGISTER (32, 32, 18 * 4, 0) \
> > REGISTER (64, __WORDSIZE, 18 * 8, 0)
> >
> > Could the __WORDSIZE in both of those be replaced with 64?
>
> No, of course not. It is 32 in a 32-bit process.
Ah, I see what's happening now.
What's being passed to libthread_db (and to Infinity in this series)
is a byte offset in bytes into prgregset_t. That doesn't work for
Infinity if the offsets change depending on the wordsize of the
debugger. I'll change these patches to pass a DWARF register number
and let the debugger figure out how to get the value.
Thanks for helping me work this out.
Cheers,
Gary
@@ -125,6 +125,15 @@ register struct pthread *__thread_self __asm__("%g7");
REGISTER (32, 32, 10 * 4, 0) \
REGISTER (64, __WORDSIZE, (6 * 8) + (__WORDSIZE==64?0:4), 0)
+/* Magic for Infinity to know how to do THREAD_SELF. */
+# define I8_THREAD_SELF I8_TS_REGISTER
+# if __WORDSIZE == 32
+# define I8_TS_REG_OFFSET 10 * 4
+# else
+# define I8_TS_REG_OFFSET (6 * 8) + (__WORDSIZE==64?0:4)
+# endif
+# define I8_TS_REG_BIAS 0
+
/* Access to data in the thread descriptor is easy. */
#define THREAD_GETMEM(descr, member) \
descr->member