SH4: Added "TLB Invalidate Bit" management to MMUCR register
PATCH 1/1 SH4: Added "TLB Invalidate Bit" management to MMUCR register
SH4: Added "TLB Invalidate Bit" management to MMUCR register
Signed-off-by Lionel Landwerlin <[email protected]>
--- hw/sh7750.c | 5 +++++ target-sh4/cpu.h | 2 ++ target-sh4/helper.c | 13 ++++++++++++- 3 files changed, 19 insertions(+), 1 deletions(-)
hw/sh7750.c +5 -0
@@ -397,6 +397,11 @@ static void sh7750_mem_writel(void *opaque, target_phys_addr_t addr,portb_changed (s, temp);return ;case SH7750_MMUCR_A7 : +if (s->cpu->mmucr &MMUCR_TLB_INVALIDATE ) + { +cpu_sh4_tlbs_invalidate (s->cpu); + mem_value |= ~MMUCR_TLB_INVALIDATE ; + } s->cpu->mmucr = mem_value;return ;case SH7750_PTEH_A7 :
target-sh4/cpu.h +2 -0
@@ -171,6 +171,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr, uint32_t mem_value);int cpu_sh4_is_cached (CPUSH4State * env,target_ulong addr); +void cpu_sh4_tlbs_invalidate (CPUSH4State * env);static inline void cpu_set_tls (CPUSH4State *env,target_ulong newtls) {
@@ -222,6 +223,7 @@ enum {/* MMU control register */ #define MMUCR 0x1F000010#define MMUCR_AT (1<<0) +#define MMUCR_TLB_INVALIDATE (1<<2)#define MMUCR_SV (1<<8)#define MMUCR_URC_BITS (6)#define MMUCR_URC_OFFSET (10)
target-sh4/helper.c +12 -1
@@ -631,7 +631,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr,if (needs_tlb_flush)tlb_flush_page (s, vpn <<10 ); - + }else {int index = (addr &0x00003f00 ) >>8 ;tlb_t * entry = &s->utlb[index];
@@ -694,4 +694,15 @@ int cpu_sh4_is_cached(CPUSH4State * env, target_ulong addr) return 0; } +void cpu_sh4_tlbs_invalidate (CPUSH4State * env) +{ +int i; + +for (i =0 ; i <ITLB_SIZE ; i++) + env->itlb[i].v =0 ; + +for (i =0 ; i <UTLB_SIZE ; i++) + env->utlb[i].v =0 ; +} +#endif
Signature · 5 lines
1.6.2.4 -- Lionel Landwerlin <[email protected]>
SH4: Added "TLB Invalidate Bit" management to MMUCR register
Renamed MMUCR_TLB_INVALIDATE to MMUCR_TI (just like datasheet).
Signed-off-by Lionel Landwerlin <[email protected]>
--- hw/sh7750.c | 5 +++++ target-sh4/cpu.h | 2 ++ target-sh4/helper.c | 13 ++++++++++++- 3 files changed, 19 insertions(+), 1 deletions(-)
hw/sh7750.c +5 -0
@@ -397,6 +397,11 @@ static void sh7750_mem_writel(void *opaque, target_phys_addr_t addr,portb_changed (s, temp);return ;case SH7750_MMUCR_A7 : +if (s->cpu->mmucr &MMUCR_TI ) + { +cpu_sh4_tlbs_invalidate (s->cpu); + mem_value |= ~MMUCR_TI ; + } s->cpu->mmucr = mem_value;return ;case SH7750_PTEH_A7 :
target-sh4/cpu.h +2 -0
@@ -171,6 +171,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr, uint32_t mem_value);int cpu_sh4_is_cached (CPUSH4State * env,target_ulong addr); +void cpu_sh4_tlbs_invalidate (CPUSH4State * env);static inline void cpu_set_tls (CPUSH4State *env,target_ulong newtls) {
@@ -222,6 +223,7 @@ enum {/* MMU control register */ #define MMUCR 0x1F000010#define MMUCR_AT (1<<0) +#define MMUCR_TI (1<<2)#define MMUCR_SV (1<<8)#define MMUCR_URC_BITS (6)#define MMUCR_URC_OFFSET (10)
target-sh4/helper.c +12 -1
@@ -631,7 +631,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr,if (needs_tlb_flush)tlb_flush_page (s, vpn <<10 ); - + }else {int index = (addr &0x00003f00 ) >>8 ;tlb_t * entry = &s->utlb[index];
@@ -694,4 +694,15 @@ int cpu_sh4_is_cached(CPUSH4State * env, target_ulong addr) return 0; } +void cpu_sh4_tlbs_invalidate (CPUSH4State * env) +{ +int i; + +for (i =0 ; i <ITLB_SIZE ; i++) + env->itlb[i].v =0 ; + +for (i =0 ; i <UTLB_SIZE ; i++) + env->utlb[i].v =0 ; +} +#endif
Signature · 5 lines
1.6.2.4 -- Lionel Landwerlin <[email protected]>
Quoted 2 lines · Lionel Landwerlin
SH4: Added "TLB Invalidate Bit" management to MMUCR register
ping ?
Signature · 1 line
Lionel Landwerlin <[email protected]>