提交 e0bcb9ca 编写于 作者: A Aurelien Jarno

sh7750: handle MMUCR TI bit

When the MMUCR TI bit is set, all the UTLB and ITLB entries should be
flushed.
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 434254aa
...@@ -396,7 +396,10 @@ static void sh7750_mem_writel(void *opaque, target_phys_addr_t addr, ...@@ -396,7 +396,10 @@ static void sh7750_mem_writel(void *opaque, target_phys_addr_t addr,
portb_changed(s, temp); portb_changed(s, temp);
return; return;
case SH7750_MMUCR_A7: case SH7750_MMUCR_A7:
s->cpu->mmucr = mem_value; if (mem_value & MMUCR_TI) {
cpu_sh4_invalidate_tlb(s->cpu);
}
s->cpu->mmucr = mem_value & ~MMUCR_TI;
return; return;
case SH7750_PTEH_A7: case SH7750_PTEH_A7:
/* If asid changes, clear all registered tlb entries. */ /* If asid changes, clear all registered tlb entries. */
......
...@@ -167,6 +167,7 @@ int cpu_sh4_handle_mmu_fault(CPUSH4State * env, target_ulong address, int rw, ...@@ -167,6 +167,7 @@ int cpu_sh4_handle_mmu_fault(CPUSH4State * env, target_ulong address, int rw,
void do_interrupt(CPUSH4State * env); void do_interrupt(CPUSH4State * env);
void sh4_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)); void sh4_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
void cpu_sh4_invalidate_tlb(CPUSH4State *s);
void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr, void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr,
uint32_t mem_value); uint32_t mem_value);
...@@ -222,6 +223,7 @@ enum { ...@@ -222,6 +223,7 @@ enum {
/* MMU control register */ /* MMU control register */
#define MMUCR 0x1F000010 #define MMUCR 0x1F000010
#define MMUCR_AT (1<<0) #define MMUCR_AT (1<<0)
#define MMUCR_TI (1<<2)
#define MMUCR_SV (1<<8) #define MMUCR_SV (1<<8)
#define MMUCR_URC_BITS (6) #define MMUCR_URC_BITS (6)
#define MMUCR_URC_OFFSET (10) #define MMUCR_URC_OFFSET (10)
......
...@@ -574,6 +574,24 @@ void cpu_load_tlb(CPUSH4State * env) ...@@ -574,6 +574,24 @@ void cpu_load_tlb(CPUSH4State * env)
entry->tc = (uint8_t)cpu_ptea_tc(env->ptea); entry->tc = (uint8_t)cpu_ptea_tc(env->ptea);
} }
void cpu_sh4_invalidate_tlb(CPUSH4State *s)
{
int i;
/* UTLB */
for (i = 0; i < UTLB_SIZE; i++) {
tlb_t * entry = &s->utlb[i];
entry->v = 0;
}
/* ITLB */
for (i = 0; i < UTLB_SIZE; i++) {
tlb_t * entry = &s->utlb[i];
entry->v = 0;
}
tlb_flush(s, 1);
}
void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr, void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr,
uint32_t mem_value) uint32_t mem_value)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册