memory.cc File Reference

Back to the index.

Macros | Functions | Variables
memory.cc File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>
#include "cpu.h"
#include "machine.h"
#include "memory.h"
#include "misc.h"

Go to the source code of this file.

Macros

#define UPDATE_CHECKSUM(value)
 
#define DUMP_MEM_STRING_MAX   45
 

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)
 
void memory_device_dyntrans_access (struct cpu *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 *device_name, 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)
 
unsigned char * memory_paddr_to_hostaddr (struct memory *mem, uint64_t paddr, int writeflag)
 
uint64_t memory_checksum (struct memory *mem)
 
void memory_warn_about_unimplemented_addr (struct cpu *cpu, struct memory *mem, int writeflag, uint64_t paddr, uint8_t *data, size_t len)
 
void dump_mem_string (struct cpu *cpu, uint64_t addr)
 
void store_byte (struct cpu *cpu, uint64_t addr, uint8_t data)
 
void store_string (struct cpu *cpu, uint64_t addr, const char *s)
 
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)
 
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_buf (struct cpu *cpu, uint64_t addr, const char *s, size_t len)
 
void store_pointer_and_advance (struct cpu *cpu, uint64_t *addrp, uint64_t data, int flag64)
 
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_64bit_word_in_host (struct cpu *cpu, unsigned char *data, uint64_t data64)
 
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)
 

Variables

int verbose
 
int quiet_mode
 

Macro Definition Documentation

◆ DUMP_MEM_STRING_MAX

#define DUMP_MEM_STRING_MAX   45

Definition at line 656 of file memory.cc.

◆ UPDATE_CHECKSUM

#define UPDATE_CHECKSUM (   value)
Value:
{ \
internal_state -= 0x118c7771c0c0a77fULL; \
internal_state = ((internal_state + (value)) << 7) ^ \
(checksum >> 11) ^ ((checksum - (value)) << 3) ^ \
(internal_state - checksum) ^ ((value) - internal_state); \
checksum ^= internal_state; \
}

Definition at line 548 of file memory.cc.

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 addr, 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 
)

Definition at line 656 of file memory.cc.

Referenced by arcbios_emul(), and arcbios_private_emul().

◆ load_16bit_word()

uint16_t load_16bit_word ( struct cpu cpu,
uint64_t  addr 
)

Definition at line 923 of file memory.cc.

References addr, 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 addr, 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 addr, CACHE_NONE, MEM_READ, cpu::memory_rw, and NO_EXCEPTIONS.

◆ memory_device_dyntrans_access()

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

◆ memory_device_register()

void memory_device_register ( struct memory mem,
const char *  device_name,
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 addr, 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, data, 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, data, 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, data, 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  data64 
)

Definition at line 945 of file memory.cc.

References cpu::byte_order, data, 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, 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, data, 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 addr, and 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().

Variable Documentation

◆ quiet_mode

int quiet_mode

Definition at line 78 of file main.cc.

Referenced by memory_warn_about_unimplemented_addr().

◆ verbose

int verbose

Definition at line 77 of file main.cc.

Referenced by memory_device_register().


Generated on Tue Aug 25 2020 19:25:06 for GXemul by doxygen 1.8.18