memory.h File Reference

Back to the index.

Classes | Macros | Functions
memory.h File Reference
#include <sys/types.h>
#include <inttypes.h>
#include "misc.h"

Go to the source code of this file.

Classes

struct  memory_device
 
struct  memory
 

Macros

#define DEFAULT_RAM_IN_MB   32
 
#define BITS_PER_PAGETABLE   20
 
#define BITS_PER_MEMBLOCK   20
 
#define MAX_BITS   40
 
#define MEM_PCI_LITTLE_ENDIAN   128
 
#define MEM_READ   0
 
#define MEM_WRITE   1
 
#define MEM_DOWNGRADE   128
 
#define CACHE_DATA   0
 
#define CACHE_INSTRUCTION   1
 
#define CACHE_NONE   2
 
#define CACHE_FLAGS_MASK   0x3
 
#define NO_EXCEPTIONS   16
 
#define PHYSICAL   32
 
#define MEMORY_USER_ACCESS   64 /* for ARM and M88K */
 
#define DM_DEFAULT   0
 
#define DM_DYNTRANS_OK   1
 
#define DM_DYNTRANS_WRITE_OK   2
 
#define DM_READS_HAVE_NO_SIDE_EFFECTS   4
 
#define DM_EMULATED_RAM   8
 
#define FLAG_WRITEFLAG   1
 
#define FLAG_NOEXCEPTIONS   2
 
#define FLAG_INSTR   4
 
#define MEMORY_ACCESS_FAILED   0
 
#define MEMORY_ACCESS_OK   1
 
#define MEMORY_ACCESS_OK_WRITE   2
 
#define MEMORY_NOT_FULL_PAGE   256
 
#define DEVICE_ACCESS(x)
 

Functions

uint64_t memory_readmax64 (struct cpu *cpu, unsigned char *buf, int len)
 
void memory_writemax64 (struct cpu *cpu, unsigned char *buf, int len, uint64_t data)
 
void * zeroed_alloc (size_t s)
 
struct memorymemory_new (uint64_t physical_max, int arch)
 
int memory_points_to_string (struct cpu *cpu, struct memory *mem, uint64_t addr, int min_string_length)
 
char * memory_conv_to_string (struct cpu *cpu, struct memory *mem, uint64_t addr, char *buf, int bufsize)
 
unsigned char * memory_paddr_to_hostaddr (struct memory *mem, uint64_t paddr, int writeflag)
 
void memory_device_dyntrans_access (struct cpu *, struct memory *mem, void *extra, uint64_t *low, uint64_t *high)
 
void memory_device_update_data (struct memory *mem, void *extra, unsigned char *data)
 
void memory_device_register (struct memory *mem, const char *, uint64_t baseaddr, uint64_t len, int(*f)(struct cpu *, struct memory *, uint64_t, unsigned char *, size_t, int, void *), void *extra, int flags, unsigned char *dyntrans_data)
 
void memory_device_remove (struct memory *mem, int i)
 
uint64_t memory_checksum (struct memory *mem)
 
void dump_mem_string (struct cpu *cpu, uint64_t addr)
 
void store_string (struct cpu *cpu, uint64_t addr, const char *s)
 
int store_64bit_word (struct cpu *cpu, uint64_t addr, uint64_t data64)
 
int store_32bit_word (struct cpu *cpu, uint64_t addr, uint64_t data32)
 
int store_16bit_word (struct cpu *cpu, uint64_t addr, uint64_t data16)
 
void store_byte (struct cpu *cpu, uint64_t addr, uint8_t data)
 
void store_64bit_word_in_host (struct cpu *cpu, unsigned char *data, uint64_t data32)
 
void store_32bit_word_in_host (struct cpu *cpu, unsigned char *data, uint64_t data32)
 
void store_16bit_word_in_host (struct cpu *cpu, unsigned char *data, uint16_t data16)
 
uint64_t load_64bit_word (struct cpu *cpu, uint64_t addr)
 
uint32_t load_32bit_word (struct cpu *cpu, uint64_t addr)
 
uint16_t load_16bit_word (struct cpu *cpu, uint64_t addr)
 
void store_buf (struct cpu *cpu, uint64_t addr, const char *s, size_t len)
 
