From patchwork Sun Mar 19 15:09:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 66596 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2C2D1383F973 for ; Sun, 19 Mar 2023 15:13:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C2D1383F973 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679238839; bh=SMWj0fstC7UP69bTZDa/dTHSkMzeZu8osDgN5HtG+Ho=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=UiTdDEMK/58R1EyPNm9GQ/1KOFaJOnqnE2tvBWABjH6AbUYfvJTqcN6jzeTlIYmMi UM3m5kjbAM2c5on3ukyEGo/Nw12mXH8s4gUDZOO3e447Oyb0kXoeGnlnWtl14VGZdq LIj5XswDiFkGWysKbfLueaELUrpk9IJkLlicTXuA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id 17CC4385B51F for ; Sun, 19 Mar 2023 15:11:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17CC4385B51F Received: by mail-lf1-x12c.google.com with SMTP id b10so10841649lfb.9 for ; Sun, 19 Mar 2023 08:11:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679238670; 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=SMWj0fstC7UP69bTZDa/dTHSkMzeZu8osDgN5HtG+Ho=; b=YloiXf1nCZB+lcNSituUf7L4oEG0DpmpdwexOMiIVdRgawiNM6y526vBI9ETzM6rQU D2Av26Ja4hOhoTPr+8rS9uaO9J6X/PxLI1SeYSNn9ufC7k+8QCll3sORMl8LQSTl6xho cE5ri1KwyLxNhczf8dMg1nKblsH8OXUylpCkKmZOR9v2rxvdaTTgcBf8NNCakfKkmJ6X LLLdIL2as9fMIavR12iq/paiBSOBwuuPuWSB+qcEr+F958tu7/cQnAuhTJbjDQSDBYW6 OY+AW/VqFA5FXMV0kM8KSUhWh4xEUg/m3DwcqZi+AXepnVZU6VZjL44ck0qMP72s56bV 7GUA== X-Gm-Message-State: AO0yUKUxXCpe3TCFZr+R3fApLPE/jjR/boNtbnABoesDGKCYgNSnoj5C e+scEr4d0eTMd8Z/OQAYFcT9K3qDBqlKrg== X-Google-Smtp-Source: AK7set/pYj855xZhIBAwepkHjrvhKoxFVXYBgkZtjW+Tk7pgwRFO7++Nc0A424nReD2RVnyeGuGNiA== X-Received: by 2002:ac2:488f:0:b0:4d5:95c9:4eb9 with SMTP id x15-20020ac2488f000000b004d595c94eb9mr5685192lfc.44.1679238670240; Sun, 19 Mar 2023 08:11:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 08:11:09 -0700 (PDT) To: libc-alpha@sourceware.org, bug-hurd@gnu.org Cc: Samuel Thibault , Sergey Bugaev Subject: [RFC PATCH glibc 15/34] hurd: Use uintptr_t for register values in trampoline.c Date: Sun, 19 Mar 2023 18:09:58 +0300 Message-Id: <20230319151017.531737-16-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 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This is more correct, if only because these fields are defined as having the type unsigned int in the Mach headers, so casting them to a signed int and then back is suboptimal. Also, remove an extra reassignment of uesp -- this is another remnant of the ecx kludge. Signed-off-by: Sergey Bugaev --- sysdeps/mach/hurd/i386/trampoline.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sysdeps/mach/hurd/i386/trampoline.c b/sysdeps/mach/hurd/i386/trampoline.c index 8f481e79..ab67fb9c 100644 --- a/sysdeps/mach/hurd/i386/trampoline.c +++ b/sysdeps/mach/hurd/i386/trampoline.c @@ -270,24 +270,23 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action _hurdsig_end_catch_fault (); - state->basic.eip = (int) rpc_wait_trampoline; + state->basic.eip = (uintptr_t) rpc_wait_trampoline; /* The reply-receiving trampoline code runs initially on the original user stack. We pass it the signal stack pointer in %ebx. */ - state->basic.uesp = state->basic.esp; /* Restore mach_msg syscall SP. */ - state->basic.ebx = (int) sigsp; + state->basic.ebx = (uintptr_t) sigsp; /* After doing the message receive, the trampoline code will need to update the %eax value to be restored by sigreturn. To simplify the assembly code, we pass the address of its slot in SCP to the trampoline code in %ecx. */ - state->basic.ecx = (int) &scp->sc_eax; + state->basic.ecx = (uintptr_t) &scp->sc_eax; } else { - state->basic.eip = (int) trampoline; - state->basic.uesp = (int) sigsp; + state->basic.eip = (uintptr_t) trampoline; + state->basic.uesp = (uintptr_t) sigsp; } /* We pass the handler function to the trampoline code in %edx. */ - state->basic.edx = (int) handler; + state->basic.edx = (uintptr_t) handler; /* The x86 ABI says the DF bit is clear on entry to any function. */ state->basic.efl &= ~EFL_DF;