public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Samuel Thibault <sthibaul@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] hurd: Use uintptr_t for register values in trampoline.c
Date: Sun,  2 Apr 2023 23:28:35 +0000 (GMT)	[thread overview]
Message-ID: <20230402232835.0BD873858C53@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a1fbae752722a4f59127d74c362d3247f277be24

commit a1fbae752722a4f59127d74c362d3247f277be24
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Sun Mar 19 18:09:58 2023 +0300

    hurd: Use uintptr_t for register values in trampoline.c
    
    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 <bugaevc@gmail.com>
    Message-Id: <20230319151017.531737-16-bugaevc@gmail.com>

Diff:
---
 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 8f481e79b8..ab67fb9cd2 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;

                 reply	other threads:[~2023-04-02 23:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230402232835.0BD873858C53@sourceware.org \
    --to=sthibaul@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).