Skip to content

Commit 53b218f

Browse files
committed
Update to latest hl
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent e0cb7d8 commit 53b218f

4 files changed

Lines changed: 29 additions & 25 deletions

File tree

Cargo.lock

Lines changed: 8 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ repository = "https://github.com/hyperlight-dev/hyperlight-wasm"
1313
readme = "README.md"
1414

1515
[workspace.dependencies]
16-
hyperlight-common = { version = "0.13.0", default-features = false }
17-
hyperlight-component-macro = { version = "0.13.0" }
18-
hyperlight-component-util = { version = "0.13.0" }
19-
hyperlight-guest = { version = "0.13.0" }
20-
hyperlight-guest-bin = { version = "0.13.0", features = [ "printf" ] }
21-
hyperlight-host = { version = "0.13.0", default-features = false, features = ["executable_heap", "init-paging"] }
16+
hyperlight-common = { git = "https://github.com/hyperlight-dev/hyperlight", rev = "c9a1a4cefce6a085af92e375121e9f1b1c8deeec", default-features = false }
17+
hyperlight-component-macro = { git = "https://github.com/hyperlight-dev/hyperlight", rev = "c9a1a4cefce6a085af92e375121e9f1b1c8deeec" }
18+
hyperlight-component-util = { git = "https://github.com/hyperlight-dev/hyperlight", rev = "c9a1a4cefce6a085af92e375121e9f1b1c8deeec" }
19+
hyperlight-guest = { git = "https://github.com/hyperlight-dev/hyperlight", rev = "c9a1a4cefce6a085af92e375121e9f1b1c8deeec" }
20+
hyperlight-guest-bin = { git = "https://github.com/hyperlight-dev/hyperlight", rev = "c9a1a4cefce6a085af92e375121e9f1b1c8deeec", features = [ "printf" ] }
21+
hyperlight-host = { git = "https://github.com/hyperlight-dev/hyperlight", rev = "c9a1a4cefce6a085af92e375121e9f1b1c8deeec", default-features = false, features = ["executable_heap"] }
2222
hyperlight-wasm-macro = { version = "0.13.0", path = "src/hyperlight_wasm_macro" }
2323
hyperlight-wasm-runtime = { version = "0.13.0", path = "src/hyperlight_wasm_runtime" }

src/hyperlight_wasm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ test = true
5353

5454
[dependencies]
5555
hyperlight-host.workspace = true
56-
hyperlight-common = "0.13.0"
56+
hyperlight-common.workspace = true
5757
libc = "0.2.183"
5858
once_cell = "1.21.3"
5959
tracing = "0.1.44"

src/hyperlight_wasm/src/sandbox/wasm_sandbox.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
use std::path::Path;
1818
use std::sync::Arc;
1919

20+
use hyperlight_host::mem::memory_region::{MemoryRegion, MemoryRegionFlags, MemoryRegionType};
2021
use hyperlight_host::sandbox::snapshot::Snapshot;
2122
use hyperlight_host::{MultiUseSandbox, Result, new_error};
2223

@@ -116,8 +117,19 @@ impl WasmSandbox {
116117
.as_mut()
117118
.ok_or_else(|| new_error!("WasmSandbox is None"))?;
118119

119-
let wasm_bytes = unsafe { std::slice::from_raw_parts(base as *const u8, len).to_vec() };
120-
load_wasm_module_from_bytes(inner, wasm_bytes)?;
120+
let guest_base: usize = MAPPED_BINARY_VA as usize;
121+
let rgn = MemoryRegion {
122+
host_region: base as usize..base.wrapping_add(len) as usize,
123+
guest_region: guest_base..guest_base + len,
124+
flags: MemoryRegionFlags::READ | MemoryRegionFlags::EXECUTE,
125+
region_type: MemoryRegionType::Heap,
126+
};
127+
if let Ok(()) = unsafe { inner.map_region(&rgn) } {
128+
inner.call::<()>("LoadWasmModulePhys", (MAPPED_BINARY_VA, len as u64))?;
129+
} else {
130+
let wasm_bytes = unsafe { std::slice::from_raw_parts(base as *const u8, len).to_vec() };
131+
load_wasm_module_from_bytes(inner, wasm_bytes)?;
132+
}
121133

122134
self.finalize_module_load()
123135
}

0 commit comments

Comments
 (0)