[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need help with assembly code
From: |
Samuel Thibault |
Subject: |
Re: Need help with assembly code |
Date: |
Mon, 29 Nov 2021 22:19:36 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Hello,
Svante Signell, le lun. 29 nov. 2021 18:40:48 +0100, a ecrit:
> I've been working lately with on how to port valgrind to GNU/Hurd, and found
> out
> that this is not a trivial task.
It is indeed very far from a trivial task. I'd rather recommend to port
gcc's lsan support, it will be most probably much easier to port.
> Seems like one have to make a suitable mix of linux and darwin code
> (and to some extent freebsd/solaris code).
Also it'd need a fair amount of code to reimplement the basic posixish
needs of valgrind in terms of the Hurd RPCs.
> .macro DO_SYSCALL
> /* establish stack frame */
> push %ebp
> mov %esp, %ebp
> subl $$8, %esp /* 16-byte align stack */
>
> L_$0_1: /* Even though we can't take a signal until the
> __pthread_sigmask completes, start the range early.
> If eip is in the range [1,2), the syscall hasn't been started yet
> */
>
> /* Set the signal mask which should be current during the syscall. */
> /* Set up for __pthread_sigmask(SIG_SETMASK, sysmask, postmask) */
> pushl 20(%ebp)
> pushl 16(%ebp)
> pushl $$VKI_SIG_SETMASK
> pushl $$0xcafebabe /* totally fake return address */
> movl $$__NR___pthread_sigmask, %eax
> int $$0x80 /* should be sysenter? */
> jc L_$0_7 /* __pthread_sigmask failed */
> addl $$16,%esp
Mach doesn't use int 0x80 but an lcall. See for instance
glibc/sysdeps/mach/i386/syscall.S
Samuel