Skip to content

Commit 00d4d82

Browse files
committed
fixup! Implement wasmtime_memory_image APIs
Minor cleanups from review feedback Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
1 parent 0f76801 commit 00d4d82

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/hyperlight_wasm_runtime/src/platform.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ pub extern "C" fn wasmtime_init_traps(handler: wasmtime_trap_handler_t) -> i32 {
175175
// Copy a VA range to a new VA. Old and new VA, and len, must be
176176
// page-aligned.
177177
fn copy_va_mapping(base: *const u8, len: usize, to_va: *mut u8, remap_original: bool) {
178+
debug_assert!((base as usize).is_multiple_of(vmem::PAGE_SIZE));
179+
debug_assert!(len.is_multiple_of(vmem::PAGE_SIZE));
178180
// TODO: all this barrier code is amd64 specific. It should be
179181
// refactored to use some better architecture-independent APIs.
180182
//
@@ -244,7 +246,7 @@ fn copy_va_mapping(base: *const u8, len: usize, to_va: *mut u8, remap_original:
244246
if do_downgrade {
245247
// Since we have downgraded a page from writable to CoW we
246248
// need to do an invlpg on it. Because invlpg is a
247-
// serialising instruction, we don't need need the other
249+
// serialising instruction, we don't need the other
248250
// barrier for the new mapping.
249251
unsafe {
250252
core::arch::asm!("invlpg [{}]", in(reg) mapping.virt_base, options(readonly, nostack, preserves_flags));

0 commit comments

Comments
 (0)