From 757d3f2f4d933cc0d915463344b350ed1e334176 Mon Sep 17 00:00:00 2001 From: "Tate, Hongliang Tian" Date: Mon, 24 Sep 2018 14:41:05 +0800 Subject: [PATCH] Use my forked xmas-elf as a submodule --- .gitmodules | 4 ++++ Makefile | 3 +-- deps/xmas-elf | 1 + src/libos/Cargo.lock | 4 +--- src/libos/Cargo.toml | 2 +- src/libos/src/process.rs | 5 ++++- test/hello_world_raw/main.c | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) create mode 160000 deps/xmas-elf diff --git a/.gitmodules b/.gitmodules index 158c4558..ad9ba05a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,6 +2,10 @@ path = deps/rust-sgx-sdk url = https://github.com/baidu/rust-sgx-sdk branch = master +[submodule "deps/xmas-elf"] + path = deps/xmas-elf + url = http://github.com/tatetian/xmas-elf + branch = master [submodule "deps/sgx_protect_file"] path = deps/sgx_protect_file url = https://github.com/tatetian/sgx_protect_file diff --git a/Makefile b/Makefile index 61a06384..4ad4bf78 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,9 @@ all: build_src build_test -init: +submodule: git submodule init git submodule update - #cd deps/rust-sgx-sdk && git apply ../rust-sgx-sdk.patch cd deps/sgx_protect_file && make build_src: diff --git a/deps/xmas-elf b/deps/xmas-elf new file mode 160000 index 00000000..79210550 --- /dev/null +++ b/deps/xmas-elf @@ -0,0 +1 @@ +Subproject commit 792105500ef80bdfe6f45ca6f64865121e4699c5 diff --git a/src/libos/Cargo.lock b/src/libos/Cargo.lock index 488ccb36..4b618375 100644 --- a/src/libos/Cargo.lock +++ b/src/libos/Cargo.lock @@ -6,7 +6,7 @@ dependencies = [ "sgx_trts 1.0.1", "sgx_tstd 1.0.1", "sgx_types 1.0.1", - "xmas-elf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "xmas-elf 0.6.2", ] [[package]] @@ -80,7 +80,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "xmas-elf" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "zero 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -94,5 +93,4 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" "checksum spin 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "37b5646825922b96b5d7d676b5bb3458a54498e96ed7b0ce09dc43a07038fea4" "checksum version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7716c242968ee87e5542f8021178248f267f295a5c4803beae8b8b7fd9bc6051" -"checksum xmas-elf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "22678df5df766e8d1e5d609da69f0c3132d794edf6ab5e75e7abcd2270d4cf58" "checksum zero 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f1bc8a6b2005884962297587045002d8cfb8dcec9db332f4ca216ddc5de82c5" diff --git a/src/libos/Cargo.toml b/src/libos/Cargo.toml index b21ec54f..5f3d783c 100644 --- a/src/libos/Cargo.toml +++ b/src/libos/Cargo.toml @@ -7,13 +7,13 @@ name = "libos" crate-type = ["staticlib"] [dependencies] -xmas-elf = "0.6" lazy_static = { version = "1.1.0", features = ["spin_no_std"] } # Implies nightly [features] default = [] [target.'cfg(not(target_env = "sgx"))'.dependencies] +xmas-elf = { path = "../../deps/xmas-elf" } sgx_types = { path = "../../deps/rust-sgx-sdk/sgx_types" } sgx_tstd = { path = "../../deps/rust-sgx-sdk/sgx_tstd", features = ["backtrace"] } sgx_trts = { path = "../../deps/rust-sgx-sdk/sgx_trts" } diff --git a/src/libos/src/process.rs b/src/libos/src/process.rs index 36d895a4..af95481c 100644 --- a/src/libos/src/process.rs +++ b/src/libos/src/process.rs @@ -135,9 +135,12 @@ pub fn do_wait4(child_pid: u32, exit_code: &mut i32) -> Result<(), &'static str> *exit_code = guard.exit_code; break; } - del_from_pid_table(guard.pid); drop(guard); } + + let child_pid = child_process.lock().unwrap().pid; + del_from_pid_table(child_pid); + Ok(()) } diff --git a/test/hello_world_raw/main.c b/test/hello_world_raw/main.c index 1ad27131..127d511c 100644 --- a/test/hello_world_raw/main.c +++ b/test/hello_world_raw/main.c @@ -4,6 +4,6 @@ char str_buf[] = "Hello World!\n"; unsigned long str_size = sizeof(str_buf); void _start(void) { - //__rusgx_write(1, str_buf, str_size); + __rusgx_write(1, str_buf, str_size); __rusgx_exit(0); }