Add generic range bounds to mmap (#110)

This commit is contained in:
Lachlan Sneff
2019-01-23 09:37:56 -08:00
committed by GitHub
parent f5407eef7c
commit 7632beced8
4 changed files with 42 additions and 14 deletions

View File

@@ -63,7 +63,7 @@ impl FuncResolverBuilder {
.map_err(|e| CompileError::InternalError { msg: e.to_string() })?;
unsafe {
memory
.protect(0..memory.size(), Protect::ReadWrite)
.protect(.., Protect::ReadWrite)
.map_err(|e| CompileError::InternalError { msg: e.to_string() })?;
}
@@ -179,7 +179,7 @@ impl FuncResolverBuilder {
unsafe {
self.resolver
.memory
.protect(0..self.resolver.memory.size(), Protect::ReadExec)
.protect(.., Protect::ReadExec)
.map_err(|e| CompileError::InternalError { msg: e.to_string() })?;
}

View File

@@ -66,9 +66,7 @@ impl Trampolines {
let mut memory = Memory::with_size(total_size).unwrap();
unsafe {
memory
.protect(0..memory.size(), Protect::ReadWrite)
.unwrap();
memory.protect(.., Protect::ReadWrite).unwrap();
}
// "\xCC" disassembles to "int3", which will immediately cause
@@ -91,7 +89,7 @@ impl Trampolines {
}
unsafe {
memory.protect(0..memory.size(), Protect::ReadExec).unwrap();
memory.protect(.., Protect::ReadExec).unwrap();
}
Self {