void add_environment_string (struct cpu *cpu, const char *s, uint64_t *addr)
 
void add_environment_string_dual (struct cpu *cpu, uint64_t *ptrp, uint64_t *addrp, const char *s1, const char *s2)
 
void store_pointer_and_advance (struct cpu *cpu, uint64_t *addrp, uint64_t data, int flag64)
 
void memory_warn_about_unimplemented_addr (struct cpu *cpu, struct memory *mem, int writeflag, uint64_t paddr, uint8_t *data, size_t len)
 

Macro Definition Documentation

◆ BITS_PER_MEMBLOCK

#define BITS_PER_MEMBLOCK   20

Definition at line 92 of file memory.h.

Referenced by memory_checksum(), memory_new(), memory_paddr_to_hostaddr(), and MEMORY_RW().

◆ BITS_PER_PAGETABLE

#define BITS_PER_PAGETABLE   20

Definition at line 91 of file memory.h.

Referenced by memory_checksum(), memory_new(), and memory_paddr_to_hostaddr().

◆ CACHE_DATA

#define CACHE_DATA   0

◆ CACHE_FLAGS_MASK

#define CACHE_FLAGS_MASK   0x3

Definition at line 124 of file memory.h.

Referenced by MEMORY_RW().

◆ CACHE_INSTRUCTION

#define CACHE_INSTRUCTION   1

Definition at line 122 of file memory.h.

Referenced by arm_cpu_interpret_thumb_SLOW(), MEMORY_RW(), mips_cpu_new(), and X().

◆ CACHE_NONE

#define CACHE_NONE   2

◆ DEFAULT_RAM_IN_MB

#define DEFAULT_RAM_IN_MB   32

Definition at line 40 of file memory.h.

Referenced by machine_memsize_fix().

◆ DEVICE_ACCESS

#define DEVICE_ACCESS (   x)
Value:
int dev_ ## x ## _access(struct cpu *cpu, \
struct memory *mem, uint64_t relative_addr, unsigned char *data, \
size_t len, int writeflag, void *extra)
u_short data
Definition: siireg.h:79
Definition: cpu.h:326
Definition: memory.h:75

Definition at line 148 of file memory.h.

◆ DM_DEFAULT

#define DM_DEFAULT   0

◆ DM_DYNTRANS_OK

#define DM_DYNTRANS_OK   1

◆ DM_DYNTRANS_WRITE_OK

#define DM_DYNTRANS_WRITE_OK   2

◆ DM_EMULATED_RAM

#define DM_EMULATED_RAM   8

Definition at line 134 of file memory.h.

Referenced by dev_ram_init(), memory_device_register(), and MEMORY_RW().

◆ DM_READS_HAVE_NO_SIDE_EFFECTS

#define DM_READS_HAVE_NO_SIDE_EFFECTS   4

Definition at line 133 of file memory.h.

Referenced by dev_le_init(), dev_ram_init(), dev_vga_init(), DEVINIT(), and MEMORY_RW().

◆ FLAG_INSTR

#define FLAG_INSTR   4

◆ FLAG_NOEXCEPTIONS

#define FLAG_NOEXCEPTIONS   2

Definition at line 137 of file memory.h.

Referenced by arm_translate_v2p_mmu(), m88k_translate_v2p(), MEMORY_RW(), and TRANSLATE_ADDRESS().

◆ FLAG_WRITEFLAG

#define FLAG_WRITEFLAG   1

◆ MAX_BITS

#define MAX_BITS   40

Definition at line 93 of file memory.h.

Referenced by memory_new(), and memory_paddr_to_hostaddr().

◆ MEM_DOWNGRADE

#define MEM_DOWNGRADE   128

Definition at line 118 of file memory.h.

◆ MEM_PCI_LITTLE_ENDIAN

#define MEM_PCI_LITTLE_ENDIAN   128

Definition at line 97 of file memory.h.

Referenced by DEVICE_ACCESS(), memory_readmax64(), and memory_writemax64().

◆ MEM_READ

#define MEM_READ   0

◆ MEM_WRITE

#define MEM_WRITE   1

◆ MEMORY_ACCESS_FAILED

#define MEMORY_ACCESS_FAILED   0

