public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Jaeger <aj@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>, rth@redhat.com
Subject: Re: [PATCH] Fix AMD64 backtrace
Date: Sun, 11 Jan 2004 10:40:00 -0000	[thread overview]
Message-ID: <m3n08u93ax.fsf@gromit.moeb> (raw)
In-Reply-To: <m3smina7f1.fsf@gromit.moeb> (Andreas Jaeger's message of "Sat, 10 Jan 2004 21:13:38 +0100")

[-- Attachment #1: Type: text/plain, Size: 2009 bytes --]

Andreas Jaeger <aj@suse.de> writes:

> Jakub Jelinek <jakub@redhat.com> writes:
>
>> On Sat, Jan 10, 2004 at 08:49:49PM +0100, Andreas Jaeger wrote:
>>> Andreas Jaeger <aj@suse.de> writes:
>>> 
>>> > Jakub Jelinek <jakub@redhat.com> writes:
>>> > [...]
>>> >>> libc/sysdeps/x86_64/__longjmp.S
>>> >
>>> > What's the best way to handle the destroying of the registers with
>>> > CFI?  Should we just mark the registers with "cfi_undefined"?
>>> 
>>> I'm appending a proposed patch for __longjmp.S.  Or can anybody
>>> envision a better way doing this?
>>
>> Cannot you from the first movq ***,%rbx pretend you're
>> already at the jmpq %*rdx instruction, ie. unwind to the
>> longjmp target?
>> Write in the unwind info where to fetch %rbp, %r12..%r15,
>> ra etc. from?
>
> You mean something like the following?
>
> cfi_def_cfa(%rdi,0)
> cfi_offset(%rbx,JB_RBX*8)
> cfi_offset(%r12,JB_R12*8)
> ...
>
> I'm not sure what the right way is to handle this here at all ...

I've done it now completely:

ENTRY(__longjmp)
	/* Restore registers.  */
	/* We add unwind information for the target here.  */
	cfi_def_cfa(%rdi, 0)
	cfi_offset(%rbx,JB_RBX*8)
	cfi_offset(%r12,JB_R12*8)
	cfi_offset(%r13,JB_R13*8)
	cfi_offset(%r14,JB_R14*8)
	cfi_offset(%r15,JB_R15*8)
	cfi_offset(%rsp,JB_RSP*8)
	movq (JB_RBX*8)(%rdi),%rbx
	movq (JB_RBP*8)(%rdi),%rbp
	movq (JB_R12*8)(%rdi),%r12
	movq (JB_R13*8)(%rdi),%r13
	movq (JB_R14*8)(%rdi),%r14
	movq (JB_R15*8)(%rdi),%r15
	/* Set return value for setjmp.  */
	test %esi,%esi
	mov $01,%eax
	cmove %eax,%esi
	mov %esi, %eax
	movq (JB_PC*8)(%rdi),%rdx
	movq (JB_RSP*8)(%rdi),%rsp
	jmpq *%rdx
END (BP_SYM (__longjmp))

Does this look ok? In that case I'll commit it (and will fix
setcontext/swapcontext in a similar way)...

Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

  reply	other threads:[~2004-01-11 10:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-08 15:49 Jakub Jelinek
2004-01-08 18:24 ` Ulrich Drepper
2004-01-10 16:10 ` Andreas Jaeger
2004-01-10 18:07   ` Ulrich Drepper
2004-01-10 19:22     ` Andreas Jaeger
2004-01-10 19:24       ` Jakub Jelinek
2004-01-10 19:26         ` Andreas Jaeger
2004-01-10 19:27         ` Andreas Jaeger
2004-01-10 19:30       ` Ulrich Drepper
2004-01-10 19:51   ` Andreas Jaeger
2004-01-10 19:57     ` Jakub Jelinek
2004-01-10 20:13       ` Andreas Jaeger
2004-01-11 10:40         ` Andreas Jaeger [this message]
     [not found]           ` <20040111024737.A1431@redhat.com>
2004-01-11 10:50             ` Andreas Jaeger
     [not found]               ` <20040111025223.A2564@redhat.com>
2004-01-11 10:54                 ` Andreas Jaeger
2004-01-11 10:57                   ` Andreas Jaeger
     [not found]                     ` <20040111030005.C13258@redhat.com>
2004-01-11 12:16                       ` Andreas Jaeger
2004-01-11 12:17                       ` Andreas Jaeger
2004-01-11 18:50                         ` Jakub Jelinek
2004-01-11 19:28                           ` Andreas Jaeger
2004-01-11 20:13                             ` Jakub Jelinek
2004-01-11 20:19                               ` Andreas Jaeger
     [not found]                         ` <20040111202020.GB24540@redhat.com>
2004-01-11 20:31                           ` Andreas Jaeger
     [not found]                             ` <20040111213631.GD24540@redhat.com>
     [not found]                               ` <20040112231919.GB27775@nevyn.them.org>
     [not found]                                 ` <20040112155217.A30317@redhat.com>
2004-01-22  7:24                                   ` [rfc] dwarf2 backtrace from setcontext Andreas Jaeger
     [not found]                                     ` <20040122080350.GA18412@redhat.com>
2004-01-22  8:16                                       ` Andreas Jaeger
2004-01-12  9:58   ` [PATCH] Fix AMD64 backtrace Jakub Jelinek
2004-01-12 16:44     ` Andreas Jaeger

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=m3n08u93ax.fsf@gromit.moeb \
    --to=aj@suse.de \
    --cc=jakub@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    --cc=rth@redhat.com \
    /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).