GDB (xrefs)
|
#include "defs.h"
#include "dcache.h"
#include "gdbcmd.h"
#include "gdb_string.h"
#include "gdbcore.h"
#include "target.h"
#include "inferior.h"
#include "splay-tree.h"
Go to the source code of this file.
Classes | |
struct | dcache_block |
struct | dcache_struct |
Defines | |
#define | DCACHE_DEFAULT_SIZE 4096 |
#define | DCACHE_DEFAULT_LINE_SIZE 64 |
#define | LINE_SIZE_MASK(dcache) ((dcache->line_size - 1)) |
#define | XFORM(dcache, x) ((x) & LINE_SIZE_MASK (dcache)) |
#define | MASK(dcache, x) ((x) & ~LINE_SIZE_MASK (dcache)) |
Typedefs | |
typedef void( | block_func )(struct dcache_block *block, void *param) |
Functions | |
static struct dcache_block * | dcache_hit (DCACHE *dcache, CORE_ADDR addr) |
static int | dcache_read_line (DCACHE *dcache, struct dcache_block *db) |
static struct dcache_block * | dcache_alloc (DCACHE *dcache, CORE_ADDR addr) |
static void | dcache_info (char *exp, int tty) |
void | _initialize_dcache (void) |
static void | show_dcache_enabled_p (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
static void | append_block (struct dcache_block **blist, struct dcache_block *block) |
static void | remove_block (struct dcache_block **blist, struct dcache_block *block) |
static void | for_each_block (struct dcache_block **blist, block_func *func, void *param) |
static void | free_block (struct dcache_block *block, void *param) |
void | dcache_free (DCACHE *dcache) |
static void | invalidate_block (struct dcache_block *block, void *param) |
void | dcache_invalidate (DCACHE *dcache) |
static void | dcache_invalidate_line (DCACHE *dcache, CORE_ADDR addr) |
static int | dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr) |
static int | dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr) |
static int | dcache_splay_tree_compare (splay_tree_key a, splay_tree_key b) |
DCACHE * | dcache_init (void) |
int | dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, int len, int should_write) |
void | dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, int len) |
static void | dcache_print_line (int index) |
static void | set_dcache_size (char *args, int from_tty, struct cmd_list_element *c) |
static void | set_dcache_line_size (char *args, int from_tty, struct cmd_list_element *c) |
static void | set_dcache_command (char *arg, int from_tty) |
static void | show_dcache_command (char *args, int from_tty) |
Variables | |
static struct cmd_list_element * | dcache_set_list = NULL |
static struct cmd_list_element * | dcache_show_list = NULL |
static unsigned | dcache_size = DCACHE_DEFAULT_SIZE |
static unsigned | dcache_line_size = DCACHE_DEFAULT_LINE_SIZE |
static int | dcache_enabled_p = 0 |
static DCACHE * | last_cache |
#define DCACHE_DEFAULT_LINE_SIZE 64 |
Definition at line 83 of file dcache.c.
Referenced by set_dcache_line_size().
#define DCACHE_DEFAULT_SIZE 4096 |
Definition at line 77 of file dcache.c.
Referenced by set_dcache_size().
#define LINE_SIZE_MASK | ( | dcache | ) | ((dcache->line_size - 1)) |
#define MASK | ( | dcache, | |
x | |||
) | ((x) & ~LINE_SIZE_MASK (dcache)) |
Definition at line 91 of file dcache.c.
Referenced by dcache_alloc(), and dcache_hit().
#define XFORM | ( | dcache, | |
x | |||
) | ((x) & LINE_SIZE_MASK (dcache)) |
Definition at line 90 of file dcache.c.
Referenced by dcache_peek_byte(), and dcache_poke_byte().
typedef void( block_func)(struct dcache_block *block, void *param) |
void _initialize_dcache | ( | void | ) |
static void append_block | ( | struct dcache_block ** | blist, |
struct dcache_block * | block | ||
) | [static] |
Definition at line 152 of file dcache.c.
References dcache_block::next, and dcache_block::prev.
Referenced by dcache_alloc(), dcache_invalidate_line(), and invalidate_block().
static struct dcache_block * dcache_alloc | ( | DCACHE * | dcache, |
CORE_ADDR | addr | ||
) | [static, read] |
Definition at line 362 of file dcache.c.
References dcache_block::addr, append_block(), dcache_block::data, dcache_size, dcache_struct::freelist, dcache_struct::line_size, MASK, dcache_struct::oldest, dcache_block::refs, remove_block(), dcache_struct::size, dcache_struct::tree, and xmalloc().
Referenced by dcache_peek_byte().
void dcache_free | ( | DCACHE * | dcache | ) |
Definition at line 226 of file dcache.c.
References for_each_block(), free_block(), dcache_struct::freelist, dcache_struct::oldest, dcache_struct::tree, and xfree().
static struct dcache_block * dcache_hit | ( | DCACHE * | dcache, |
CORE_ADDR | addr | ||
) | [static, read] |
Definition at line 293 of file dcache.c.
References MASK, dcache_block::refs, and dcache_struct::tree.
Referenced by dcache_invalidate_line(), dcache_peek_byte(), and dcache_poke_byte().
static void dcache_info | ( | char * | exp, |
int | tty | ||
) | [static] |
Definition at line 605 of file dcache.c.
References _, dcache_block::addr, dcache_line_size, dcache_print_line(), dcache_size, dcache_struct::line_size, null_ptid, paddress(), printf_filtered(), dcache_struct::ptid, ptid_equal(), dcache_block::refs, target_gdbarch(), target_pid_to_str(), and dcache_struct::tree.
DCACHE* dcache_init | ( | void | ) |
Definition at line 456 of file dcache.c.
References dcache_line_size, dcache_splay_tree_compare(), dcache_struct::freelist, dcache_struct::line_size, null_ptid, dcache_struct::oldest, dcache_struct::ptid, dcache_struct::size, dcache_struct::tree, and xmalloc().
Referenced by initialize_targets().
void dcache_invalidate | ( | DCACHE * | dcache | ) |
Definition at line 254 of file dcache.c.
References dcache_line_size, for_each_block(), free_block(), dcache_struct::freelist, invalidate_block(), dcache_struct::line_size, null_ptid, dcache_struct::oldest, dcache_struct::ptid, and dcache_struct::size.
Referenced by dcache_xfer_memory(), set_dcache_line_size(), set_dcache_size(), and target_dcache_invalidate().
static void dcache_invalidate_line | ( | DCACHE * | dcache, |
CORE_ADDR | addr | ||
) | [static] |
Definition at line 276 of file dcache.c.
References dcache_block::addr, append_block(), dcache_hit(), dcache_struct::freelist, dcache_struct::oldest, remove_block(), dcache_struct::size, and dcache_struct::tree.
Referenced by dcache_xfer_memory().
static int dcache_peek_byte | ( | DCACHE * | dcache, |
CORE_ADDR | addr, | ||
gdb_byte * | ptr | ||
) | [static] |
Definition at line 404 of file dcache.c.
References dcache_block::data, dcache_alloc(), dcache_hit(), dcache_read_line(), and XFORM.
Referenced by dcache_xfer_memory().
static int dcache_poke_byte | ( | DCACHE * | dcache, |
CORE_ADDR | addr, | ||
gdb_byte * | ptr | ||
) | [static] |
Definition at line 432 of file dcache.c.
References dcache_block::data, dcache_hit(), and XFORM.
Referenced by dcache_update(), and dcache_xfer_memory().
static void dcache_print_line | ( | int | index | ) | [static] |
Definition at line 561 of file dcache.c.
References _, dcache_block::addr, dcache_block::data, dcache_struct::line_size, paddress(), printf_filtered(), dcache_block::refs, target_gdbarch(), and dcache_struct::tree.
Referenced by dcache_info().
static int dcache_read_line | ( | DCACHE * | dcache, |
struct dcache_block * | db | ||
) | [static] |
Definition at line 313 of file dcache.c.
References dcache_block::addr, mem_region::attrib, current_target, dcache_block::data, mem_region::hi, len, dcache_struct::line_size, lookup_mem_region(), MEM_WO, memaddr, mem_attrib::mode, TARGET_OBJECT_RAW_MEMORY, and target_read().
Referenced by dcache_peek_byte().
static int dcache_splay_tree_compare | ( | splay_tree_key | a, |
splay_tree_key | b | ||
) | [static] |
Definition at line 443 of file dcache.c.
Referenced by dcache_init().
void dcache_update | ( | DCACHE * | dcache, |
CORE_ADDR | memaddr, | ||
gdb_byte * | myaddr, | ||
int | len | ||
) |
Definition at line 552 of file dcache.c.
References dcache_poke_byte(), and len.
Referenced by memory_xfer_partial_1().
int dcache_xfer_memory | ( | struct target_ops * | ops, |
DCACHE * | dcache, | ||
CORE_ADDR | memaddr, | ||
gdb_byte * | myaddr, | ||
int | len, | ||
int | should_write | ||
) |
Definition at line 488 of file dcache.c.
References dcache_block::addr, dcache_invalidate(), dcache_invalidate_line(), dcache_peek_byte(), dcache_poke_byte(), inferior_ptid, int, len, dcache_struct::ptid, ptid_equal(), TARGET_OBJECT_RAW_MEMORY, and target_write().
Referenced by memory_xfer_partial_1().
static void for_each_block | ( | struct dcache_block ** | blist, |
block_func * | func, | ||
void * | param | ||
) | [static] |
Definition at line 197 of file dcache.c.
References func, and dcache_block::next.
Referenced by dcache_free(), and dcache_invalidate().
static void free_block | ( | struct dcache_block * | block, |
void * | param | ||
) | [static] |
Definition at line 218 of file dcache.c.
References xfree().
Referenced by dcache_free(), and dcache_invalidate().
static void invalidate_block | ( | struct dcache_block * | block, |
void * | param | ||
) | [static] |
Definition at line 243 of file dcache.c.
References dcache_block::addr, append_block(), dcache_struct::freelist, and dcache_struct::tree.
Referenced by dcache_invalidate().
static void remove_block | ( | struct dcache_block ** | blist, |
struct dcache_block * | block | ||
) | [static] |
Definition at line 174 of file dcache.c.
References dcache_block::next, and dcache_block::prev.
Referenced by dcache_alloc(), and dcache_invalidate_line().
static void set_dcache_command | ( | char * | arg, |
int | from_tty | ||
) | [static] |
Definition at line 688 of file dcache.c.
References gdb_stdout, help_list(), and printf_unfiltered().
static void set_dcache_line_size | ( | char * | args, |
int | from_tty, | ||
struct cmd_list_element * | c | ||
) | [static] |
Definition at line 673 of file dcache.c.
References _, DCACHE_DEFAULT_LINE_SIZE, dcache_invalidate(), dcache_line_size, and error().
static void set_dcache_size | ( | char * | args, |
int | from_tty, | ||
struct cmd_list_element * | c | ||
) | [static] |
Definition at line 660 of file dcache.c.
References _, DCACHE_DEFAULT_SIZE, dcache_invalidate(), dcache_size, and error().
static void show_dcache_command | ( | char * | args, |
int | from_tty | ||
) | [static] |
Definition at line 696 of file dcache.c.
References cmd_show_list().
static void show_dcache_enabled_p | ( | struct ui_file * | file, |
int | from_tty, | ||
struct cmd_list_element * | c, | ||
const char * | value | ||
) | [static] |
Definition at line 136 of file dcache.c.
References _, and fprintf_filtered().
int dcache_enabled_p = 0 [static] |
unsigned dcache_line_size = DCACHE_DEFAULT_LINE_SIZE [static] |
Definition at line 84 of file dcache.c.
Referenced by dcache_info(), dcache_init(), dcache_invalidate(), and set_dcache_line_size().
struct cmd_list_element* dcache_set_list = NULL [static] |
struct cmd_list_element* dcache_show_list = NULL [static] |
unsigned dcache_size = DCACHE_DEFAULT_SIZE [static] |
Definition at line 78 of file dcache.c.
Referenced by dcache_alloc(), dcache_info(), and set_dcache_size().
DCACHE* last_cache [static] |