@@ -649,7 +649,7 @@ dcache_info_1 (DCACHE *dcache, const char *exp)
static void
info_dcache_command (const char *exp, int tty)
{
- dcache_info_1 (target_dcache_get (), exp);
+ dcache_info_1 (target_dcache_get (current_program_space->aspace), exp);
}
static void
@@ -661,7 +661,7 @@ set_dcache_size (const char *args, int from_tty,
dcache_size = DCACHE_DEFAULT_SIZE;
error (_("Dcache size must be greater than 0."));
}
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
}
static void
@@ -675,7 +675,7 @@ set_dcache_line_size (const char *args, int from_tty,
dcache_line_size = DCACHE_DEFAULT_LINE_SIZE;
error (_("Invalid dcache line size: %u (must be power of 2)."), d);
}
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
}
void _initialize_dcache ();
@@ -4104,7 +4104,7 @@ wait_for_inferior (inferior *inf)
Target was running and cache could be stale. This is just a
heuristic. Running threads may modify target memory, but we
don't get any event. */
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
ecs.ptid = do_target_wait_1 (inf, minus_one_ptid, &ecs.ws, 0);
ecs.target = inf->process_target ();
@@ -4334,7 +4334,7 @@ fetch_inferior_event ()
was running and cache could be stale. This is just a heuristic.
Running threads may modify target memory, but we don't get any
event. */
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
scoped_restore save_exec_dir
= make_scoped_restore (&execution_direction,
@@ -4895,7 +4895,7 @@ poll_one_curr_target (struct target_waitstatus *ws)
Target was running and cache could be stale. This is just a
heuristic. Running threads may modify target memory, but we
don't get any event. */
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
event_ptid = target_wait (minus_one_ptid, ws, TARGET_WNOHANG);
@@ -29,6 +29,7 @@
#include "cli/cli-utils.h"
#include <algorithm>
#include "gdbarch.h"
+#include "progspace.h"
static std::vector<mem_region> user_mem_region_list, target_mem_region_list;
static std::vector<mem_region> *mem_region_list = &target_mem_region_list;
@@ -482,7 +483,7 @@ enable_mem_command (const char *args, int from_tty)
{
require_user_regions (from_tty);
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
if (args == NULL || *args == '\0')
{ /* Enable all mem regions. */
@@ -520,7 +521,7 @@ disable_mem_command (const char *args, int from_tty)
{
require_user_regions (from_tty);
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
if (args == NULL || *args == '\0')
{
@@ -566,7 +567,7 @@ delete_mem_command (const char *args, int from_tty)
{
require_user_regions (from_tty);
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
if (args == NULL || *args == '\0')
{
@@ -30,10 +30,10 @@ static const registry<address_space>::key<DCACHE, dcache_deleter>
/* Target dcache is initialized or not. */
int
-target_dcache_init_p (void)
+target_dcache_init_p (address_space *aspace)
{
DCACHE *dcache
- = target_dcache_aspace_key.get (current_program_space->aspace);
+ = target_dcache_aspace_key.get (aspace);
return (dcache != NULL);
}
@@ -41,10 +41,10 @@ target_dcache_init_p (void)
/* Invalidate the target dcache. */
void
-target_dcache_invalidate (void)
+target_dcache_invalidate (address_space *aspace)
{
DCACHE *dcache
- = target_dcache_aspace_key.get (current_program_space->aspace);
+ = target_dcache_aspace_key.get (aspace);
if (dcache != NULL)
dcache_invalidate (dcache);
@@ -54,24 +54,24 @@ target_dcache_invalidate (void)
initialized yet. */
DCACHE *
-target_dcache_get (void)
+target_dcache_get (address_space *aspace)
{
- return target_dcache_aspace_key.get (current_program_space->aspace);
+ return target_dcache_aspace_key.get (aspace);
}
/* Return the target dcache. If it is not initialized yet, initialize
it. */
DCACHE *
-target_dcache_get_or_init (void)
+target_dcache_get_or_init (address_space *aspace)
{
DCACHE *dcache
- = target_dcache_aspace_key.get (current_program_space->aspace);
+ = target_dcache_aspace_key.get (aspace);
if (dcache == NULL)
{
dcache = dcache_init ();
- target_dcache_aspace_key.set (current_program_space->aspace, dcache);
+ target_dcache_aspace_key.set (aspace, dcache);
}
return dcache;
@@ -93,7 +93,7 @@ static void
set_stack_cache (const char *args, int from_tty, struct cmd_list_element *c)
{
if (stack_cache_enabled != stack_cache_enabled_1)
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
stack_cache_enabled = stack_cache_enabled_1;
}
@@ -131,7 +131,7 @@ static void
set_code_cache (const char *args, int from_tty, struct cmd_list_element *c)
{
if (code_cache_enabled != code_cache_enabled_1)
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
code_cache_enabled = code_cache_enabled_1;
}
@@ -158,7 +158,7 @@ code_cache_enabled_p (void)
static void
maint_flush_dcache_command (const char *command, int from_tty)
{
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
if (from_tty)
gdb_printf (_("The dcache was flushed.\n"));
}
@@ -20,13 +20,15 @@
#include "dcache.h"
-extern void target_dcache_invalidate (void);
+struct address_space;
-extern DCACHE *target_dcache_get (void);
+extern void target_dcache_invalidate (address_space *aspace);
-extern DCACHE *target_dcache_get_or_init (void);
+extern DCACHE *target_dcache_get (address_space *aspace);
-extern int target_dcache_init_p (void);
+extern DCACHE *target_dcache_get_or_init (address_space *aspace);
+
+extern int target_dcache_init_p (address_space *aspace);
extern int stack_cache_enabled_p (void);
@@ -922,7 +922,7 @@ target_kill (void)
void
target_load (const char *arg, int from_tty)
{
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
current_inferior ()->top_target ()->load (arg, from_tty);
}
@@ -1493,10 +1493,10 @@ raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
that never made it to the target. */
if (writebuf != NULL
&& inferior_ptid != null_ptid
- && target_dcache_init_p ()
+ && target_dcache_init_p (current_program_space->aspace)
&& (stack_cache_enabled_p () || code_cache_enabled_p ()))
{
- DCACHE *dcache = target_dcache_get ();
+ DCACHE *dcache = target_dcache_get (current_program_space->aspace);
/* Note that writing to an area of memory which wasn't present
in the cache doesn't cause it to be loaded in. */
@@ -1579,7 +1579,8 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
|| (stack_cache_enabled_p () && object == TARGET_OBJECT_STACK_MEMORY)
|| (code_cache_enabled_p () && object == TARGET_OBJECT_CODE_MEMORY)))
{
- DCACHE *dcache = target_dcache_get_or_init ();
+ DCACHE *dcache
+ = target_dcache_get_or_init (current_program_space->aspace);
return dcache_read_memory_partial (ops, dcache, memaddr, readbuf,
reg_len, xfered_len);
@@ -2648,7 +2649,7 @@ target_resume (ptid_t scope_ptid, int step, enum gdb_signal signal)
gdb_assert (inferior_ptid != null_ptid);
gdb_assert (inferior_ptid.matches (scope_ptid));
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
current_inferior ()->top_target ()->resume (scope_ptid, step, signal);
@@ -474,7 +474,7 @@ prepare_execute_command ()
it. For the duration of the command, though, use the dcache to
help things like backtrace. */
if (non_stop)
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
return scoped_value_mark ();
}
@@ -2134,7 +2134,7 @@ tfind_1 (enum trace_find_type type, int num,
tp = get_tracepoint_by_number_on_target (target_tracept);
reinit_frame_cache ();
- target_dcache_invalidate ();
+ target_dcache_invalidate (current_program_space->aspace);
set_tracepoint_num (tp ? tp->number : target_tracept);