target/sh4: Remove all uses of target_ulong type
cover target/sh4: Remove all uses of target_ulong type
Remove the left over target_ulong uses in SH4 frontend.
Philippe Mathieu-Daudé (6):
target/sh4: Convert CPUSH4State::sr register to uint32_t type target/sh4: Remove target_ulong use in cpu_sh4_is_cached() target/sh4: Use hwaddr type for hardware addresses target/sh4: Remove target_ulong uses in superh_cpu_get_phys_page_debug target/sh4: Use vaddr type for TLB virtual addresses target/sh4: Remove target_ulong use in gen_goto_tb()
target/sh4/cpu.h | 6 +++--- target/sh4/helper.c | 34 +++++++++++++++++----------------- target/sh4/translate.c | 6 +++--- 3 files changed, 23 insertions(+), 23 deletions(-)
Signature · 1 line
2.51.0
PATCH 1/6 target/sh4: Convert CPUSH4State::sr register to uint32_t type
Since its introduction in commit fdf9b3e831e the %SR register is a uint32_t type.
--- target/sh4/cpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/sh4/cpu.h +2 -2
@@ -365,14 +365,14 @@ static inline int cpu_ptel_pr (uint32_t ptel)#define PTEA_TC (1 << 3)#define cpu_ptea_tc (ptea) (((ptea) & PTEA_TC) >> 3) -static inline target_ulong cpu_read_sr (CPUSH4State *env) +static inline uint32_t cpu_read_sr (CPUSH4State *env) {return env->sr | (env->sr_m <<SR_M ) | (env->sr_q <<SR_Q ) | (env->sr_t <<SR_T ); } -static inline void cpu_write_sr (CPUSH4State *env,target_ulong sr) +static inline void cpu_write_sr (CPUSH4State *env,uint32_t sr) { env->sr_m = (sr >>SR_M ) &1 ; env->sr_q = (sr >>SR_Q ) &1 ;
Signature · 1 line
2.51.0
Re: [PATCH 1/6] target/sh4: Convert CPUSH4State::sr register to uint32_t type
Quoted 7 lines · Philippe Mathieu-Daudé
Since its introduction in commit
fdf9b3e831ethe %SR register is auint32_ttype.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sh4/cpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
PATCH 2/6 target/sh4: Remove target_ulong use in cpu_sh4_is_cached()
In reply to Philippe Mathieu-DaudéSince commit 852d481faf7 ("SH: Improve movca.l/ocbi emulation") helper_movcal() pass a uint32_t type to cpu_sh4_is_cached().
--- target/sh4/cpu.h | 2 +- target/sh4/helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
target/sh4/cpu.h +1 -1
@@ -277,7 +277,7 @@ void cpu_sh4_write_mmaped_utlb_data(CPUSH4State *s, hwaddr addr, uint32_t mem_value);#endif -int cpu_sh4_is_cached (CPUSH4State * env,target_ulong addr); +int cpu_sh4_is_cached (CPUSH4State * env,uint32_t addr);void cpu_load_tlb (CPUSH4State * env);
target/sh4/helper.c +2 -2
@@ -47,7 +47,7 @@#if defined(CONFIG_USER_ONLY ) -int cpu_sh4_is_cached (CPUSH4State *env,target_ulong addr) +int cpu_sh4_is_cached (CPUSH4State *env,uint32_t addr) {/* For user mode, only U0 area is cacheable. */ return !(addr &0x80000000 );
@@ -735,7 +735,7 @@ void cpu_sh4_write_mmaped_utlb_data(CPUSH4State *s, hwaddr addr, } } -int cpu_sh4_is_cached (CPUSH4State * env,target_ulong addr) +int cpu_sh4_is_cached (CPUSH4State * env,uint32_t addr) {int n;int use_asid = !(env->mmucr &MMUCR_SV ) || !(env->sr & (1u <<SR_MD ));
Signature · 1 line
2.51.0
Re: [PATCH 2/6] target/sh4: Remove target_ulong use in cpu_sh4_is_cached()
Quoted 8 lines · Philippe Mathieu-Daudé
Since commit
852d481faf7("SH: Improve movca.l/ocbi emulation")helper_movcal()pass auint32_ttype tocpu_sh4_is_cached().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sh4/cpu.h | 2 +- target/sh4/helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
PATCH 3/6 target/sh4: Use hwaddr type for hardware addresses
In reply to Philippe Mathieu-DaudéThe CPUClass::get_phys_page_debug() handler returns a 'hwaddr' type.
--- target/sh4/helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
target/sh4/helper.c +4 -4
@@ -325,7 +325,7 @@ static int find_utlb_entry(CPUSH4State * env, target_ulong address, int use_asidMMU_ITLB_MULTIPLE, MMU_ITLB_VIOLATION, MMU_IADDR_ERROR, MMU_DADDR_ERROR_READ, MMU_DADDR_ERROR_WRITE. */ -static int get_mmu_address (CPUSH4State * env,target_ulong * physical, +static int get_mmu_address (CPUSH4State *env,hwaddr *physical,int *prot,target_ulong address,MMUAccessType access_type) {
@@ -392,7 +392,7 @@ static int get_mmu_address(CPUSH4State * env, target_ulong * physical,return n; } -static int get_physical_address (CPUSH4State * env,target_ulong * physical, +static int get_physical_address (CPUSH4State *env,hwaddr * physical,int *prot,target_ulong address,MMUAccessType access_type) {
@@ -433,7 +433,7 @@ static int get_physical_address(CPUSH4State * env, target_ulong * physical,hwaddr superh_cpu_get_phys_page_debug (CPUState *cs,vaddr addr) { -target_ulong physical; +hwaddr physical;int prot; if (get_physical_address(cpu_env(cs), &physical, &prot, addr, MMU_DATA_LOAD)
@@ -800,7 +800,7 @@ bool superh_cpu_tlb_fill(CPUState *cs, vaddr address, int size,CPUSH4State *env =cpu_env (cs);int ret; -target_ulong physical; +hwaddr physical;int prot; ret =get_physical_address (env, &physical, &prot, address, access_type);
Signature · 1 line
2.51.0
Re: [PATCH 3/6] target/sh4: Use hwaddr type for hardware addresses
Quoted 6 lines · Philippe Mathieu-Daudé
The
CPUClass::get_phys_page_debug()handler returns a 'hwaddr' type.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sh4/helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
PATCH 4/6 target/sh4: Remove target_ulong uses in superh_cpu_get_phys_page_debug
In reply to Philippe Mathieu-DaudéThe CPUClass::get_phys_page_debug() handler takes a 'vaddr' address type since commit 00b941e581b ("cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook").
--- target/sh4/helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
target/sh4/helper.c +6 -6
@@ -231,11 +231,11 @@ static int itlb_replacement(CPUSH4State * env)/* Find the corresponding entry in the right TLB Return entry, MMU_DTLB_MISS or MMU_DTLB_MULTIPLE */ -static int find_tlb_entry (CPUSH4State * env,target_ulong address, +static int find_tlb_entry (CPUSH4State * env,vaddr address,tlb_t * entries,uint8_t nbtlb,int use_asid) {int match =MMU_DTLB_MISS ; -uint32_t start, end; +vaddr start, end;uint8_t asid;int i;
@@ -291,7 +291,7 @@ static int copy_utlb_entry_itlb(CPUSH4State *env, int utlb)/* Find itlb entry Return entry, MMU_ITLB_MISS, MMU_ITLB_MULTIPLE or MMU_DTLB_MULTIPLE */ -static int find_itlb_entry (CPUSH4State * env,target_ulong address, +static int find_itlb_entry (CPUSH4State *env,vaddr address,int use_asid) {int e;
@@ -309,7 +309,7 @@ static int find_itlb_entry(CPUSH4State * env, target_ulong address,/* Find utlb entry Return entry, MMU_DTLB_MISS, MMU_DTLB_MULTIPLE */ -static int find_utlb_entry (CPUSH4State * env,target_ulong address,int use_asid) +static int find_utlb_entry (CPUSH4State *env,vaddr address,int use_asid) {/* per utlb access */ increment_urc (env);
@@ -326,7 +326,7 @@ static int find_utlb_entry(CPUSH4State * env, target_ulong address, int use_asidMMU_IADDR_ERROR, MMU_DADDR_ERROR_READ, MMU_DADDR_ERROR_WRITE. */ static int get_mmu_address (CPUSH4State *env,hwaddr *physical, -int *prot,target_ulong address, +int *prot,vaddr address,MMUAccessType access_type) {int use_asid, n;
@@ -393,7 +393,7 @@ static int get_mmu_address(CPUSH4State *env, hwaddr *physical, }static int get_physical_address (CPUSH4State *env,hwaddr * physical, -int *prot,target_ulong address, +int *prot,vaddr address,MMUAccessType access_type) {/* P1, P2 and P4 areas do not use translation */
Signature · 1 line
2.51.0
Re: [PATCH 4/6] target/sh4: Remove target_ulong uses in superh_cpu_get_phys_page_debug
Quoted 8 lines · Philippe Mathieu-Daudé
The
CPUClass::get_phys_page_debug()handler takes a 'vaddr' address type since commit00b941e581b("cpu: Turncpu_get_phys_page_debug()into a CPUClass hook").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sh4/helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
PATCH 5/6 target/sh4: Use vaddr type for TLB virtual addresses
In reply to Philippe Mathieu-Daudétlb_flush_page() expects a vaddr type since commit 732d548732e ("accel: Replace target_ulong in tlb_*()").
--- target/sh4/helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
target/sh4/helper.c +5 -5
@@ -452,7 +452,7 @@ void cpu_load_tlb(CPUSH4State * env)if (entry->v) {/* Overwriting valid entry in utlb. */ -target_ulong address = entry->vpn <<10 ; +vaddr address = entry->vpn <<10 ;tlb_flush_page (cs, address); }
@@ -528,7 +528,7 @@ void cpu_sh4_write_mmaped_itlb_addr(CPUSH4State *s, hwaddr addr,tlb_t * entry = &s->itlb[index];if (entry->v) {/* Overwriting valid entry in itlb. */ -target_ulong address = entry->vpn <<10 ; +vaddr address = entry->vpn <<10 ;tlb_flush_page (env_cpu (s), address); } entry->asid = asid;
@@ -570,7 +570,7 @@ void cpu_sh4_write_mmaped_itlb_data(CPUSH4State *s, hwaddr addr,/* ITLB Data Array 1 */ if (entry->v) {/* Overwriting valid entry in utlb. */ -target_ulong address = entry->vpn <<10 ; +vaddr address = entry->vpn <<10 ;tlb_flush_page (env_cpu (s), address); } entry->ppn = (mem_value &0x1ffffc00 ) >>10 ;
@@ -665,7 +665,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, hwaddr addr,CPUState *cs =env_cpu (s);/* Overwriting valid entry in utlb. */ -target_ulong address = entry->vpn <<10 ; +vaddr address = entry->vpn <<10 ;tlb_flush_page (cs, address); } entry->asid = asid;
@@ -716,7 +716,7 @@ void cpu_sh4_write_mmaped_utlb_data(CPUSH4State *s, hwaddr addr,/* UTLB Data Array 1 */ if (entry->v) {/* Overwriting valid entry in utlb. */ -target_ulong address = entry->vpn <<10 ; +vaddr address = entry->vpn <<10 ;tlb_flush_page (env_cpu (s), address); } entry->ppn = (mem_value &0x1ffffc00 ) >>10 ;
Signature · 1 line
2.51.0
Re: [PATCH 5/6] target/sh4: Use vaddr type for TLB virtual addresses
Quoted 7 lines · Philippe Mathieu-Daudé
tlb_flush_page()expects a vaddr type since commit732d548732e("accel: Replacetarget_ulongin tlb_*()").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sh4/helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
PATCH 6/6 target/sh4: Remove target_ulong use in gen_goto_tb()
In reply to Philippe Mathieu-Daudétranslator_use_goto_tb() expects a vaddr type since commit b1c09220b4c ("accel/tcg: Replace target_ulong with vaddr in translator_*()").
--- target/sh4/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target/sh4/translate.c +3 -3
@@ -223,7 +223,7 @@ static inline bool use_exit_tb(DisasContext *ctx)return (ctx->tbflags &TB_FLAG_GUSA_EXCLUSIVE ) !=0 ; } -static bool use_goto_tb (DisasContext *ctx,target_ulong dest) +static bool use_goto_tb (DisasContext *ctx,vaddr dest) {if (use_exit_tb (ctx)) {return false;
@@ -231,7 +231,7 @@ static bool use_goto_tb(DisasContext *ctx, target_ulong dest)return translator_use_goto_tb (&ctx->base, dest); } -static void gen_goto_tb (DisasContext *ctx,int n,target_ulong dest) +static void gen_goto_tb (DisasContext *ctx,int n,vaddr dest) {if (use_goto_tb (ctx, dest)) {tcg_gen_goto_tb (n);
@@ -267,7 +267,7 @@ static void gen_jump(DisasContext * ctx) }/* Immediate conditional jump (bt or bf) */ -static void gen_conditional_jump (DisasContext *ctx,target_ulong dest, +static void gen_conditional_jump (DisasContext *ctx,vaddr dest,bool jump_if_true) {TCGLabel *l1 =gen_new_label ();
Signature · 1 line
2.51.0
Re: [PATCH 6/6] target/sh4: Remove target_ulong use in gen_goto_tb()
Quoted 8 lines · Philippe Mathieu-Daudé
translator_use_goto_tb()expects a vaddr type since commitb1c09220b4c("accel/tcg: Replacetarget_ulongwith vaddr in translator_*()").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sh4/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 9 lines · Philippe Mathieu-Daudé
Remove the left over
target_ulonguses in SH4 frontend.Philippe Mathieu-Daudé (6):
target/sh4: ConvertCPUSH4State::srregister touint32_ttype target/sh4: Removetarget_ulonguse incpu_sh4_is_cached()target/sh4: Use hwaddr type for hardware addresses target/sh4: Removetarget_ulonguses insuperh_cpu_get_phys_page_debugtarget/sh4: Use vaddr type for TLB virtual addresses target/sh4: Removetarget_ulonguse ingen_goto_tb()
Series queued, thanks.