Tidy up trap-handling code.
This commit is contained in:
@@ -23,6 +23,9 @@ cast = { version = "0.2.2", default-features = false }
|
||||
failure = { version = "0.1.3", default-features = false }
|
||||
failure_derive = { version = "0.1.3", default-features = false }
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
winapi = { version = "0.3.6", features = ["winbase", "memoryapi"] }
|
||||
|
||||
[build-dependencies]
|
||||
cmake = "0.1.35"
|
||||
bindgen = "0.44.0"
|
||||
|
||||
@@ -453,7 +453,9 @@ WasmTrapHandler(LPEXCEPTION_POINTERS exception)
|
||||
|
||||
EXCEPTION_RECORD* record = exception->ExceptionRecord;
|
||||
if (record->ExceptionCode != EXCEPTION_ACCESS_VIOLATION &&
|
||||
record->ExceptionCode != EXCEPTION_ILLEGAL_INSTRUCTION)
|
||||
record->ExceptionCode != EXCEPTION_ILLEGAL_INSTRUCTION &&
|
||||
record->ExceptionCode != EXCEPTION_STACK_OVERFLOW &&
|
||||
record->ExceptionCode != EXCEPTION_INT_DIVIDE_BY_ZERO)
|
||||
{
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ extern crate cast;
|
||||
extern crate failure;
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
#[cfg(target_os = "windows")]
|
||||
extern crate winapi;
|
||||
|
||||
mod export;
|
||||
mod imports;
|
||||
|
||||
@@ -130,7 +130,7 @@ impl Drop for Mmap {
|
||||
if !self.ptr.is_null() {
|
||||
use winapi::um::memoryapi::VirtualFree;
|
||||
use winapi::um::winnt::MEM_RELEASE;
|
||||
let r = unsafe { VirtualFree(self.ptr, self.len, MEM_RELEASE) };
|
||||
let r = unsafe { VirtualFree(self.ptr as *mut libc::c_void, self.len, MEM_RELEASE) };
|
||||
assert_eq!(r, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user