diff mbox series

target/nios2: Fix semihost lseek offset computation

Message ID 20230731235245.295513-1-keithp@keithp.com (mailing list archive)
State New, archived
Headers show
Series target/nios2: Fix semihost lseek offset computation | expand

Commit Message

Keith Packard July 31, 2023, 11:52 p.m. UTC
The arguments for deposit64 are (value, start, length, fieldval); this
appears to have thought they were (value, fieldval, start,
length). Reorder the parameters to match the actual function.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 target/nios2/nios2-semi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Maydell Aug. 1, 2023, 12:06 p.m. UTC | #1
On Tue, 1 Aug 2023 at 00:53, Keith Packard via <qemu-devel@nongnu.org> wrote:
>
> The arguments for deposit64 are (value, start, length, fieldval); this
> appears to have thought they were (value, fieldval, start,
> length). Reorder the parameters to match the actual function.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>  target/nios2/nios2-semi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c
> index ffd1f095f6..fc1df1dfeb 100644
> --- a/target/nios2/nios2-semi.c
> +++ b/target/nios2/nios2-semi.c
> @@ -170,7 +170,7 @@ void do_nios2_semihosting(CPUNios2State *env)
>          GET_ARG64(2);
>          GET_ARG64(3);
>          semihost_sys_lseek(cs, nios2_semi_u64_cb, arg0,
> -                           deposit64(arg2, arg1, 32, 32), arg3);
> +                           deposit64(arg2, 32, 32, arg1), arg3);
>          break;
>
>      case HOSTED_RENAME:

Fixes: d1e23cbaa403b2d ("target/nios2: Use semihosting/syscalls.h")
Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Philippe Mathieu-Daudé Aug. 1, 2023, 1:23 p.m. UTC | #2
On 1/8/23 14:06, Peter Maydell wrote:
> On Tue, 1 Aug 2023 at 00:53, Keith Packard via <qemu-devel@nongnu.org> wrote:
>>
>> The arguments for deposit64 are (value, start, length, fieldval); this
>> appears to have thought they were (value, fieldval, start,
>> length). Reorder the parameters to match the actual function.
>>
>> Signed-off-by: Keith Packard <keithp@keithp.com>
>> ---
>>   target/nios2/nios2-semi.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c
>> index ffd1f095f6..fc1df1dfeb 100644
>> --- a/target/nios2/nios2-semi.c
>> +++ b/target/nios2/nios2-semi.c
>> @@ -170,7 +170,7 @@ void do_nios2_semihosting(CPUNios2State *env)
>>           GET_ARG64(2);
>>           GET_ARG64(3);
>>           semihost_sys_lseek(cs, nios2_semi_u64_cb, arg0,
>> -                           deposit64(arg2, arg1, 32, 32), arg3);
>> +                           deposit64(arg2, 32, 32, arg1), arg3);
>>           break;
>>
>>       case HOSTED_RENAME:
> 
> Fixes: d1e23cbaa403b2d ("target/nios2: Use semihosting/syscalls.h")
> Cc: qemu-stable@nongnu.org
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Commit 950272506d ("target/m68k: Use semihosting/syscalls.h") has the
same issue.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Philippe Mathieu-Daudé Aug. 1, 2023, 9:46 p.m. UTC | #3
On 1/8/23 01:52, Keith Packard via wrote:
> The arguments for deposit64 are (value, start, length, fieldval); this
> appears to have thought they were (value, fieldval, start,
> length). Reorder the parameters to match the actual function.
> 
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>   target/nios2/nios2-semi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, queued via misc-fixes.
diff mbox series

Patch

diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c
index ffd1f095f6..fc1df1dfeb 100644
--- a/target/nios2/nios2-semi.c
+++ b/target/nios2/nios2-semi.c
@@ -170,7 +170,7 @@  void do_nios2_semihosting(CPUNios2State *env)
         GET_ARG64(2);
         GET_ARG64(3);
         semihost_sys_lseek(cs, nios2_semi_u64_cb, arg0,
-                           deposit64(arg2, arg1, 32, 32), arg3);
+                           deposit64(arg2, 32, 32, arg1), arg3);
         break;
 
     case HOSTED_RENAME: