28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: cpu_sh.h,v 1.4 2005/09/04 13:06:11 debug Exp $ |
* $Id: cpu_sh.h,v 1.10 2005/11/16 21:15:19 debug Exp $ |
32 |
*/ |
*/ |
33 |
|
|
34 |
#include "misc.h" |
#include "misc.h" |
53 |
|
|
54 |
/* Translation cache struct for each physical page: */ |
/* Translation cache struct for each physical page: */ |
55 |
struct sh_tc_physpage { |
struct sh_tc_physpage { |
56 |
|
struct sh_instr_call ics[SH_IC_ENTRIES_PER_PAGE + 1]; |
57 |
uint32_t next_ofs; /* or 0 for end of chain */ |
uint32_t next_ofs; /* or 0 for end of chain */ |
|
uint64_t physaddr; |
|
58 |
int flags; |
int flags; |
59 |
struct sh_instr_call ics[SH_IC_ENTRIES_PER_PAGE + 1]; |
uint64_t physaddr; |
60 |
}; |
}; |
61 |
|
|
62 |
#define SH_N_VPH_ENTRIES 1048576 |
#define SH_N_VPH_ENTRIES 1048576 |
63 |
|
|
64 |
#define SH_MAX_VPH_TLB_ENTRIES 256 |
#define SH_MAX_VPH_TLB_ENTRIES 256 |
65 |
struct sh_vpg_tlb_entry { |
struct sh_vpg_tlb_entry { |
66 |
int valid; |
uint8_t valid; |
67 |
int writeflag; |
uint8_t writeflag; |
68 |
int64_t timestamp; |
int64_t timestamp; |
|
unsigned char *host_page; |
|
69 |
uint64_t vaddr_page; |
uint64_t vaddr_page; |
70 |
uint64_t paddr_page; |
uint64_t paddr_page; |
71 |
|
unsigned char *host_page; |
72 |
}; |
}; |
73 |
|
|
74 |
struct sh_cpu { |
struct sh_cpu { |
89 |
struct sh_instr_call *cur_ic_page; |
struct sh_instr_call *cur_ic_page; |
90 |
struct sh_instr_call *next_ic; |
struct sh_instr_call *next_ic; |
91 |
|
|
92 |
|
void (*combination_check)(struct cpu *, |
93 |
|
struct sh_instr_call *, int low_addr); |
94 |
|
|
95 |
/* |
/* |
96 |
* Virtual -> physical -> host address translation: |
* Virtual -> physical -> host address translation: |
101 |
*/ |
*/ |
102 |
|
|
103 |
struct sh_vpg_tlb_entry vph_tlb_entry[SH_MAX_VPH_TLB_ENTRIES]; |
struct sh_vpg_tlb_entry vph_tlb_entry[SH_MAX_VPH_TLB_ENTRIES]; |
104 |
unsigned char *host_load[SH_N_VPH_ENTRIES]; |
unsigned char *host_load[SH_N_VPH_ENTRIES]; |
105 |
unsigned char *host_store[SH_N_VPH_ENTRIES]; |
unsigned char *host_store[SH_N_VPH_ENTRIES]; |
106 |
uint32_t phys_addr[SH_N_VPH_ENTRIES]; |
uint32_t phys_addr[SH_N_VPH_ENTRIES]; |
107 |
struct sh_tc_physpage *phys_page[SH_N_VPH_ENTRIES]; |
struct sh_tc_physpage *phys_page[SH_N_VPH_ENTRIES]; |
108 |
|
|
109 |
|
uint32_t phystranslation[SH_N_VPH_ENTRIES/32]; |
110 |
|
uint8_t vaddr_to_tlbindex[SH_N_VPH_ENTRIES]; |
111 |
}; |
}; |
112 |
|
|
113 |
|
|
114 |
/* cpu_sh.c: */ |
/* cpu_sh.c: */ |
115 |
void sh_update_translation_table(struct cpu *cpu, uint64_t vaddr_page, |
void sh_update_translation_table(struct cpu *cpu, uint64_t vaddr_page, |
116 |
unsigned char *host_page, int writeflag, uint64_t paddr_page); |
unsigned char *host_page, int writeflag, uint64_t paddr_page); |
117 |
void sh_invalidate_translation_caches_paddr(struct cpu *cpu, uint64_t, int); |
void sh_invalidate_translation_caches(struct cpu *cpu, uint64_t, int); |
118 |
void sh_invalidate_code_translation(struct cpu *cpu, uint64_t, int); |
void sh_invalidate_code_translation(struct cpu *cpu, uint64_t, int); |
119 |
void sh32_update_translation_table(struct cpu *cpu, uint64_t vaddr_page, |
void sh32_update_translation_table(struct cpu *cpu, uint64_t vaddr_page, |
120 |
unsigned char *host_page, int writeflag, uint64_t paddr_page); |
unsigned char *host_page, int writeflag, uint64_t paddr_page); |
121 |
void sh32_invalidate_translation_caches_paddr(struct cpu *cpu, uint64_t, int); |
void sh32_invalidate_translation_caches(struct cpu *cpu, uint64_t, int); |
122 |
void sh32_invalidate_code_translation(struct cpu *cpu, uint64_t, int); |
void sh32_invalidate_code_translation(struct cpu *cpu, uint64_t, int); |
123 |
int sh_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr, |
int sh_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr, |
124 |
unsigned char *data, size_t len, int writeflag, int cache_flags); |
unsigned char *data, size_t len, int writeflag, int cache_flags); |