[PATCH v3 11/13] target/openrisc: Replace MO_TE -> MO_BE

Philippe Mathieu-Daudé posted 13 patches 1 month ago
Maintainers: Stafford Horne <shorne@gmail.com>
[PATCH v3 11/13] target/openrisc: Replace MO_TE -> MO_BE
Posted by Philippe Mathieu-Daudé 1 month ago
We only build the OpenRISC targets using big endianness order:

  $ git grep TARGET_BIG_ENDIAN configs/targets/or1k-*
  configs/targets/or1k-linux-user.mak:2:TARGET_BIG_ENDIAN=y
  configs/targets/or1k-softmmu.mak:2:TARGET_BIG_ENDIAN=y

Therefore the MO_TE definition always expands to MO_BE. Use the
latter to simplify.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/openrisc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
index 6879a0cff80..a626ffaf25b 100644
--- a/target/openrisc/translate.c
+++ b/target/openrisc/translate.c
@@ -61,7 +61,7 @@ typedef struct DisasContext {
 
 static inline MemOp mo_endian(DisasContext *dc)
 {
-    return MO_TE;
+    return MO_BE;
 }
 
 static inline bool is_user(DisasContext *dc)
-- 
2.51.0


Re: [PATCH v3 11/13] target/openrisc: Replace MO_TE -> MO_BE
Posted by Richard Henderson 1 month ago
On 10/10/25 00:06, Philippe Mathieu-Daudé wrote:
> We only build the OpenRISC targets using big endianness order:
> 
>    $ git grep TARGET_BIG_ENDIAN configs/targets/or1k-*
>    configs/targets/or1k-linux-user.mak:2:TARGET_BIG_ENDIAN=y
>    configs/targets/or1k-softmmu.mak:2:TARGET_BIG_ENDIAN=y
> 
> Therefore the MO_TE definition always expands to MO_BE. Use the
> latter to simplify.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/openrisc/translate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
> index 6879a0cff80..a626ffaf25b 100644
> --- a/target/openrisc/translate.c
> +++ b/target/openrisc/translate.c
> @@ -61,7 +61,7 @@ typedef struct DisasContext {
>   
>   static inline MemOp mo_endian(DisasContext *dc)
>   {
> -    return MO_TE;
> +    return MO_BE;
>   }
>   
>   static inline bool is_user(DisasContext *dc)

Add the same sort of 'little-endian enabled by SR[LEE]' comment that you did for RISC-V.

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

Re: [PATCH v3 11/13] target/openrisc: Replace MO_TE -> MO_BE
Posted by Philippe Mathieu-Daudé 1 month ago
On 10/10/25 21:00, Richard Henderson wrote:
> On 10/10/25 00:06, Philippe Mathieu-Daudé wrote:
>> We only build the OpenRISC targets using big endianness order:
>>
>>    $ git grep TARGET_BIG_ENDIAN configs/targets/or1k-*
>>    configs/targets/or1k-linux-user.mak:2:TARGET_BIG_ENDIAN=y
>>    configs/targets/or1k-softmmu.mak:2:TARGET_BIG_ENDIAN=y
>>
>> Therefore the MO_TE definition always expands to MO_BE. Use the
>> latter to simplify.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   target/openrisc/translate.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
>> index 6879a0cff80..a626ffaf25b 100644
>> --- a/target/openrisc/translate.c
>> +++ b/target/openrisc/translate.c
>> @@ -61,7 +61,7 @@ typedef struct DisasContext {
>>   static inline MemOp mo_endian(DisasContext *dc)
>>   {
>> -    return MO_TE;
>> +    return MO_BE;
>>   }
>>   static inline bool is_user(DisasContext *dc)
> 
> Add the same sort of 'little-endian enabled by SR[LEE]' comment that you 
> did for RISC-V.

I squashed:

     /* The SR_LEE bit sets the (little) endianness, but we don't 
implement it. */

> 
> Otherwise,
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Thanks!