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 283F03858CDB for ; Sun, 2 Apr 2023 23:19:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 283F03858CDB 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 1pj6ys-0003id-K7; Sun, 02 Apr 2023 19:19:26 -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=u7spAEbjxQ2oqAJkx69AR6Hctw0kxW0uJY+Yh8eiODU=; b=HH7Opj6HFWR/0vn5GGhK WWXEW7LoB8eReMqmHg3V2F/RR1dVjinn5ypwMnpEA/05hNwDmjjiOzSJsVaNQiWlRi1j5K+uPkOiw LGp6wp9i9A0DKsmNbPltY4y4HHqudSSabtsh/qbUYReqiQVKqFfiRBbME8/qV5ozM3itAm3ZPcOVD pVxq17ntd29oIXRBupn2QErSUrv9PmuFZWUw5vs4WAkDXuWbkOjPBPIOlbQ4WQERhheO6Z8ZviUse BJRNnZo8P9ZIX5/fEWiV0TZ0StYkSthMJGLB2me5ERFZ02p1wHyiJDyNa7sItUbOxSRjCDOAjjLYZ d7A5qzo1rTfXiw==; 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 1pj6yr-0000Wo-Tf; Sun, 02 Apr 2023 19:19:25 -0400 Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pj6yq-00AtTb-2u; Mon, 03 Apr 2023 01:19:24 +0200 Date: Mon, 3 Apr 2023 01:19:24 +0200 From: Samuel Thibault To: Sergey Bugaev Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: Re: [RFC PATCH glibc 22/34] htl: Implement thread_set_pcsptp for x86_64 Message-ID: <20230402231924.lywldglc5jtinr3a@begin> Mail-Followup-To: Sergey Bugaev , libc-alpha@sourceware.org, bug-hurd@gnu.org References: <20230319151017.531737-1-bugaevc@gmail.com> <20230319151017.531737-23-bugaevc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230319151017.531737-23-bugaevc@gmail.com> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,KAM_SHORT,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: Applied, thanks! Sergey Bugaev, le dim. 19 mars 2023 18:10:05 +0300, a ecrit: > Signed-off-by: Sergey Bugaev > --- > sysdeps/mach/hurd/x86_64/htl/pt-machdep.c | 73 +++++++++++++++++++++++ > 1 file changed, 73 insertions(+) > create mode 100644 sysdeps/mach/hurd/x86_64/htl/pt-machdep.c > > diff --git a/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c b/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c > new file mode 100644 > index 00000000..69094d3b > --- /dev/null > +++ b/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c > @@ -0,0 +1,73 @@ > +/* Machine dependent pthreads code. Hurd/x86_64 version. > + Copyright (C) 2000-2023 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > + > +int > +__thread_set_pcsptp (thread_t thread, > + int set_ip, void *ip, > + int set_sp, void *sp, > + int set_tp, void *tp) > +{ > + error_t err; > + struct i386_thread_state state; > + struct i386_fsgs_base_state fsgs_state; > + mach_msg_type_number_t state_count; > + > + state_count = i386_THREAD_STATE_COUNT; > + > + err = __thread_get_state (thread, i386_REGS_SEGS_STATE, > + (thread_state_t) &state, &state_count); > + if (err) > + return err; > + assert (state_count == i386_THREAD_STATE_COUNT); > + > + if (set_sp) > + state.ursp = (uintptr_t) sp; > + if (set_ip) > + state.rip = (uintptr_t) ip; > + > + err = __thread_set_state (thread, i386_REGS_SEGS_STATE, > + (thread_state_t) &state, i386_THREAD_STATE_COUNT); > + if (err) > + return err; > + > + if (set_tp) > + { > + state_count = i386_FSGS_BASE_STATE_COUNT; > + err = __thread_get_state (thread, i386_FSGS_BASE_STATE, > + (thread_state_t) &fsgs_state, &state_count); > + if (err) > + return err; > + assert (state_count == i386_FSGS_BASE_STATE_COUNT); > + fsgs_state.fs_base = (uintptr_t) tp; > + err = __thread_set_state (thread, i386_FSGS_BASE_STATE, > + (thread_state_t) &fsgs_state, state_count); > + if (err) > + return err; > + } > + > + return 0; > +} > -- > 2.39.2 > -- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.