diff mbox series

[v2,09/23] target/loongarch: Use target_ulong for CSR helpers

Message ID 20241226-la32-fixes1-v2-9-0414594f8cb5@flygoat.com (mailing list archive)
State New
Headers show
Series target/loongarch: LoongArch32 fixes 1 | expand

Commit Message

Jiaxun Yang Dec. 26, 2024, 9:19 p.m. UTC
All CSRs are meant to be target_ulong wide in our setting.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 target/loongarch/helper.h        | 14 +++++++-------
 target/loongarch/tcg/op_helper.c |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

Comments

Richard Henderson Dec. 26, 2024, 9:31 p.m. UTC | #1
On 12/26/24 13:19, Jiaxun Yang wrote:
> All CSRs are meant to be target_ulong wide in our setting.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>   target/loongarch/helper.h        | 14 +++++++-------
>   target/loongarch/tcg/op_helper.c |  4 ++--
>   2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/target/loongarch/helper.h b/target/loongarch/helper.h
> index 409d93a5b0808f0e32b8c0e2e17cebac9feaf8ed..a608754b7f52689da9e9f4da1cef68d5af72f2ed 100644
> --- a/target/loongarch/helper.h
> +++ b/target/loongarch/helper.h
> @@ -97,13 +97,13 @@ DEF_HELPER_1(rdtime_d, i64, env)
>   
>   #ifndef CONFIG_USER_ONLY
>   /* CSRs helper */
> -DEF_HELPER_1(csrrd_pgd, i64, env)
> -DEF_HELPER_1(csrrd_cpuid, i64, env)
> -DEF_HELPER_1(csrrd_tval, i64, env)
> -DEF_HELPER_2(csrwr_estat, i64, env, tl)
> -DEF_HELPER_2(csrwr_asid, i64, env, tl)
> -DEF_HELPER_2(csrwr_tcfg, i64, env, tl)
> -DEF_HELPER_2(csrwr_ticlr, i64, env, tl)
> +DEF_HELPER_1(csrrd_pgd, tl, env)
> +DEF_HELPER_1(csrrd_cpuid, tl, env)
> +DEF_HELPER_1(csrrd_tval, tl, env)
> +DEF_HELPER_2(csrwr_estat, tl, env, tl)
> +DEF_HELPER_2(csrwr_asid, tl, env, tl)
> +DEF_HELPER_2(csrwr_tcfg, tl, env, tl)
> +DEF_HELPER_2(csrwr_ticlr, tl, env, tl)


Changes to helper declarations here, but not to definitions.


