target/hppa: Remove use of MO_TE definition
cover target/hppa: Remove use of MO_TE definition
- Replace a pair of target_ulong types
- Replace MO_TE -> MO_BE
Philippe Mathieu-Daudé (9):
target/hppa: Use hwaddr type for HPPATLBEntry::pa target/hppa: Have hppa_form_gva*() return vaddr type target/hppa: Explode MO_TExx -> MO_TE | MO_xx target/hppa: Conceal MO_TE within do_load() target/hppa: Conceal MO_TE within do_load_32/64() target/hppa: Conceal MO_TE within do_store() target/hppa: Conceal MO_TE within do_store_32/64() target/hppa: Introduce mo_endian() helper target/hppa: Replace MO_TE -> MO_BE
target/hppa/cpu.h | 6 +++--- target/hppa/helper.c | 4 ++-- target/hppa/mem_helper.c | 2 +- target/hppa/translate.c | 23 ++++++++++++++++------- target/hppa/trace-events | 6 +++--- 5 files changed, 25 insertions(+), 16 deletions(-)
Signature · 1 line
2.51.0
PATCH 1/9 target/hppa: Use hwaddr type for HPPATLBEntry::pa
HPPATLBEntry::@pa is a physical address, use the appropriate type.
--- target/hppa/cpu.h | 2 +- target/hppa/trace-events | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
target/hppa/cpu.h +1 -1
@@ -187,7 +187,7 @@ typedef struct HPPATLBEntry {struct HPPATLBEntry *unused_next; }; -target_ulong pa; +hwaddr pa; unsigned entry_valid : 1;
target/hppa/trace-events +3 -3
@@ -1,13 +1,13 @@ # See docs/devel/tracing.rst for syntax documentation. # mem_helper.c -disable hppa_tlb_flush_ent(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%lx" -disable hppa_tlb_find_entry(void *env, void *ent, int valid, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p valid=%d va_b=0x%lx va_e=0x%lx pa=0x%lx" +disable hppa_tlb_flush_ent(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64 +disable hppa_tlb_find_entry(void *env, void *ent, int valid, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p valid=%d va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64 disable hppa_tlb_find_entry_not_found(void *env, uint64_t addr) "env=%p addr=%08lx" disable hppa_tlb_get_physical_address(void *env, int ret, int prot, uint64_t addr, uint64_t phys) "env=%p ret=%d prot=%d addr=0x%lx phys=0x%lx" disable hppa_tlb_fill_excp(void *env, uint64_t addr, int size, int type, int mmu_idx) "env=%p addr=0x%lx size=%d type=%d mmu_idx=%d" disable hppa_tlb_fill_success(void *env, uint64_t addr, uint64_t phys, int size, int type, int mmu_idx) "env=%p addr=0x%lx phys=0x%lx size=%d type=%d mmu_idx=%d" -disable hppa_tlb_itlba(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%lx" +disable hppa_tlb_itlba(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64 disable hppa_tlb_itlbp(void *env, void *ent, int access_id, int u, int pl2, int pl1, int type, int b, int d, int t) "env=%p ent=%p access_id=%x u=%d pl2=%d pl1=%d type=%d b=%d d=%d t=%d" disable hppa_tlb_ptlb(void *env) "env=%p" disable hppa_tlb_ptlb_local(void *env) "env=%p"
Signature · 1 line
2.51.0
Re: [PATCH 1/9] target/hppa: Use hwaddr type for HPPATLBEntry::pa
Quoted 13 lines · Philippe Mathieu-Daudé
HPPATLBEntry::@pa is a physical address, use the appropriate type.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/hppa/cpu.h | 2 +- target/hppa/trace-events | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)target/hppa/cpu.h +0
-0
target/hppa/cpu.h typedef struct HPPATLBEntry { · line 193
Quoted 8 lines
target/hppa/cpu.h +1
-1@@ -187,7 +187,7 @@ typedef struct HPPATLBEntry {struct HPPATLBEntry *unused_next; }; -target_ulong pa; +hwaddr pa; unsigned entry_valid : 1;
r~
PATCH 2/9 target/hppa: Have hppa_form_gva*() return vaddr type
In reply to Philippe Mathieu-DaudéReturn a 'vaddr' type for "guest virtual address".
--- target/hppa/cpu.h | 4 ++-- target/hppa/helper.c | 4 ++-- target/hppa/mem_helper.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
target/hppa/cpu.h +2 -2
@@ -320,7 +320,7 @@ void hppa_translate_code(CPUState *cs, TranslationBlock *tb,#define CPU_RESOLVING_TYPE TYPE_HPPA_CPU -static inline target_ulong hppa_form_gva_mask (uint64_t gva_offset_mask, +static inline vaddr hppa_form_gva_mask (uint64_t gva_offset_mask,uint64_t spc,target_ulong off) {#ifdef CONFIG_USER_ONLY
@@ -330,7 +330,7 @@ static inline target_ulong hppa_form_gva_mask(uint64_t gva_offset_mask,#endif } -static inline target_ulong hppa_form_gva (CPUHPPAState *env,uint64_t spc, +static inline vaddr hppa_form_gva (CPUHPPAState *env,uint64_t spc,target_ulong off) {return hppa_form_gva_mask (env->gva_offset_mask, spc, off);
target/hppa/helper.c +2 -2
@@ -148,8 +148,8 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags) m =UINT32_MAX ; } - qemu_fprintf(f, "IA_F %08" PRIx64 ":%0*" PRIx64 " (" TARGET_FMT_lx ")\n" - "IA_B %08" PRIx64 ":%0*" PRIx64 " (" TARGET_FMT_lx ")\n", + qemu_fprintf(f, "IA_F %08" PRIx64 ":%0*" PRIx64 " (0x%" VADDR_PRIx ")\n" + "IA_B %08" PRIx64 ":%0*" PRIx64 " (0x%" VADDR_PRIx ")\n", env->iasq_f >> 32, w, m & env->iaoq_f, hppa_form_gva_mask(env->gva_offset_mask, env->iasq_f, env->iaoq_f),
target/hppa/mem_helper.c +1 -1
@@ -803,7 +803,7 @@ void HELPER(diag_btlb)(CPUHPPAState *env)uint64_t HELPER (b_gate_priv )(CPUHPPAState *env,uint64_t iaoq_f) { -uint64_t gva =hppa_form_gva (env, env->iasq_f, iaoq_f); +vaddr gva =hppa_form_gva (env, env->iasq_f, iaoq_f);HPPATLBEntry *ent =hppa_find_tlb (env, gva);if (ent ==NULL ) {
Signature · 1 line
2.51.0
Re: [PATCH 2/9] target/hppa: Have hppa_form_gva*() return vaddr type
Quoted 8 lines · Philippe Mathieu-Daudé
Return a 'vaddr' type for "guest virtual address".
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hppa/cpu.h | 4 ++-- target/hppa/helper.c | 4 ++-- target/hppa/mem_helper.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
target/hppa/cpu.h void hppa_translate_code(CPUState *cs, TranslationBlock *tb, · line 324
Quoted 12 lines
target/hppa/cpu.h +1
-1@@ -320,7 +320,7 @@ void hppa_translate_code(CPUState *cs, TranslationBlock *tb,#define CPU_RESOLVING_TYPE TYPE_HPPA_CPU -static inline target_ulong hppa_form_gva_mask (uint64_t gva_offset_mask, +static inline vaddr hppa_form_gva_mask (uint64_t gva_offset_mask,uint64_t spc,target_ulong off)
But indentation needs fixing on the second line.
target/hppa/cpu.h static inline target_ulong hppa_form_gva_mask(uint64_t gva_offset_mask, · line 334
Quoted 9 lines
target/hppa/cpu.h +1
-1{#ifdef CONFIG_USER_ONLY @@ -330,7 +330,7 @@ static inline target_ulong hppa_form_gva_mask(uint64_t gva_offset_mask,#endif } -static inline target_ulong hppa_form_gva (CPUHPPAState *env,uint64_t spc, +static inline vaddr hppa_form_gva (CPUHPPAState *env,uint64_t spc,target_ulong off)
Likewise.
r~
PATCH 3/9 target/hppa: Explode MO_TExx -> MO_TE | MO_xx
In reply to Philippe Mathieu-DaudéExtract the implicit MO_TE definition in order to replace it in a commits.
Mechanical change using:
$ for n in UW UL UQ UO SW SL SQ; do \
sed -i -e "s/MO_TE$n/MO_TE | MO_$n/" \
$(git grep -l MO_TE$n target/openrisc); \
done--- target/hppa/translate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
target/hppa/translate.c +4 -4
@@ -1691,7 +1691,7 @@ static bool do_floadw(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =tcg_temp_new_i32 (); -do_load_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TEUL ); +do_load_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UL );save_frw_i32 (rt, tmp);if (rt ==0 ) {
@@ -1716,7 +1716,7 @@ static bool do_floadd(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =tcg_temp_new_i64 (); -do_load_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TEUQ ); +do_load_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UQ );save_frd (rt, tmp);if (rt ==0 ) {
@@ -1750,7 +1750,7 @@ static bool do_fstorew(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =load_frw_i32 (rt); -do_store_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TEUL ); +do_store_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UL );return nullify_end (ctx); }
@@ -1770,7 +1770,7 @@ static bool do_fstored(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =load_frd (rt); -do_store_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TEUQ ); +do_store_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UQ );return nullify_end (ctx); }
Signature · 1 line
2.51.0
Re: [PATCH 3/9] target/hppa: Explode MO_TExx -> MO_TE | MO_xx
Quoted 10 lines · Philippe Mathieu-Daudé
Extract the implicit
MO_TEdefinition in order to replace it in a commits.Mechanical change using:
$ for n in UW UL UQ UO SW SL SQ; do \ sed -i -e "s/MO_TE$n/MO_TE | MO_$n/" \ $(git grep -l MO_TE$n target/openrisc); \ done
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/hppa/translate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
r~
PATCH 4/9 target/hppa: Conceal MO_TE within do_load()
In reply to Philippe Mathieu-Daudé--- target/hppa/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/hppa/translate.c +2 -2
@@ -1676,7 +1676,7 @@ static bool do_load(DisasContext *ctx, unsigned rt, unsigned rb,/* Make sure if RT == RB, we see the result of the load. */ dest =tcg_temp_new_i64 (); } -do_load_64 (ctx, dest, rb, rx, scale, disp, sp, modify, mop); +do_load_64 (ctx, dest, rb, rx, scale, disp, sp, modify,MO_TE | mop);save_gpr (ctx, rt, dest);return nullify_end (ctx);
@@ -3302,7 +3302,7 @@ static bool trans_ld(DisasContext *ctx, arg_ldst *a)return gen_illegal (ctx); }return do_load (ctx, a->t, a->b, a->x, a->scale ? a->size :0 , - a->disp, a->sp, a->m, a->size |MO_TE ); + a->disp, a->sp, a->m, a->size); }static bool trans_st (DisasContext *ctx,arg_ldst *a)
Signature · 1 line
2.51.0
Re: [PATCH 4/9] target/hppa: Conceal MO_TE within do_load()
Quoted 19 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hppa/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/hppa/translate.c +1
-1@@ -1676,7 +1676,7 @@ static bool do_load(DisasContext *ctx, unsigned rt, unsigned rb,/* Make sure if RT == RB, we see the result of the load. */ dest =tcg_temp_new_i64 (); } -do_load_64 (ctx, dest, rb, rx, scale, disp, sp, modify, mop); +do_load_64 (ctx, dest, rb, rx, scale, disp, sp, modify,MO_TE | mop);save_gpr (ctx, rt, dest);return nullify_end (ctx);
target/hppa/translate.c static bool trans_ld(DisasContext *ctx, arg_ldst *a) · line 3308
Quoted 8 lines
target/hppa/translate.c +1
-1@@ -3302,7 +3302,7 @@ static bool trans_ld(DisasContext *ctx, arg_ldst *a)return gen_illegal (ctx); }return do_load (ctx, a->t, a->b, a->x, a->scale ? a->size :0 , - a->disp, a->sp, a->m, a->size |MO_TE ); + a->disp, a->sp, a->m, a->size); }static bool trans_st (DisasContext *ctx,arg_ldst *a)
r~
PATCH 5/9 target/hppa: Conceal MO_TE within do_load_32/64()
In reply to Philippe Mathieu-Daudé--- target/hppa/translate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
target/hppa/translate.c +5 -3
@@ -1599,6 +1599,7 @@ static void do_load_32(DisasContext *ctx, TCGv_i32 dest, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); + mop |=MO_TE ;form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_ld_i32 (dest, addr, ctx->mmu_idx, mop |UNALIGN (ctx));
@@ -1617,6 +1618,7 @@ static void do_load_64(DisasContext *ctx, TCGv_i64 dest, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); + mop |=MO_TE ;form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_ld_i64 (dest, addr, ctx->mmu_idx, mop |UNALIGN (ctx));
@@ -1676,7 +1678,7 @@ static bool do_load(DisasContext *ctx, unsigned rt, unsigned rb,/* Make sure if RT == RB, we see the result of the load. */ dest =tcg_temp_new_i64 (); } -do_load_64 (ctx, dest, rb, rx, scale, disp, sp, modify,MO_TE | mop); +do_load_64 (ctx, dest, rb, rx, scale, disp, sp, modify, mop);save_gpr (ctx, rt, dest);return nullify_end (ctx);
@@ -1691,7 +1693,7 @@ static bool do_floadw(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =tcg_temp_new_i32 (); -do_load_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UL ); +do_load_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_UL );save_frw_i32 (rt, tmp);if (rt ==0 ) {
@@ -1716,7 +1718,7 @@ static bool do_floadd(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =tcg_temp_new_i64 (); -do_load_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UQ ); +do_load_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_UQ );save_frd (rt, tmp);if (rt ==0 ) {
Signature · 1 line
2.51.0
Re: [PATCH 5/9] target/hppa: Conceal MO_TE within do_load_32/64()
Quoted 44 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hppa/translate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)target/hppa/translate.c +4
-2@@ -1599,6 +1599,7 @@ static void do_load_32(DisasContext *ctx, TCGv_i32 dest, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); + mop |=MO_TE ;form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_ld_i32 (dest, addr, ctx->mmu_idx, mop |UNALIGN (ctx));@@ -1617,6 +1618,7 @@ static void do_load_64(DisasContext *ctx, TCGv_i64 dest, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); + mop |=MO_TE ;form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_ld_i64 (dest, addr, ctx->mmu_idx, mop |UNALIGN (ctx));@@ -1676,7 +1678,7 @@ static bool do_load(DisasContext *ctx, unsigned rt, unsigned rb,/* Make sure if RT == RB, we see the result of the load. */ dest =tcg_temp_new_i64 (); } -do_load_64 (ctx, dest, rb, rx, scale, disp, sp, modify,MO_TE | mop); +do_load_64 (ctx, dest, rb, rx, scale, disp, sp, modify, mop);save_gpr (ctx, rt, dest);return nullify_end (ctx);@@ -1691,7 +1693,7 @@ static bool do_floadw(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =tcg_temp_new_i32 (); -do_load_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UL ); +do_load_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_UL );save_frw_i32 (rt, tmp);if (rt ==0 ) {
target/hppa/translate.c static bool do_floadd(DisasContext *ctx, unsigned rt, unsigned rb, · line 1724
Quoted 8 lines
target/hppa/translate.c +1
-1@@ -1716,7 +1718,7 @@ static bool do_floadd(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =tcg_temp_new_i64 (); -do_load_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UQ ); +do_load_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_UQ );save_frd (rt, tmp);if (rt ==0 ) {
r~
PATCH 6/9 target/hppa: Conceal MO_TE within do_store()
In reply to Philippe Mathieu-Daudé--- target/hppa/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/hppa/translate.c +2 -2
@@ -1739,7 +1739,7 @@ static bool do_store(DisasContext *ctx, unsigned rt, unsigned rb, int modify, MemOp mop) {nullify_over (ctx ); -do_store_64 (ctx,load_gpr (ctx, rt), rb,0 ,0 , disp, sp, modify, mop); +do_store_64 (ctx,load_gpr (ctx, rt), rb,0 ,0 , disp, sp, modify,MO_TE | mop);return nullify_end (ctx); }
@@ -3313,7 +3313,7 @@ static bool trans_st(DisasContext *ctx, arg_ldst *a)if (!ctx->is_pa20 && a->size >MO_32 ) {return gen_illegal (ctx); } -return do_store (ctx, a->t, a->b, a->disp, a->sp, a->m, a->size |MO_TE ); +return do_store (ctx, a->t, a->b, a->disp, a->sp, a->m, a->size); }static bool trans_ldc (DisasContext *ctx,arg_ldst *a)
Signature · 1 line
2.51.0
Re: [PATCH 6/9] target/hppa: Conceal MO_TE within do_store()
Quoted 19 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hppa/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/hppa/translate.c +1
-1@@ -1739,7 +1739,7 @@ static bool do_store(DisasContext *ctx, unsigned rt, unsigned rb, int modify, MemOp mop) {nullify_over (ctx ); -do_store_64 (ctx,load_gpr (ctx, rt), rb,0 ,0 , disp, sp, modify, mop); +do_store_64 (ctx,load_gpr (ctx, rt), rb,0 ,0 , disp, sp, modify,MO_TE | mop);return nullify_end (ctx); }
target/hppa/translate.c static bool trans_st(DisasContext *ctx, arg_ldst *a) · line 3319
Quoted 8 lines
target/hppa/translate.c +1
-1@@ -3313,7 +3313,7 @@ static bool trans_st(DisasContext *ctx, arg_ldst *a)if (!ctx->is_pa20 && a->size >MO_32 ) {return gen_illegal (ctx); } -return do_store (ctx, a->t, a->b, a->disp, a->sp, a->m, a->size |MO_TE ); +return do_store (ctx, a->t, a->b, a->disp, a->sp, a->m, a->size); }static bool trans_ldc (DisasContext *ctx,arg_ldst *a)
r~
PATCH 7/9 target/hppa: Conceal MO_TE within do_store_32/64()
In reply to Philippe Mathieu-Daudé--- target/hppa/translate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
target/hppa/translate.c +5 -3
@@ -1637,6 +1637,7 @@ static void do_store_32(DisasContext *ctx, TCGv_i32 src, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); + mop |=MO_TE ;form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_st_i32 (src, addr, ctx->mmu_idx, mop |UNALIGN (ctx));
@@ -1655,6 +1656,7 @@ static void do_store_64(DisasContext *ctx, TCGv_i64 src, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); + mop |=MO_TE ;form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_st_i64 (src, addr, ctx->mmu_idx, mop |UNALIGN (ctx));
@@ -1739,7 +1741,7 @@ static bool do_store(DisasContext *ctx, unsigned rt, unsigned rb, int modify, MemOp mop) {nullify_over (ctx ); -do_store_64 (ctx,load_gpr (ctx, rt), rb,0 ,0 , disp, sp, modify,MO_TE | mop); +do_store_64 (ctx,load_gpr (ctx, rt), rb,0 ,0 , disp, sp, modify, mop);return nullify_end (ctx); }
@@ -1752,7 +1754,7 @@ static bool do_fstorew(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =load_frw_i32 (rt); -do_store_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UL ); +do_store_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_UL );return nullify_end (ctx); }
@@ -1772,7 +1774,7 @@ static bool do_fstored(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =load_frd (rt); -do_store_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UQ ); +do_store_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_UQ );return nullify_end (ctx); }
Signature · 1 line
2.51.0
Re: [PATCH 7/9] target/hppa: Conceal MO_TE within do_store_32/64()
Quoted 44 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hppa/translate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)target/hppa/translate.c +4
-2@@ -1637,6 +1637,7 @@ static void do_store_32(DisasContext *ctx, TCGv_i32 src, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); + mop |=MO_TE ;form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_st_i32 (src, addr, ctx->mmu_idx, mop |UNALIGN (ctx));@@ -1655,6 +1656,7 @@ static void do_store_64(DisasContext *ctx, TCGv_i64 src, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); + mop |=MO_TE ;form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_st_i64 (src, addr, ctx->mmu_idx, mop |UNALIGN (ctx));@@ -1739,7 +1741,7 @@ static bool do_store(DisasContext *ctx, unsigned rt, unsigned rb, int modify, MemOp mop) {nullify_over (ctx ); -do_store_64 (ctx,load_gpr (ctx, rt), rb,0 ,0 , disp, sp, modify,MO_TE | mop); +do_store_64 (ctx,load_gpr (ctx, rt), rb,0 ,0 , disp, sp, modify, mop);return nullify_end (ctx); }@@ -1752,7 +1754,7 @@ static bool do_fstorew(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =load_frw_i32 (rt); -do_store_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UL ); +do_store_32 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_UL );return nullify_end (ctx); }
target/hppa/translate.c static bool do_fstored(DisasContext *ctx, unsigned rt, unsigned rb, · line 1780
Quoted 8 lines
target/hppa/translate.c +1
-1@@ -1772,7 +1774,7 @@ static bool do_fstored(DisasContext *ctx, unsigned rt, unsigned rb,nullify_over (ctx); tmp =load_frd (rt); -do_store_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_TE |MO_UQ ); +do_store_64 (ctx, tmp, rb, rx, scale, disp, sp, modify,MO_UQ );return nullify_end (ctx); }
r~
PATCH 8/9 target/hppa: Introduce mo_endian() helper
In reply to Philippe Mathieu-Daudémo_endian() returns the target endianness.
--- target/hppa/translate.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
target/hppa/translate.c +10 -5
@@ -104,6 +104,11 @@ typedef struct DisasContext {#define MMU_DISABLED (C ) MMU_IDX_MMU_DISABLED((C)->mmu_idx)#endif +static inline MemOp mo_endian (DisasContext *ctx) +{ +return MO_TE ; +} +/* Note that ssm/rsm instructions number PSW_W and PSW_E differently. */ static int expand_sm_imm (DisasContext *ctx,int val) {
@@ -1599,7 +1604,7 @@ static void do_load_32(DisasContext *ctx, TCGv_i32 dest, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); - mop |=MO_TE ; + mop |=mo_endian (ctx);form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_ld_i32 (dest, addr, ctx->mmu_idx, mop |UNALIGN (ctx));
@@ -1618,7 +1623,7 @@ static void do_load_64(DisasContext *ctx, TCGv_i64 dest, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); - mop |=MO_TE ; + mop |=mo_endian (ctx);form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_ld_i64 (dest, addr, ctx->mmu_idx, mop |UNALIGN (ctx));
@@ -1637,7 +1642,7 @@ static void do_store_32(DisasContext *ctx, TCGv_i32 src, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); - mop |=MO_TE ; + mop |=mo_endian (ctx);form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_st_i32 (src, addr, ctx->mmu_idx, mop |UNALIGN (ctx));
@@ -1656,7 +1661,7 @@ static void do_store_64(DisasContext *ctx, TCGv_i64 src, unsigned rb,/* Caller uses nullify_over/nullify_end. */ assert (ctx->null_cond.c ==TCG_COND_NEVER ); - mop |=MO_TE ; + mop |=mo_endian (ctx);form_gva (ctx, &addr, &ofs, rb, rx, scale, disp, sp, modify,MMU_DISABLED (ctx));tcg_gen_qemu_st_i64 (src, addr, ctx->mmu_idx, mop |UNALIGN (ctx));
@@ -3320,7 +3325,7 @@ static bool trans_st(DisasContext *ctx, arg_ldst *a)static bool trans_ldc (DisasContext *ctx,arg_ldst *a) { -MemOp mop =MO_TE |MO_ALIGN | a->size; +MemOp mop =mo_endian (ctx) |MO_ALIGN | a->size;TCGv_i64 dest, ofs;TCGv_i64 addr;
Signature · 1 line
2.51.0
Re: [PATCH 8/9] target/hppa: Introduce mo_endian() helper
Quoted 6 lines · Philippe Mathieu-Daudé
mo_endian()returns the target endianness.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hppa/translate.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
r~
PATCH 9/9 target/hppa: Replace MO_TE -> MO_BE
In reply to Philippe Mathieu-DaudéWe only build the PA-RISC targets using big endianness order:
$ git grep TARGET_BIG_ENDIAN configs/targets/hppa-* configs/targets/hppa-linux-user.mak:5:TARGET_BIG_ENDIAN=y configs/targets/hppa-softmmu.mak:2:TARGET_BIG_ENDIAN=y
Therefore the MO_TE definition always expands to MO_BE. Use the latter to simplify.
--- target/hppa/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/hppa/translate.c +1 -1
@@ -106,7 +106,7 @@ typedef struct DisasContext {static inline MemOp mo_endian (DisasContext *ctx) { -return MO_TE ; +return MO_BE ; }/* Note that ssm/rsm instructions number PSW_W and PSW_E differently. */
Signature · 1 line
2.51.0
Re: [PATCH 9/9] target/hppa: Replace MO_TE -> MO_BE
Quoted 19 lines · Philippe Mathieu-Daudé
We only build the PA-RISC targets using big endianness order:
$ git grep TARGET_BIG_ENDIAN configs/targets/hppa-* configs/targets/hppa-linux-user.mak:5:TARGET_BIG_ENDIAN=y configs/targets/hppa-softmmu.mak:2:TARGET_BIG_ENDIAN=yTherefore the
MO_TEdefinition always expands toMO_BE. Use the latter to simplify.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hppa/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/hppa/translate.c +0
-0
target/hppa/translate.c typedef struct DisasContext { · line 112
Quoted 8 lines
target/hppa/translate.c +1
-1@@ -106,7 +106,7 @@ typedef struct DisasContext {static inline MemOp mo_endian (DisasContext *ctx) { -return MO_TE ; +return MO_BE ; }/* Note that ssm/rsm instructions number PSW_W and PSW_E differently. */
Indeed. Like ppc64, hppa always defaults to big-endian and has a PSW bit to enable little-endian. (Which we don't implement, and quite possibly was never implemented in any hardware.)
r~
Re: [PATCH 9/9] target/hppa: Replace MO_TE -> MO_BE
Quoted 29 lines · Richard Henderson
Quoted 19 lines · Philippe Mathieu-Daudé
We only build the PA-RISC targets using big endianness order:
$ git grep TARGET_BIG_ENDIAN configs/targets/hppa-* configs/targets/hppa-linux-user.mak:5:TARGET_BIG_ENDIAN=y configs/targets/hppa-softmmu.mak:2:TARGET_BIG_ENDIAN=yTherefore the
MO_TEdefinition always expands toMO_BE. Use the latter to simplify.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
target/hppa/translate.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)target/hppa/translate.c +0
-0target/hppa/translate.c typedef struct DisasContext { · line 110
Quoted 6 lines
target/hppa/translate.c +1
-1@@ -106,7 +106,7 @@ typedef struct DisasContext { static inline MemOp mo_endian(DisasContext *ctx) { - return MO_TE; + return MO_BE; } /* Note that ssm/rsm instructions number PSW_W and PSW_E differently. */Reviewed-by Richard Henderson <[email protected]>
Quoted 1 line
Indeed. Like ppc64, hppa always defaults to big-endian and has a PSW bit to enable little-endian. (Which we don't implement, and quite possibly was never implemented in any hardware.)
Indeed, per parisc2.0.pdf:
PSW_E
Little endian memory access enable. When 0, all memory references are big endian. When 1, all memory references are little endian. Implementation of this bit is optional. If it is not implemented, all memory references are big endian and this bit is a reserved bit.
I'll squash:
/* The PSW_E bit sets the (little) endianness, but we don't
implement it. */
Thanks,
Phil.
Quoted 13 lines · Philippe Mathieu-Daudé
- Replace a pair of
target_ulongtypes
- ReplaceMO_TE->MO_BEPhilippe Mathieu-Daudé (9):
target/hppa: Use hwaddr type forHPPATLBEntry::patarget/hppa: Have hppa_form_gva*() return vaddr type target/hppa: ExplodeMO_TExx->MO_TE|MO_xxtarget/hppa: ConcealMO_TEwithindo_load()target/hppa: ConcealMO_TEwithin do_load_32/64() target/hppa: ConcealMO_TEwithindo_store()target/hppa: ConcealMO_TEwithin do_store_32/64() target/hppa: Introducemo_endian()helper target/hppa: ReplaceMO_TE->MO_BE
Series queued, thanks.