diff options
| author | Sean Cross <sean@xobs.io> | 2023-12-07 17:36:00 +0800 |
|---|---|---|
| committer | Sean Cross <sean@xobs.io> | 2024-01-13 09:13:55 -0800 |
| commit | dee1c260b8ab3d093dc571a0954f645a43b822bc (patch) | |
| tree | beb0d151c0761a7c10ac31abbc62862035ec0310 | |
| parent | 1d8d7b16cbcd048e98359cd0d42b03bc1710cca8 (diff) | |
| download | rust-dee1c260b8ab3d093dc571a0954f645a43b822bc.tar.gz rust-dee1c260b8ab3d093dc571a0954f645a43b822bc.zip | |
xous: ffi: fix lend_impl() return values
The `ret1` and `ret2` return values from lend operations are returned in $a1 and $a2. This function incorrectly pulled them from $a6 and $a7, causing them to always be `0`. Signed-off-by: Sean Cross <sean@xobs.io>
| -rw-r--r-- | library/std/src/os/xous/ffi.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/library/std/src/os/xous/ffi.rs b/library/std/src/os/xous/ffi.rs index 8be7fbb102f..0a7f9a10d4d 100644 --- a/library/std/src/os/xous/ffi.rs +++ b/library/std/src/os/xous/ffi.rs @@ -88,29 +88,31 @@ fn lend_impl( let a3 = opcode; let a4 = data.as_ptr() as usize; let a5 = data.len(); - let mut a6 = arg1; - let mut a7 = arg2; + let a6 = arg1; + let a7 = arg2; + let mut ret1; + let mut ret2; unsafe { core::arch::asm!( "ecall", inlateout("a0") a0, - inlateout("a1") a1 => _, - inlateout("a2") a2 => _, + inlateout("a1") a1 => ret1, + inlateout("a2") a2 => ret2, inlateout("a3") a3 => _, inlateout("a4") a4 => _, inlateout("a5") a5 => _, - inlateout("a6") a6, - inlateout("a7") a7, + inlateout("a6") a6 => _, + inlateout("a7") a7 => _, ) }; let result = a0; if result == SyscallResult::MemoryReturned as usize { - Ok((a6, a7)) + Ok((ret1, ret2)) } else if result == SyscallResult::Error as usize { - Err(a1.into()) + Err(ret1.into()) } else { Err(Error::InternalError) } |
