GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
dcache.c File Reference
#include "defs.h"
#include "dcache.h"
#include "gdbcmd.h"
#include "gdbcore.h"
#include "target-dcache.h"
#include "inferior.h"
#include "splay-tree.h"
#include "gdbarch.h"

Go to the source code of this file.

Classes

struct  dcache_block
 
struct  dcache_struct
 

Macros

#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_blockdcache_hit (DCACHE *dcache, CORE_ADDR addr)
 
static int dcache_read_line (DCACHE *dcache, struct dcache_block *db)
 
static struct dcache_blockdcache_alloc (DCACHE *dcache, CORE_ADDR addr)
 
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 void dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, const gdb_byte *ptr)
 
static int dcache_splay_tree_compare (splay_tree_key a, splay_tree_key b)
 
DCACHEdcache_init (void)
 
enum target_xfer_status dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, ULONGEST len, ULONGEST *xfered_len)
 
void dcache_update (DCACHE *dcache, enum target_xfer_status status, CORE_ADDR memaddr, const gdb_byte *myaddr, ULONGEST len)
 
static void dcache_print_line (DCACHE *dcache, int index)
 
static void dcache_info_1 (DCACHE *dcache, const char *exp)
 
static void info_dcache_command (const char *exp, int tty)
 
static void set_dcache_size (const char *args, int from_tty, struct cmd_list_element *c)
 
static void set_dcache_line_size (const char *args, int from_tty, struct cmd_list_element *c)
 
void _initialize_dcache ()
 

Variables

static struct cmd_list_elementdcache_set_list = NULL
 
static struct cmd_list_elementdcache_show_list = NULL
 
static unsigned dcache_size = DCACHE_DEFAULT_SIZE
 
static unsigned dcache_line_size = DCACHE_DEFAULT_LINE_SIZE
 
static bool dcache_enabled_p = false
 

Macro Definition Documentation

◆ DCACHE_DEFAULT_LINE_SIZE

#define DCACHE_DEFAULT_LINE_SIZE   64

Definition at line 83 of file dcache.c.

Referenced by set_dcache_line_size().

◆ DCACHE_DEFAULT_SIZE

#define DCACHE_DEFAULT_SIZE   4096

Definition at line 77 of file dcache.c.

Referenced by set_dcache_size().

◆ LINE_SIZE_MASK

#define LINE_SIZE_MASK ( dcache)    ((dcache->line_size - 1))

Definition at line 89 of file dcache.c.

◆ MASK

#define MASK ( dcache,
x )   ((x) & ~LINE_SIZE_MASK (dcache))

Definition at line 91 of file dcache.c.

Referenced by dcache_alloc(), and dcache_hit().

◆ XFORM

#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 Documentation

◆ block_func

typedef void block_func(struct dcache_block *block, void *param)

Definition at line 125 of file dcache.c.

Function Documentation

◆ _initialize_dcache()

void _initialize_dcache ( )

Definition at line 683 of file dcache.c.

Referenced by initialize_all_files().

◆ append_block()

static void append_block ( struct dcache_block ** blist,
struct dcache_block * block )
static

Definition at line 150 of file dcache.c.

Referenced by dcache_alloc(), dcache_invalidate_line(), and invalidate_block().

◆ dcache_alloc()

static struct dcache_block * dcache_alloc ( DCACHE * dcache,
CORE_ADDR addr )
static

◆ dcache_free()

void dcache_free ( DCACHE * dcache)

◆ dcache_hit()

static struct dcache_block * dcache_hit ( DCACHE * dcache,
CORE_ADDR addr )
static

◆ dcache_info_1()

static void dcache_info_1 ( DCACHE * dcache,
const char * exp )
static

◆ dcache_init()

DCACHE * dcache_init ( void )

◆ dcache_invalidate()

void dcache_invalidate ( DCACHE * dcache)

◆ dcache_invalidate_line()

static void dcache_invalidate_line ( DCACHE * dcache,
CORE_ADDR addr )
static

◆ dcache_peek_byte()

static int dcache_peek_byte ( DCACHE * dcache,
CORE_ADDR addr,
gdb_byte * ptr )
static

