Skip to contentSkip to conversation

target/nios2: Fix semihost lseek offset computation

PATCH In review Keith Packard via 3 participants 4 messages Jul 31, 2023 – Aug 1, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/nios2: 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.

---
 target/nios2/nios2-semi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/nios2/nios2-semi.c +1 -1
index ffd1f095f6..fc1df1dfeb 100644
@@ -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:
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Keith Packard via

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.

---
 target/nios2/nios2-semi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/nios2/nios2-semi.c +0 -0
index ffd1f095f6..fc1df1dfeb 100644

target/nios2/nios2-semi.c void do_nios2_semihosting(CPUNios2State *env) · line 176

Quoted 8 lines
target/nios2/nios2-semi.c +1 -1
@@ -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")

thanks
-- PMM

#2 lore raw
Quoted 23 lines · Peter Maydell
Quoted 22 lines · Keith Packard via

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.

---
  target/nios2/nios2-semi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target/nios2/nios2-semi.c +1 -1
index ffd1f095f6..fc1df1dfeb 100644
@@ -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;
 
Quoted 5 lines

target/nios2/nios2-semi.c void do_nios2_semihosting(CPUNios2State *env) · line 176

Quoted 1 line
target/nios2/nios2-semi.c +0 -0
      case HOSTED_RENAME:
Fixes d1e23cbaa403b2d ("target/nios2: Use semihosting/syscalls.h")

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

#3 lore raw
In reply to Keith Packard via
Quoted 8 lines · Keith Packard via

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.

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

Thanks, queued via misc-fixes.