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 F290E3858D38 for ; Mon, 10 Apr 2023 22:23:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F290E3858D38 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 1plzug-0006BG-72; Mon, 10 Apr 2023 18:23:02 -0400 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=OAWq4A5qPVkDaxRmm448fIe2WDnpSb2ChGZl7jD9arc=; b=D2gCcFofI0Dorjv2f4aP iJU2BkX3oaHP7PAKd1PjAUKN+XxhGtf+IrS4upajs1BB9xy3sUXggv8PpN2C1dbfC/E6CcpvbAMN5 tJx3zWfeQGcI4CeSZ2MjXqmoSCurKxCJJJUJGn/FCcp5MxQsv6OofH5nyilDTcu49NZlymVzAdwJJ b9xNvVCgrRTtOxDJxwoKYIdEwkV8vO1+cyfqN4StnQzG8IoHgAE4tbYA+VowP0bKS4EFttYkVGGWe ZCnhzKWj4dBSMR8MVW+bsvfGPVjPeQc2Z5NTvw3onttuRrnDNK3uH41TaLUr7F6AXcrfCT9Q2wZ6t l/yh4YOBx8hrkg==; Received: from [2a01:cb19:4a:a400:de41:a9ff:fe47:ec49] (helo=begin) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1plzuf-0008E4-Nh; Mon, 10 Apr 2023 18:23:01 -0400 Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1plzue-000vMT-1I; Tue, 11 Apr 2023 00:23:00 +0200 Date: Tue, 11 Apr 2023 00:23:00 +0200 From: Samuel Thibault To: Sergey Bugaev Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: Re: [RFC PATCH glibc 16/34] hurd: Add sys/ucontext.h and sigcontext.h for x86_64 Message-ID: <20230410222300.ty4pcjdnkmhi5psi@begin> Mail-Followup-To: Sergey Bugaev , libc-alpha@sourceware.org, bug-hurd@gnu.org References: <20230319151017.531737-1-bugaevc@gmail.com> <20230319151017.531737-17-bugaevc@gmail.com> <20230410185814.rjqm46ndc4pjvoac@begin> <20230410192158.mmmcpeviwfc52e7c@begin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Sergey Bugaev, le mar. 11 avril 2023 00:50:25 +0300, a ecrit: > On Mon, Apr 10, 2023 at 10:22 PM Samuel Thibault > wrote: > > > > Sergey Bugaev, le lun. 10 avril 2023 22:13:06 +0300, a ecrit: > > > On Mon, Apr 10, 2023 at 9:58 PM Samuel Thibault wrote: > > > > > > > > Sergey Bugaev, le dim. 19 mars 2023 18:09:59 +0300, a ecrit: > > > > > +#ifdef __USE_GNU > > > > > +/* Number of each register in the `gregset_t' array. */ > > > > > +enum > > > > > +{ > > > > > + REG_GSFS = 0, /* Actually int gs, fs. */ > > > > > +# define REG_GSFS REG_GSFS > > > > > + REG_ESDS, /* Actually int es, ds. */ > > > > > +# define REG_ESDS REG_ESDS > > > > > > > > On second thought, why REG_ESDS? They are basically useless on amd64 > > > > > > > > Linux packs all segment registers in REG_CSGSFS, probably better to > > > > stuff them the same way? (all three really are 16bit only, even if the > > > > thread_state is padding them to 32bits). > > > > > > Exactly because that's how they are laid out in struct > > > i386_thread_state, if you count in 8-byte chunks. > > > > But we don't have to map to that. > > Well yes, I was trying to make the x86_64 version do the same thing as > i386 does, hence arranging registers in sigcontext, ucontext, and > thread state in the same way, so they can be memcpied, like on i386. Ah, but on i386 it's only coincidence that it's the same layout, just because that's the pusha layourt :) > But we could also lay this out differently and just write some more > code to fill the ucontext. I'd say better stick to some sane layout that makes it simpler for most uses. We don't have to stick to the Linux layout either. Samuel