Skip to contentSkip to conversation

target/m68k: Fix semihost lseek offset computation

PATCH In review Peter Maydell 2 participants 3 messages Aug 1, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/m68k: Fix semihost lseek offset computation

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.

Fixes 950272506d ("target/m68k: Use semihosting/syscalls.h")

---
Same fix for m68k as Keith Packard just sent for nios2

---
 target/m68k/m68k-semi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/m68k/m68k-semi.c +1 -1
index 88ad9ba8144..239f6e44e90 100644
@@ -166,7 +166,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
         GET_ARG64(2);
         GET_ARG64(3);
         semihost_sys_lseek(cs, m68k_semi_u64_cb, arg0,
-                           deposit64(arg2, arg1, 32, 32), arg3);
+                           deposit64(arg2, 32, 32, arg1), arg3);
         break;
 
     case HOSTED_RENAME:
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Peter Maydell

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.

Fixes 950272506d ("target/m68k: Use semihosting/syscalls.h")

---
Same fix for m68k as Keith Packard just sent for nios2

---
  target/m68k/m68k-semi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target/m68k/m68k-semi.c +0 -0
index 88ad9ba8144..239f6e44e90 100644

target/m68k/m68k-semi.c void do_m68k_semihosting(CPUM68KState *env, int nr) · line 172

Quoted 8 lines
target/m68k/m68k-semi.c +1 -1
@@ -166,7 +166,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
          GET_ARG64(2);
          GET_ARG64(3);
          semihost_sys_lseek(cs, m68k_semi_u64_cb, arg0,
-                           deposit64(arg2, arg1, 32, 32), arg3);
+                           deposit64(arg2, 32, 32, arg1), arg3);
          break;
 
      case HOSTED_RENAME:

Thanks for writing the fix!

#2 lore raw
In reply to Peter Maydell
Quoted 8 lines · Peter Maydell

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.

Fixes 950272506d ("target/m68k: Use semihosting/syscalls.h")
Quoted 5 lines

---
Same fix for m68k as Keith Packard just sent for nios2

---
  target/m68k/m68k-semi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, queued via misc-fixes.