Skip to content

Commit 04b7f28

Browse files
authored
Merge pull request #144 from mohanson-fork/fix_stub_syscalls
Fix stub-syscalls feature
2 parents e92791b + dab89a2 commit 04b7f28

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.github/workflows/develop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ jobs:
1717
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 18 && rm llvm.sh
1818
- name: Test
1919
run: |
20+
cargo build --features=stub-syscalls
2021
make test

src/syscalls/stub.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//! an impl of SyscallImpls trait.
33
44
use crate::{
5-
ckb_constants::{CellField, HeaderField, InputField, Source},
5+
ckb_constants::{CellField, HeaderField, InputField, Place, Source},
66
error::SysError,
7-
syscalls::traits::SyscallImpls,
7+
syscalls::traits::{Bounds, SyscallImpls},
88
};
99
use alloc::{boxed::Box, string::String, vec::Vec};
1010
use core::ffi::CStr;
@@ -48,7 +48,13 @@ pub fn debug(s: String) {
4848
}
4949

5050
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+
);
5258
match result {
5359
Ok(_) => 0,
5460
Err(e) => e.into(),
@@ -236,7 +242,14 @@ pub fn spawn(
236242
i += 1;
237243
}
238244
}
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+
)?;
240253
unsafe { spgs.process_id.write(process_id) }
241254
Ok(process_id)
242255
}

0 commit comments

Comments
 (0)