Definition at line 140 of file memory.h.

Referenced by MEMORY_RW().

◆ MEMORY_ACCESS_OK

#define MEMORY_ACCESS_OK   1

Definition at line 141 of file memory.h.

Referenced by MEMORY_RW(), and X().

◆ MEMORY_ACCESS_OK_WRITE

#define MEMORY_ACCESS_OK_WRITE   2

Definition at line 142 of file memory.h.

◆ MEMORY_NOT_FULL_PAGE

#define MEMORY_NOT_FULL_PAGE   256

Definition at line 143 of file memory.h.

Referenced by MEMORY_RW().

◆ MEMORY_USER_ACCESS

#define MEMORY_USER_ACCESS   64 /* for ARM and M88K */

Definition at line 127 of file memory.h.

Referenced by A__NAME__general(), arm_translate_v2p_mmu(), m88k_translate_v2p(), and MEMORY_RW().

◆ NO_EXCEPTIONS

#define NO_EXCEPTIONS   16

◆ PHYSICAL

#define PHYSICAL   32

Function Documentation

◆ add_environment_string()

void add_environment_string ( struct cpu cpu,
const char *  s,
uint64_t *  addr 
)

Definition at line 710 of file memory.cc.

References store_string(), and strlen().

Referenced by MACHINE_SETUP().

◆ add_environment_string_dual()

void add_environment_string_dual ( struct cpu cpu,
uint64_t *  ptrp,
uint64_t *  addrp,
const char *  s1,
const char *  s2 
)

Definition at line 723 of file memory.cc.

References addr, store_32bit_word(), store_string(), and strlen().

Referenced by yamon_machine_setup().

◆ dump_mem_string()

void dump_mem_string ( struct cpu cpu,
uint64_t  addr 
)

◆ load_16bit_word()

uint16_t load_16bit_word ( struct cpu cpu,
uint64_t  addr 
)

Definition at line 923 of file memory.cc.

References cpu::byte_order, CACHE_DATA, data, EMUL_LITTLE_ENDIAN, cpu::mem, MEM_READ, and cpu::memory_rw.

◆ load_32bit_word()

uint32_t load_32bit_word ( struct cpu cpu,
uint64_t  addr 
)

◆ load_64bit_word()

uint64_t load_64bit_word ( struct cpu cpu,
uint64_t  addr 
)

Definition at line 875 of file memory.cc.

References cpu::byte_order, CACHE_DATA, data, EMUL_LITTLE_ENDIAN, cpu::mem, MEM_READ, and cpu::memory_rw.

Referenced by alpha_palcode().

◆ memory_checksum()

uint64_t memory_checksum ( struct memory mem)

Definition at line 563 of file memory.cc.

References BITS_PER_MEMBLOCK, BITS_PER_PAGETABLE, if(), memory::pagetable, and UPDATE_CHECKSUM.

Referenced by cpu_functioncall_trace().

◆ memory_conv_to_string()

char* memory_conv_to_string ( struct cpu cpu,
struct memory mem,
uint64_t  addr,
char *  buf,
int  bufsize 
)

Definition at line 220 of file memory.cc.

References CACHE_NONE, MEM_READ, cpu::memory_rw, and NO_EXCEPTIONS.

◆ memory_device_dyntrans_access()

void memory_device_dyntrans_access ( struct cpu ,
struct memory mem,
void *  extra,
uint64_t *  low,
uint64_t *  high 
)

◆ memory_device_register()

void memory_device_register ( struct memory mem,
const char *  ,
uint64_t  baseaddr,
uint64_t  len,
int(*)(struct cpu *, struct memory *, uint64_t, unsigned char *, size_t, int, void *)  f,
void *  extra,
int  flags,
unsigned char *  dyntrans_data 
)

◆ memory_device_remove()

void memory_device_remove ( struct memory mem,
int  i 
)

◆ memory_device_update_data()

void memory_device_update_data ( struct memory mem,
void *  extra,
unsigned char *  data 
)

◆ memory_new()

struct memory* memory_new ( uint64_t  physical_max,
int  arch 
)

◆ memory_paddr_to_hostaddr()

unsigned char* memory_paddr_to_hostaddr ( struct memory mem,
uint64_t  paddr,
int  writeflag 
)

