Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: eager@eagerm.com
Cc: tromey@redhat.com, gdb@sourceware.org
Subject: Re: Translate memory addresses
Date: Tue, 08 Mar 2011 17:04:00 -0000	[thread overview]
Message-ID: <201103081703.p28H3u7q027427@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <4D765DB9.5000708@eagerm.com> (message from Michael Eager on Tue,	08 Mar 2011 08:47:53 -0800)

> Date: Tue, 08 Mar 2011 08:47:53 -0800
> From: Michael Eager <eager@eagerm.com>
> 
> Tom Tromey wrote:
> >>>>>> "Michael" == Michael Eager <eager@eagerm.com> writes:
> > 
> > Michael> I'm working with a target which needs to translate
> > Michael> a virtual memory addresses to a physical address
> > Michael> before accessing the target's memory or the core file.
> > 
> > Michael> Core_ops is defined in corelow.c, and there doesn't appear
> > Michael> to be an obvious hook for the target code to modify it to
> > Michael> add the translation routine.
> > 
> > Michael> Any suggestions on the best way to add a hook or how to specify
> > Michael> a target routine to do address translations for core files?
> > 
> > I am not an expert in this area, but couldn't you make a new
> > arch_stratum target that does the translation?
> > 
> > With this approach maybe you don't even need a hook -- just do the
> > translation and call the target beneath.
> 
> Interesting idea.  I didn't think of adding a stratum for translation.
> 
> I took a clue from the way that sol-thread.c prevents corelow.c
> from calling add_target to install core_ops.  I added the following
> to corelow.c:
> 
>    CORE_ADDR (*target_translate_address) (struct target_ops *, CORE_ADDR addr);
> 
> and in init_core_ops():
> 
>    core_ops.to_translate_address = target_translate_address;
> 
> The target code contains a definition for target_translate_address
> which is initialized to point to the translation routine.  For other
> targets, this will be zero.
> 
> It's inelegant, what can I say, but functional.

Did you look at how the BSD kvm target does things?  It does a
physical to virtual address translation (by using the system-provided
libkvm), and seems to get away with this without having such a hook.


  reply	other threads:[~2011-03-08 17:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-06 23:53 Michael Eager
2011-03-08 16:28 ` Tom Tromey
2011-03-08 16:48   ` Michael Eager
2011-03-08 17:04     ` Mark Kettenis [this message]
2011-03-08 17:21       ` Michael Eager

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=201103081703.p28H3u7q027427@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=eager@eagerm.com \
    --cc=gdb@sourceware.org \
    --cc=tromey@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