From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id E6C773858C2F for ; Sun, 12 Feb 2023 19:37:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E6C773858C2F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRIAK-0006Ij-2D; Sun, 12 Feb 2023 14:37:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=In-Reply-To:MIME-Version:References:Subject:To:From: Date; bh=CX7RQhWGZlxS5rNeVDiFe80bTO1MIjl7tVgvR+cQSRc=; b=E3+EFk7BFAozkrGuTZzI fzqpVb1+byxzy2vIZLceFZTOZ+DZWGi6mB/OVE4th0TwoKZDcAEGDsn+0etbNmpW7i9hmcTVtvrVQ EoCP+0pCg9VqHOmXptRB0OUVIZeYNo5Rm0IH4r9pABBf/eMbrq9neV42KTzZUcoqk0cWIQVwRT3KQ WSQtz6CPiQPB14sg295nPkDsghdnacjxlt5r+vwE3VKu8hrfsS6BkMW2AbG3JmjutOmv6MZC/hK12 qhaJEwl9xserzD67LxXqKnYOB6tj1uLY6zjnTVhM+6osFMXsIW803vhGKBS4xVx0Um2tSkKtfJJy5 z9H5SUHk4WYzlA==; Received: from lfbn-bor-1-1163-184.w92-158.abo.wanadoo.fr ([92.158.138.184] helo=begin) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRIAJ-0007yo-Ni; Sun, 12 Feb 2023 14:37:35 -0500 Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pRIAH-005dZp-0c; Sun, 12 Feb 2023 20:37:33 +0100 Date: Sun, 12 Feb 2023 20:37:33 +0100 From: Samuel Thibault To: Florian Weimer Cc: Sergey Bugaev , bug-hurd@gnu.org, libc-alpha@sourceware.org, =?utf-8?Q?Fl=C3=A1vio?= Cruz Subject: Re: [RFC PATCH glibc 11/12] hurd, htl: Add some x86_64-specific code Message-ID: <20230212193733.p7jeei25lo2fwr67@begin> Mail-Followup-To: Florian Weimer , Sergey Bugaev , bug-hurd@gnu.org, libc-alpha@sourceware.org, =?utf-8?Q?Fl=C3=A1vio?= Cruz References: <20230212111044.610942-1-bugaevc@gmail.com> <20230212111044.610942-12-bugaevc@gmail.com> <20230212161153.q4km4h2ql3k5pasp@begin> <20230212163607.47dynpr5rpbohrhe@begin> <87v8k6n8f9.fsf@mid.deneb.enyo.de> <20230212164651.opuy72eg2yjnxhmf@begin> <87lel2n0m0.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87lel2n0m0.fsf@mid.deneb.enyo.de> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Florian Weimer, le dim. 12 févr. 2023 20:29:43 +0100, a ecrit: > * Samuel Thibault: > > > Florian Weimer, le dim. 12 févr. 2023 17:40:58 +0100, a ecrit: > >> * Samuel Thibault via Libc-alpha: > >> > >> > Sergey Bugaev, le dim. 12 févr. 2023 19:25:11 +0300, a ecrit: > >> >> On Sun, Feb 12, 2023 at 7:11 PM Samuel Thibault wrote: > >> >> > Sergey Bugaev, le dim. 12 févr. 2023 14:10:42 +0300, a ecrit: > >> >> > > We should not need a getter routine, because one can simply inspect the target > >> >> > > thread's state (unless, again, I misunderstand things horribly). > >> >> > > >> >> > For 16bit fs/gs values we could read them from userland yes. But for > >> >> > fs/gs base, the FSGSBASE instruction is not available on all 64bit > >> >> > processors. And ATM in THREAD_TCB we want to be able to get the base of > >> >> > another thread. > >> >> > >> >> What I've meant is: > >> >> > >> >> __thread_get_state (whatever_thread, &state); > >> >> uintptr_t its_fs_base = state->fs_base; > >> >> > >> >> You can't really do the same to *write* [fg]s_base, because doing > >> >> thread_set_state on your own thread is bound to end badly. > >> > > >> > ? Well, sure, just like setting fs/gs through thread state was not done > >> > for i386. > >> > > >> > I don't see where you're aiming. Getting fs/gs from __thread_get_state > >> > won't actually give you the base, you'll just read something like 0. > >> > >> The convention is that the FSBASE address is at %fs:0. > > > > Yes, but that works only for reading your own base, not the base of > > another thread. > > Well, yes, but how do you identify the other thread? Usually by the > address of its TCB. Yes, but that's not (yet) the case in htl. Samuel