>   DEF_HELPER_2(iocsrrd_b, tl, env, tl)
>   DEF_HELPER_2(iocsrrd_h, tl, env, tl)
>   DEF_HELPER_2(iocsrrd_w, tl, env, tl)
> diff --git a/target/loongarch/tcg/op_helper.c b/target/loongarch/tcg/op_helper.c
> index b17208e5b962f2191b2afa60181bff311d618bba..c9d7e84e7ec9000bab655366bdf6ed8aaa4fd080 100644
> --- a/target/loongarch/tcg/op_helper.c
> +++ b/target/loongarch/tcg/op_helper.c
> @@ -61,7 +61,7 @@ void helper_asrtgt_d(CPULoongArchState *env, target_ulong rj, target_ulong rk)
>       }
>   }
>   
> -target_ulong helper_crc32(target_ulong val, target_ulong m, uint64_t sz)
> +target_ulong helper_crc32(target_ulong val, target_ulong m, target_ulong sz)
>   {
>       uint8_t buf[8];
>       target_ulong mask = ((sz * 8) == 64) ? -1ULL : ((1ULL << (sz * 8)) - 1);
> @@ -71,7 +71,7 @@ target_ulong helper_crc32(target_ulong val, target_ulong m, uint64_t sz)
>       return (int32_t) (crc32(val ^ 0xffffffff, buf, sz) ^ 0xffffffff);
>   }
>   
> -target_ulong helper_crc32c(target_ulong val, target_ulong m, uint64_t sz)
> +target_ulong helper_crc32c(target_ulong val, target_ulong m, target_ulong sz)
>   {
>       uint8_t buf[8];
>       target_ulong mask = ((sz * 8) == 64) ? -1ULL : ((1ULL << (sz * 8)) - 1);
> 

Changes to helper definitions, but not to the declarations.

Is this patch a victim of incorrect splitting, or incorrect rebasing?


r~
Jiaxun Yang Dec. 26, 2024, 9:39 p.m. UTC | #2
在2024年12月26日十二月 下午9:31,Richard Henderson写道:
[...]
>>   
>> -target_ulong helper_crc32c(target_ulong val, target_ulong m, uint64_t sz)
>> +target_ulong helper_crc32c(target_ulong val, target_ulong m, target_ulong sz)
>>   {
>>       uint8_t buf[8];
>>       target_ulong mask = ((sz * 8) == 64) ? -1ULL : ((1ULL << (sz * 8)) - 1);
>> 
>
> Changes to helper definitions, but not to the declarations.
>
> Is this patch a victim of incorrect splitting, or incorrect rebasing?

Aha, those pairs of definitions and declarations are inconsistent in
existing code.

I should reflect this in commit message.

Thanks
>
>
> r~
diff mbox series

Patch

diff --git a/target/loongarch/helper.h b/target/loongarch/helper.h
index 409d93a5b0808f0e32b8c0e2e17cebac9feaf8ed..a608754b7f52689da9e9f4da1cef68d5af72f2ed 100644
--- a/target/loongarch/helper.h
+++ b/target/loongarch/helper.h
@@ -97,13 +97,13 @@  DEF_HELPER_1(rdtime_d, i64, env)
 
 #ifndef CONFIG_USER_ONLY
 /* CSRs helper */
-DEF_HELPER_1(csrrd_pgd, i64, env)
-DEF_HELPER_1(csrrd_cpuid, i64, env)
-DEF_HELPER_1(csrrd_tval, i64, env)
-DEF_HELPER_2(csrwr_estat, i64, env, tl)
-DEF_HELPER_2(csrwr_asid, i64, env, tl)
-DEF_HELPER_2(csrwr_tcfg, i64, env, tl)
-DEF_HELPER_2(csrwr_ticlr, i64, env, tl)
+DEF_HELPER_1(csrrd_pgd, tl, env)
+DEF_HELPER_1(csrrd_cpuid, tl, env)
+DEF_HELPER_1(csrrd_tval, tl, env)
+DEF_HELPER_2(csrwr_estat, tl, env, tl)
+DEF_HELPER_2(csrwr_asid, tl, env, tl)
+DEF_HELPER_2(csrwr_tcfg, tl, env, tl)
+DEF_HELPER_2(csrwr_ticlr, tl, env, tl)
 DEF_HELPER_2(iocsrrd_b, tl, env, tl)
 DEF_HELPER_2(iocsrrd_h, tl, env, tl)
 DEF_HELPER_2(iocsrrd_w, tl, env, tl)
diff --git a/target/loongarch/tcg/op_helper.c b/target/loongarch/tcg/op_helper.c
index b17208e5b962f2191b2afa60181bff311d618bba..c9d7e84e7ec9000bab655366bdf6ed8aaa4fd080 100644
--- a/target/loongarch/tcg/op_helper.c
+++ b/target/loongarch/tcg/op_helper.c
@@ -61,7 +61,7 @@  void helper_asrtgt_d(CPULoongArchState *env, target_ulong rj, target_ulong rk)
     }
 }
 
-target_ulong helper_crc32(target_ulong val, target_ulong m, uint64_t sz)
+target_ulong helper_crc32(target_ulong val, target_ulong m, target_ulong sz)
 {
     uint8_t buf[8];
     target_ulong mask = ((sz * 8) == 64) ? -1ULL : ((1ULL << (sz * 8)) - 1);
@@ -71,7 +71,7 @@  target_ulong helper_crc32(target_ulong val, target_ulong m, uint64_t sz)
     return (int32_t) (crc32(val ^ 0xffffffff, buf, sz) ^ 0xffffffff);
 }
 
-target_ulong helper_crc32c(target_ulong val, target_ulong m, uint64_t sz)
+target_ulong helper_crc32c(target_ulong val, target_ulong m, target_ulong sz)
 {
     uint8_t buf[8];
     target_ulong mask = ((sz * 8) == 64) ? -1ULL : ((1ULL << (sz * 8)) - 1);