From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30156 invoked by alias); 11 Jan 2004 12:17:56 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 30140 invoked from network); 11 Jan 2004 12:17:56 -0000 Received: from unknown (HELO Cantor.suse.de) (195.135.220.2) by sources.redhat.com with SMTP; 11 Jan 2004 12:17:56 -0000 Received: from Hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id F308219C73F4; Sun, 11 Jan 2004 13:17:55 +0100 (CET) Received: from aj by arthur.inka.de with local (Exim 4.22) id 1AfeXR-0006Z2-VM; Sun, 11 Jan 2004 13:17:53 +0100 To: Richard Henderson Cc: Jakub Jelinek , Glibc hackers Subject: Re: [PATCH] Fix AMD64 backtrace References: <20040110175049.GM6413@sunsite.ms.mff.cuni.cz> <20040111024737.A1431@redhat.com> <20040111025223.A2564@redhat.com> <20040111030005.C13258@redhat.com> From: Andreas Jaeger Date: Sun, 11 Jan 2004 12:17:00 -0000 In-Reply-To: <20040111030005.C13258@redhat.com> (Richard Henderson's message of "Sun, 11 Jan 2004 03:00:05 -0800") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2004-01/txt/msg00037.txt.bz2 --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-length: 2086 And here comes setcontext: ENTRY(__setcontext) /* Save argument since syscall will destroy it. */ pushq %rdi cfi_adjust_cfa_offset(8) /* Set the signal mask with rt_sigprocmask (SIG_SETMASK, mask, NULL, _NSIG/8). */ leaq oSIGMASK(%rdi), %rsi xorq %rdx, %rdx movq $SIG_SETMASK, %rdi movq $_NSIG8,%r10 movq $__NR_rt_sigprocmask, %rax syscall popq %rdi /* Reload %rdi, adjust stack. */ cfi_adjust_cfa_offset(-8) cmpq $-4095, %rax /* Check %rax for error. */ jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */ /* Restore the floating-point context. Not the registers, only the rest. */ movq oFPREGS(%rdi), %rcx fldenv (%rcx) ldmxcsr oMXCSR(%rdi) /* Load the new stack pointer, the preserved registers and registers used for passing args. */ cfi_def_cfa(%rdi, 0) cfi_offset(%rbx,oRBX) cfi_offset(%rbp,oRBP) cfi_offset(%r12,oR12) cfi_offset(%r13,oR13) cfi_offset(%r14,oR14) cfi_offset(%r15,oR15) cfi_offset(%rsp,oRSP) cfi_offset(%rip,oRIP) movq oRSP(%rdi), %rsp movq oRBX(%rdi), %rbx movq oRBP(%rdi), %rbp movq oR12(%rdi), %r12 movq oR13(%rdi), %r13 movq oR14(%rdi), %r14 movq oR15(%rdi), %r15 /* The following ret should return to the address set with getcontext. Therefore push the address on the stack. */ movq oRIP(%rdi), %rcx pushq %rcx cfi_adjust_cfa_offset(8) movq oRSI(%rdi), %rsi movq oRDX(%rdi), %rdx movq oRCX(%rdi), %rcx movq oR8(%rdi), %r8 movq oR9(%rdi), %r9 /* Setup finally %rdi. */ movq oRDI(%rdi), %rdi /* We changed %rdi, fix cfi. */ cfi_def_cfa(%rsp, 0) cfi_same_value(%rbx) cfi_same_value(%rbp) cfi_same_value(%r12) cfi_same_value(%r13) cfi_same_value(%r14) cfi_same_value(%r15) /* Clear rax to indicate success. */ xorq %rax, %rax L(pseudo_end): ret PSEUDO_END(__setcontext) Does it look sane? Btw. cfi_same_value is not yet defined in sysdeps.h and needs to be defined with the appended patch. Is it ok to commit that one? Andreas 2004-01-11 Andreas Jaeger * sysdeps/generic/sysdep.h (CFI_SAME_VALUE): New. (cfi_same_value): New. --=-=-= Content-Disposition: inline; filename=libc-diff Content-length: 1469 ============================================================ Index: sysdeps/generic/sysdep.h --- sysdeps/generic/sysdep.h 31 Aug 2003 17:21:03 -0000 1.13 +++ sysdeps/generic/sysdep.h 11 Jan 2004 12:16:42 -0000 @@ -1,5 +1,5 @@ /* Generic asm macros used on many machines. - Copyright (C) 1991,92,93,96,98,2002,2003 Free Software Foundation, Inc. + Copyright (C) 1991,92,93,96,98,2002,2003,2004 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 @@ -60,6 +60,7 @@ # define cfi_register(r1, r2) .cfi_register r1, r2 # define cfi_return_column(reg) .cfi_return_column reg # define cfi_restore(reg) .cfi_restore reg +# define cfi_same_value(reg) .cfi_same_value reg # define cfi_undefined(reg) .cfi_undefined reg # define cfi_remember_state .cfi_remember_state # define cfi_restore_state .cfi_restore_state @@ -76,6 +77,7 @@ # define cfi_register(r1, r2) # define cfi_return_column(reg) # define cfi_restore(reg) +# define cfi_same_value(reg) # define cfi_undefined(reg) # define cfi_remember_state # define cfi_restore_state @@ -106,6 +108,8 @@ ".cfi_return_column " CFI_STRINGIFY(reg) # define CFI_RESTORE(reg) \ ".cfi_restore " CFI_STRINGIFY(reg) +# define CFI_SAME_VALUE(reg) \ + ".cfi_same_value " CFI_STRINGIFY(reg) # define CFI_UNDEFINED(reg) \ ".cfi_undefined " CFI_STRINGIFY(reg) # define CFI_REMEMBER_STATE \ --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 191 --=20 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SuSE Linux AG, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GPG fingerprint =3D 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 --=-=-=-- --==-=-= Content-Type: application/pgp-signature Content-length: 188 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQBAAT7xOJpWPMJyoSYRAq0PAJ9pwnPUPT6/s6v7OclGIfSDGu4mnwCdE4oo raBeJMT/LAVIYTv5WF6vx0A= =fssv -----END PGP SIGNATURE----- --==-=-=--