|
1 | 1 | use std::mem;
|
2 | 2 |
|
3 | 3 | use fvm_shared::error::ErrorNumber;
|
| 4 | +use fvm_shared::sys::SyscallSafe; |
4 | 5 | use wasmtime::{Caller, Linker, Trap, WasmTy};
|
5 | 6 |
|
6 | 7 | use super::context::Memory;
|
@@ -50,14 +51,14 @@ pub(super) trait BindSyscall<Args, Ret, Func> {
|
50 | 51 | /// results that can be handled by wasmtime. See the documentation on `BindSyscall` for details.
|
51 | 52 | #[doc(hidden)]
|
52 | 53 | pub trait IntoSyscallResult: Sized {
|
53 |
| - type Value: Copy + Sized + 'static; |
| 54 | + type Value: SyscallSafe; |
54 | 55 | fn into(self) -> Result<Result<Self::Value, SyscallError>, Abort>;
|
55 | 56 | }
|
56 | 57 |
|
57 | 58 | // Implementations for syscalls that abort on error.
|
58 | 59 | impl<T> IntoSyscallResult for Result<T, Abort>
|
59 | 60 | where
|
60 |
| - T: Copy + Sized + 'static, |
| 61 | + T: SyscallSafe, |
61 | 62 | {
|
62 | 63 | type Value = T;
|
63 | 64 | fn into(self) -> Result<Result<Self::Value, SyscallError>, Abort> {
|
|
68 | 69 | // Implementations for normal syscalls.
|
69 | 70 | impl<T> IntoSyscallResult for kernel::Result<T>
|
70 | 71 | where
|
71 |
| - T: Copy + Sized + 'static, |
| 72 | + T: SyscallSafe, |
72 | 73 | {
|
73 | 74 | type Value = T;
|
74 | 75 | fn into(self) -> Result<Result<Self::Value, SyscallError>, Abort> {
|
@@ -135,7 +136,7 @@ macro_rules! impl_bind_syscalls {
|
135 | 136 | K: Kernel,
|
136 | 137 | Func: Fn(Context<'_, K> $(, $t)*) -> Ret + Send + Sync + 'static,
|
137 | 138 | Ret: IntoSyscallResult,
|
138 |
| - $($t: WasmTy,)* |
| 139 | + $($t: WasmTy+SyscallSafe,)* |
139 | 140 | {
|
140 | 141 | fn bind(
|
141 | 142 | &mut self,
|
|
0 commit comments