This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/5] Associate target_dcache to address_space.
- From: Doug Evans <dje at google dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Mon, 28 Oct 2013 14:51:20 -0700
- Subject: Re: [PATCH 2/5] Associate target_dcache to address_space.
- Authentication-results: sourceware.org; auth=none
- References: <1382516855-32218-1-git-send-email-yao at codesourcery dot com> <1382516855-32218-3-git-send-email-yao at codesourcery dot com>
On Wed, Oct 23, 2013 at 1:27 AM, Yao Qi <yao@codesourcery.com> wrote:
> Hi,
> Nowadays, 'target_dcache' is a global variable in GDB, which is not
> necessary. It can be a per-address-space variable. In this patch, we
> add a new structure 'target_dcache', which includes all dcaches of
> target and all of them are per-address-space.
>
> There is one field 'general' which is equivalent to current
> variable 'target_dcache'. I thought to name it 'stack', but it also
> cache memory regions marked by attributes, I choose 'general'.
>
> gdb:
>
> 2013-10-23 Yao Qi <yao@codesourcery.com>
>
> * progspace.h (struct address_space): Declare.
> (current_address_space): New macro.
> * target.c (target_dcache_aspace_key): New.
> (target_dcache): Delete.
> (struct target_dcache): New.
> (target_dcache_alloc): New function.
> (target_dcache_xfree): New function.
> (target_dcache_get): New function.
> (target_dcache_cleanup)): New function.
> (target_dcache_invalidate): Update.
> (memory_xfer_partial_1): Update.
> (initialize_targets): Initialize target_dcache_aspace_key.
> [...]
> +/* Allocate an instance of struct target_dcache. */
> +
> +static struct target_dcache *
> +target_dcache_alloc (void)
> +{
> + struct target_dcache *dcache = xmalloc (sizeof (*dcache));
> +
> + dcache->general = dcache_init ();
> +
> + return dcache;
> +}
I think more work is needed here.
I looked for it in the patch series, apologies if I missed it!
Consider "info dcache" and "set dcache size,line-size".
They use a nasty global, last_cache, which needs to go away.
Plus, we need to specify their semantics in a cache-per-address-space world.