|
2 | 2 | //! an impl of SyscallImpls trait. |
3 | 3 |
|
4 | 4 | use crate::{ |
5 | | - ckb_constants::{CellField, HeaderField, InputField, Source}, |
| 5 | + ckb_constants::{CellField, HeaderField, InputField, Place, Source}, |
6 | 6 | error::SysError, |
7 | | - syscalls::traits::SyscallImpls, |
| 7 | + syscalls::traits::{Bounds, SyscallImpls}, |
8 | 8 | }; |
9 | 9 | use alloc::{boxed::Box, string::String, vec::Vec}; |
10 | 10 | use core::ffi::CStr; |
@@ -48,7 +48,13 @@ pub fn debug(s: String) { |
48 | 48 | } |
49 | 49 |
|
50 | 50 | pub fn exec(index: usize, source: Source, place: usize, bounds: usize, argv: &[&CStr]) -> u64 { |
51 | | - let result = get().exec(index, source, place, bounds, argv); |
| 51 | + let result = get().exec( |
| 52 | + index, |
| 53 | + source, |
| 54 | + Place::try_from(place as u64).unwrap(), |
| 55 | + Bounds::from(bounds as u64), |
| 56 | + argv, |
| 57 | + ); |
52 | 58 | match result { |
53 | 59 | Ok(_) => 0, |
54 | 60 | Err(e) => e.into(), |
@@ -236,7 +242,14 @@ pub fn spawn( |
236 | 242 | i += 1; |
237 | 243 | } |
238 | 244 | } |
239 | | - let process_id = get().spawn(index, source, place, bounds, &argv, &fds)?; |
| 245 | + let process_id = get().spawn( |
| 246 | + index, |
| 247 | + source, |
| 248 | + Place::try_from(place as u64).unwrap(), |
| 249 | + Bounds::from(bounds as u64), |
| 250 | + &argv, |
| 251 | + &fds, |
| 252 | + )?; |
240 | 253 | unsafe { spgs.process_id.write(process_id) } |
241 | 254 | Ok(process_id) |
242 | 255 | } |
|
0 commit comments