◆ dcache_poke_byte()

static void dcache_poke_byte ( DCACHE * dcache,
CORE_ADDR addr,
const gdb_byte * ptr )
static

Definition at line 426 of file dcache.c.

References dcache_block::addr, dcache_block::data, dcache_hit(), and XFORM.

Referenced by dcache_update().

◆ dcache_print_line()

static void dcache_print_line ( DCACHE * dcache,
int index )
static

◆ dcache_read_line()

static int dcache_read_line ( DCACHE * dcache,
struct dcache_block * db )
static

◆ dcache_read_memory_partial()

enum target_xfer_status dcache_read_memory_partial ( struct target_ops * ops,
DCACHE * dcache,
CORE_ADDR memaddr,
gdb_byte * myaddr,
ULONGEST len,
ULONGEST * xfered_len )

◆ dcache_splay_tree_compare()

static int dcache_splay_tree_compare ( splay_tree_key a,
splay_tree_key b )
static

Definition at line 435 of file dcache.c.

Referenced by dcache_init().

◆ dcache_update()

void dcache_update ( DCACHE * dcache,
enum target_xfer_status status,
CORE_ADDR memaddr,
const gdb_byte * myaddr,
ULONGEST len )

Definition at line 529 of file dcache.c.

References dcache_invalidate_line(), dcache_poke_byte(), status, and TARGET_XFER_OK.

Referenced by raw_memory_xfer_partial().

◆ for_each_block()

static void for_each_block ( struct dcache_block ** blist,
block_func * func,
void * param )
static

Definition at line 195 of file dcache.c.

References func, and dcache_block::next.

Referenced by dcache_free(), and dcache_invalidate().

◆ free_block()

static void free_block ( struct dcache_block * block,
void * param )
static

Definition at line 216 of file dcache.c.

References xfree().

Referenced by dcache_free(), and dcache_invalidate().

◆ info_dcache_command()

static void info_dcache_command ( const char * exp,
int tty )
static

Definition at line 650 of file dcache.c.

References dcache_info_1(), and target_dcache_get().

◆ invalidate_block()

static void invalidate_block ( struct dcache_block * block,
void * param )
static

Definition at line 238 of file dcache.c.

References append_block(), dcache_struct::freelist, and dcache_struct::tree.

Referenced by dcache_invalidate().

◆ remove_block()

static void remove_block ( struct dcache_block ** blist,
struct dcache_block * block )
static

Definition at line 172 of file dcache.c.

Referenced by dcache_alloc(), and dcache_invalidate_line().

◆ set_dcache_line_size()

static void set_dcache_line_size ( const char * args,
int from_tty,
struct cmd_list_element * c )
static

Definition at line 668 of file dcache.c.

References DCACHE_DEFAULT_LINE_SIZE, dcache_line_size, and target_dcache_invalidate().

◆ set_dcache_size()

static void set_dcache_size ( const char * args,
int from_tty,
struct cmd_list_element * c )
static

Definition at line 656 of file dcache.c.

References DCACHE_DEFAULT_SIZE, dcache_size, and target_dcache_invalidate().

◆ show_dcache_enabled_p()

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 gdb_printf().

Variable Documentation

◆ dcache_enabled_p

bool dcache_enabled_p = false
static

Definition at line 133 of file dcache.c.

◆ dcache_line_size

unsigned dcache_line_size = DCACHE_DEFAULT_LINE_SIZE
static

Definition at line 84 of file dcache.c.

Referenced by dcache_info_1(), dcache_init(), dcache_invalidate(), and set_dcache_line_size().

◆ dcache_set_list

struct cmd_list_element* dcache_set_list = NULL
static

Definition at line 30 of file dcache.c.

◆ dcache_show_list

struct cmd_list_element* dcache_show_list = NULL
static

Definition at line 31 of file dcache.c.

◆ dcache_size

unsigned dcache_size = DCACHE_DEFAULT_SIZE
static

Definition at line 78 of file dcache.c.

Referenced by dcache_alloc(), dcache_info_1(), and set_dcache_size().