2 |
#define MEMORY_H |
#define MEMORY_H |
3 |
|
|
4 |
/* |
/* |
5 |
* Copyright (C) 2004-2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2004-2006 Anders Gavare. All rights reserved. |
6 |
* |
* |
7 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
8 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: memory.h,v 1.47 2006/01/01 13:17:18 debug Exp $ |
* $Id: memory.h,v 1.50 2006/06/24 21:47:24 debug Exp $ |
32 |
* |
* |
33 |
* Memory controller related functions. |
* Memory controller related functions. |
34 |
*/ |
*/ |
45 |
struct cpu; |
struct cpu; |
46 |
struct translation_page_entry; |
struct translation_page_entry; |
47 |
|
|
|
/* For bintrans: */ |
|
|
#define MAX_QUICK_JUMPS 8 |
|
|
|
|
48 |
struct memory { |
struct memory { |
49 |
uint64_t physical_max; |
uint64_t physical_max; |
50 |
void *pagetable; |
void *pagetable; |
70 |
uint64_t dev_dyntrans_write_high[MAX_DEVICES]; |
uint64_t dev_dyntrans_write_high[MAX_DEVICES]; |
71 |
|
|
72 |
int dev_dyntrans_alignment; |
int dev_dyntrans_alignment; |
|
|
|
|
|
|
|
/* |
|
|
* NOTE/TODO: This bintrans was for MIPS only. Ugly. :-/ |
|
|
*/ |
|
|
|
|
|
/* |
|
|
* translation_code_chunk_space is a large chunk of (linear) memory |
|
|
* where translated code chunks and translation_entrys are stored. |
|
|
* When this is filled, translation is restart from scratch (by |
|
|
* resetting translation_code_chunk_space_head to 0, and removing all |
|
|
* translation entries). |
|
|
* |
|
|
* (Using a static memory region like this is somewhat inspired by |
|
|
* the QEMU web pages, |
|
|
* http://fabrice.bellard.free.fr/qemu/qemu-tech.html#SEC13) |
|
|
*/ |
|
|
|
|
|
unsigned char *translation_code_chunk_space; |
|
|
size_t translation_code_chunk_space_head; |
|
|
|
|
|
int bintrans_32bit_only; |
|
|
|
|
|
struct translation_page_entry **translation_page_entry_array; |
|
|
|
|
|
unsigned char *quick_jump_host_address[MAX_QUICK_JUMPS]; |
|
|
size_t quick_jump_page_offset[MAX_QUICK_JUMPS]; |
|
|
int n_quick_jumps; |
|
|
int quick_jumps_index; |
|
73 |
}; |
}; |
74 |
|
|
75 |
#define BITS_PER_PAGETABLE 20 |
#define BITS_PER_PAGETABLE 20 |
95 |
unsigned char *memory_paddr_to_hostaddr(struct memory *mem, |
unsigned char *memory_paddr_to_hostaddr(struct memory *mem, |
96 |
uint64_t paddr, int writeflag); |
uint64_t paddr, int writeflag); |
97 |
|
|
|
/* memory_fast_v2h.c: */ |
|
|
unsigned char *fast_vaddr_to_hostaddr(struct cpu *cpu, uint64_t vaddr, |
|
|
int writeflag); |
|
|
|
|
|
/* MIPS stuff: */ |
|
|
int translate_address_mmu3k(struct cpu *cpu, uint64_t vaddr, |
|
|
uint64_t *return_addr, int flags); |
|
|
int translate_address_mmu8k(struct cpu *cpu, uint64_t vaddr, |
|
|
uint64_t *return_addr, int flags); |
|
|
int translate_address_mmu10k(struct cpu *cpu, uint64_t vaddr, |
|
|
uint64_t *return_addr, int flags); |
|
|
int translate_address_mmu4100(struct cpu *cpu, uint64_t vaddr, |
|
|
uint64_t *return_addr, int flags); |
|
|
int translate_address_generic(struct cpu *cpu, uint64_t vaddr, |
|
|
uint64_t *return_addr, int flags); |
|
|
|
|
98 |
|
|
99 |
/* Writeflag: */ |
/* Writeflag: */ |
100 |
#define MEM_READ 0 |
#define MEM_READ 0 |
142 |
void *extra, int flags, unsigned char *dyntrans_data); |
void *extra, int flags, unsigned char *dyntrans_data); |
143 |
void memory_device_remove(struct memory *mem, int i); |
void memory_device_remove(struct memory *mem, int i); |
144 |
|
|
145 |
|
uint64_t memory_checksum(struct memory *mem); |
146 |
|
|
147 |
|
|
148 |
#endif /* MEMORY_H */ |
#endif /* MEMORY_H */ |