public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Sergey Bugaev <bugaevc@gmail.com>
Cc: bug-hurd@gnu.org, libc-alpha@sourceware.org,
	"Flávio Cruz" <flaviocruz@gmail.com>
Subject: Re: [RFC PATCH 9/9] hurd, htl: Add some more x86_64-specific code
Date: Mon, 20 Feb 2023 01:30:00 +0100	[thread overview]
Message-ID: <20230220003000.lmepcyol5mjr4dfv@begin> (raw)
In-Reply-To: <20230218203717.373211-10-bugaevc@gmail.com>

Sergey Bugaev, le sam. 18 févr. 2023 23:37:17 +0300, a ecrit:
> diff --git a/sysdeps/mach/hurd/x86_64/tls.h b/sysdeps/mach/hurd/x86_64/tls.h
> new file mode 100644
> index 00000000..644dcb1a
> --- /dev/null
> +++ b/sysdeps/mach/hurd/x86_64/tls.h
> @@ -0,0 +1,257 @@
> +# define TCB_ALIGNMENT	64

Please copy the comment about the penalty of non-64-aligned accesses.

> +# define TLS_INIT_TP(descr) _hurd_tls_init ((tcbhead_t *) (descr))
> +
> +# if __GNUC_PREREQ (6, 0)
> +
> +#  define THREAD_SELF							\
> +  (*(tcbhead_t * __seg_fs *) offsetof (tcbhead_t, tcb))
> +#  define THREAD_GETMEM(descr, member)					\
> +  (*(__typeof (descr->member) __seg_fs *) offsetof (tcbhead_t, member))
> +#  define THREAD_SETMEM(descr, member, value)				\
> +  (*(__typeof (descr->member) __seg_fs *) offsetof (tcbhead_t, member) = value)
> +
> +# else

I'd say don't bother keeping the non-gcc-6 case, since x86_64-gnu got
added to gcc only recently.

> +/* Set the stack guard field in TCB head.  */
> +# define THREAD_SET_STACK_GUARD(value)					\
> +  THREAD_SETMEM (THREAD_SELF, stack_guard, value)
> +# define THREAD_COPY_STACK_GUARD(descr)					\
> +  ((descr)->stack_guard							\
> +   = THREAD_GETMEM (THREAD_SELF, stack_guard))
> +
> +/* Set the pointer guard field in the TCB head.  */
> +# define THREAD_SET_POINTER_GUARD(value)				\
> +  THREAD_SETMEM (THREAD_SELF, pointer_guard, value)
> +# define THREAD_COPY_POINTER_GUARD(descr)				\
> +  ((descr)->pointer_guard						\
> +   = THREAD_GETMEM (THREAD_SELF, pointer_guard))
> +
> +/* Install new dtv for current thread.  */
> +# define INSTALL_NEW_DTV(dtvp) THREAD_SETMEM (THREAD_SELF, dtv, dtvp)
> +
> +/* Return the address of the dtv for the current thread.  */
> +# define THREAD_DTV() THREAD_GETMEM (THREAD_SELF, dtv)

Please keep #define order coherent with i386/tls.h

> diff --git a/sysdeps/x86_64/htl/pt-machdep.h b/sysdeps/x86_64/htl/pt-machdep.h
> new file mode 100644
> index 00000000..2e2846fa
> --- /dev/null
> +++ b/sysdeps/x86_64/htl/pt-machdep.h

I don't think this is needed since we already have sysdeps/x86/htl/pt-machdep.h
?

Samuel

      reply	other threads:[~2023-02-20 11:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-18 20:37 [RFC PATCH 0/9] More x86_64-gnu glibc work Sergey Bugaev
2023-02-18 20:37 ` [RFC PATCH 1/9] hurd: Move thread state manipulation into _hurd_tls_new () Sergey Bugaev
2023-02-19 23:32   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 2/9] hurd: Use proper integer types Sergey Bugaev
2023-02-19 23:33   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 3/9] hurd: Fix xattr function return type Sergey Bugaev
2023-02-19 23:34   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 4/9] hurd: Make timer_t pointer-sized Sergey Bugaev
2023-02-19 23:35   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 5/9] hurd: Simplify init-first.c a bit Sergey Bugaev
2023-02-19 23:45   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 6/9] mach: Use PAGE_SIZE Sergey Bugaev
2023-02-19 23:47   ` Samuel Thibault
2023-02-18 20:37 ` [RFC PATCH 7/9] hurd: Generalize init-first.c to support x86_64 Sergey Bugaev
2023-02-20  0:01   ` Samuel Thibault
2023-02-20 16:16     ` Sergey Bugaev
2023-02-20 17:10       ` Sergey Bugaev
2023-02-20 17:31         ` Samuel Thibault
2023-02-20 17:27   ` Noah Goldstein
2023-02-18 20:37 ` [RFC PATCH 8/9 gnumach] Add i386_fsgs_base_state Sergey Bugaev
2023-02-18 20:37 ` [RFC PATCH 9/9] hurd, htl: Add some more x86_64-specific code Sergey Bugaev
2023-02-20  0:30   ` Samuel Thibault [this message]

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=20230220003000.lmepcyol5mjr4dfv@begin \
    --to=samuel.thibault@gnu.org \
    --cc=bug-hurd@gnu.org \
    --cc=bugaevc@gmail.com \
    --cc=flaviocruz@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /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).