◆ memory_points_to_string()

int memory_points_to_string ( struct cpu cpu,
struct memory mem,
uint64_t  addr,
int  min_string_length 
)

Definition at line 190 of file memory.cc.

References CACHE_NONE, MEM_READ, cpu::memory_rw, and NO_EXCEPTIONS.

◆ memory_readmax64()

uint64_t memory_readmax64 ( struct cpu cpu,
unsigned char *  buf,
int  len 
)

Definition at line 55 of file memory.cc.

References cpu::byte_order, EMUL_BIG_ENDIAN, EMUL_LITTLE_ENDIAN, and MEM_PCI_LITTLE_ENDIAN.

Referenced by DEVICE_ACCESS().

◆ memory_warn_about_unimplemented_addr()

void memory_warn_about_unimplemented_addr ( struct cpu cpu,
struct memory mem,
int  writeflag,
uint64_t  paddr,
uint8_t *  data,
size_t  len 
)

◆ memory_writemax64()

void memory_writemax64 ( struct cpu cpu,
unsigned char *  buf,
int  len,
uint64_t  data 
)

Definition at line 89 of file memory.cc.

References cpu::byte_order, EMUL_LITTLE_ENDIAN, and MEM_PCI_LITTLE_ENDIAN.

Referenced by DEVICE_ACCESS().

◆ store_16bit_word()

int store_16bit_word ( struct cpu cpu,
uint64_t  addr,
uint64_t  data16 
)

◆ store_16bit_word_in_host()

void store_16bit_word_in_host ( struct cpu cpu,
unsigned char *  data,
uint16_t  data16 
)

Definition at line 992 of file memory.cc.

References cpu::byte_order, and EMUL_LITTLE_ENDIAN.

Referenced by MACHINE_SETUP(), and mvmeprom_init().

◆ store_32bit_word()

int store_32bit_word ( struct cpu cpu,
uint64_t  addr,
uint64_t  data32 
)

◆ store_32bit_word_in_host()

void store_32bit_word_in_host ( struct cpu cpu,
unsigned char *  data,
uint64_t  data32 
)

Definition at line 973 of file memory.cc.

References cpu::byte_order, and EMUL_LITTLE_ENDIAN.

Referenced by arcbios_add_memory_descriptor(), and MACHINE_SETUP().

◆ store_64bit_word()

int store_64bit_word ( struct cpu cpu,
uint64_t  addr,
uint64_t  data64 
)

◆ store_64bit_word_in_host()

void store_64bit_word_in_host ( struct cpu cpu,
unsigned char *  data,
uint64_t  data32 
)

Definition at line 945 of file memory.cc.

References cpu::byte_order, and EMUL_LITTLE_ENDIAN.

Referenced by arcbios_add_memory_descriptor(), and MACHINE_SETUP().

◆ store_buf()

void store_buf ( struct cpu cpu,
uint64_t  addr,
const char *  s,
size_t  len 
)

◆ store_byte()

void store_byte ( struct cpu cpu,
uint64_t  addr,
uint8_t  data 
)

Definition at line 679 of file memory.cc.

References addr, CACHE_DATA, cpu::mem, MEM_WRITE, and cpu::memory_rw.

Referenced by MACHINE_SETUP(), store_buf(), and store_string().

◆ store_pointer_and_advance()

void store_pointer_and_advance ( struct cpu cpu,
uint64_t *  addrp,
uint64_t  data,
int  flag64 
)

Definition at line 855 of file memory.cc.

References addr, store_32bit_word(), and store_64bit_word().

◆ store_string()

void store_string ( struct cpu cpu,
uint64_t  addr,
const char *  s 
)

Definition at line 695 of file memory.cc.

References store_byte().

Referenced by add_environment_string(), add_environment_string_dual(), and MACHINE_SETUP().

◆ zeroed_alloc()

void* zeroed_alloc ( size_t  s)

Definition at line 118 of file memory.cc.

References CHECK_ALLOCATION.

Referenced by cpu_create_or_reset_tc(), cpu_new(), DEVINIT(), and mips_coproc_new().


Generated on Fri Dec 7 2018 19:52:23 for GXemul by doxygen 1.8.13