From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 0B5D93850849 for ; Sun, 19 Mar 2023 15:11:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B5D93850849 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x130.google.com with SMTP id h25so355664lfv.6 for ; Sun, 19 Mar 2023 08:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679238683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qbEat5LJ2mUp6bhK1jdbPJm+yAdnReTesvMhGVXU4bs=; b=aHaRzt2BJboB/O/geBriWBs+Io/nic1SjGFctcfNKW4E30sPZAPT25hoy7kou29+t+ moCwaHvunlv5xyIB9hQg7H6Jg3vgJnJNYdSwZIQGu+WpGSfvDURMWXqN2jqP62rE+LQn D3pFWNFT64Z4jCJ2veTknxlRCZJ+ppyvp9d8KeM0y5VFiFzjzu1bNH2sUhlXWpkyZekL PAm/JJiAs18XOZ4LMU0lfGfEo6gKDdrX5HSjRN4Lo+3YNxjA4kGx9/4RnxzGfBKRhQNR 3484MPgkyyjxRzgnA85ytGH1l0FjilLpMI2f88dDFk4+GZS6TarOLqj7GZtRBk08XI0/ w6rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679238683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qbEat5LJ2mUp6bhK1jdbPJm+yAdnReTesvMhGVXU4bs=; b=TJ8vrpPejEHQ6QapNmcasJo77PqJAqWz46ycXXiHwwaAsEbUfFFxIh9dQhJZPrbYbt oquetJVCoUmnAV7QQP8jRuvcsASbs0QM/+m08MD9yyRH2ORtqQktAA7DBlmEi6ld3L7H ZUjLCPwsBta1kxXleuMBdxOyC2C3iNmeCUs5eTqUvngKiZIu4D4J1nXCFtG/S0aszdtr Jt7oLMqZ9gSJlBLLbeoKoQajmpbDHcKfhCF3pWa8aBldXON1iS7FKFvHuCeJjriit46j mbTJzvtt7DSBwhAHxzsjKMhzZoSlHNtaCk+GR4/NCEJFTY3kn5vLPscewMhsQWQ/ll2t fHiA== X-Gm-Message-State: AO0yUKXEszlMaMEDw6CwbPv4cgRO5RyRP+EphVu064Y86m11R6poIDfJ xIX/SuogPU0BX11F0PcTMGar9hYsUvREew== X-Google-Smtp-Source: AK7set+bKIWdLvpd84wFUQ/kKys6UpBH3Q5GhYaMSLYaG27JFCKmGwMud44U0ybIuIkQVx4eft0cJQ== X-Received: by 2002:a05:6512:25a:b0:4e9:609f:256d with SMTP id b26-20020a056512025a00b004e9609f256dmr2762211lfo.13.1679238683325; Sun, 19 Mar 2023 08:11:23 -0700 (PDT) Received: from surface-pro-6.. ([2a00:1370:818c:4a57:577a:76f4:df43:5e66]) by smtp.gmail.com with ESMTPSA id m19-20020ac24253000000b004e90dee5469sm1274089lfl.157.2023.03.19.08.11.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 08:11:22 -0700 (PDT) From: Sergey Bugaev To: libc-alpha@sourceware.org, bug-hurd@gnu.org Cc: Samuel Thibault , Sergey Bugaev Subject: [RFC PATCH glibc 28/34] hurd: Implement _hurd_longjmp_thread_state for x86_64 Date: Sun, 19 Mar 2023 18:10:11 +0300 Message-Id: <20230319151017.531737-29-bugaevc@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230319151017.531737-1-bugaevc@gmail.com> References: <20230319151017.531737-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: Signed-off-by: Sergey Bugaev --- sysdeps/mach/hurd/x86_64/longjmp-ts.c | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 sysdeps/mach/hurd/x86_64/longjmp-ts.c diff --git a/sysdeps/mach/hurd/x86_64/longjmp-ts.c b/sysdeps/mach/hurd/x86_64/longjmp-ts.c new file mode 100644 index 00000000..2c57d26a --- /dev/null +++ b/sysdeps/mach/hurd/x86_64/longjmp-ts.c @@ -0,0 +1,41 @@ +/* Perform a `longjmp' on a Mach thread_state. x86_64 version. + Copyright (C) 1991-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 + + +/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'. */ + +void +_hurd_longjmp_thread_state (void *state, jmp_buf env, int val) +{ + struct i386_thread_state *ts = state; + + ts->rbx = env[0].__jmpbuf[JB_RBX]; + ts->rbp = env[0].__jmpbuf[JB_RBP]; + ts->r12 = env[0].__jmpbuf[JB_R12]; + ts->r13 = env[0].__jmpbuf[JB_R13]; + ts->r14 = env[0].__jmpbuf[JB_R14]; + ts->r15 = env[0].__jmpbuf[JB_R15]; + ts->ursp = env[0].__jmpbuf[JB_RSP]; + ts->rip = env[0].__jmpbuf[JB_PC]; + ts->rax = val ?: 1; +} -- 2.39.2