From cc4b512bde565fec6b736fbde24db65e143b980a Mon Sep 17 00:00:00 2001 From: losfair Date: Tue, 11 Feb 2020 03:16:56 +0800 Subject: [PATCH] Fix clif trap code conversions. --- lib/clif-backend/src/signal/unix.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/clif-backend/src/signal/unix.rs b/lib/clif-backend/src/signal/unix.rs index 925b8f6d7..81f751f37 100644 --- a/lib/clif-backend/src/signal/unix.rs +++ b/lib/clif-backend/src/signal/unix.rs @@ -90,10 +90,16 @@ pub fn call_protected( { Err(CallProtError(Box::new(match Signal::from_c_int(signum) { Ok(SIGILL) => match trapcode { - TrapCode::BadSignature => ExceptionCode::IncorrectCallIndirectSignature, - TrapCode::IndirectCallToNull => ExceptionCode::CallIndirectOOB, + TrapCode::StackOverflow => ExceptionCode::MemoryOutOfBounds, TrapCode::HeapOutOfBounds => ExceptionCode::MemoryOutOfBounds, TrapCode::TableOutOfBounds => ExceptionCode::CallIndirectOOB, + TrapCode::OutOfBounds => ExceptionCode::MemoryOutOfBounds, + TrapCode::IndirectCallToNull => ExceptionCode::CallIndirectOOB, + TrapCode::BadSignature => ExceptionCode::IncorrectCallIndirectSignature, + TrapCode::IntegerOverflow => ExceptionCode::IllegalArithmetic, + TrapCode::IntegerDivisionByZero => ExceptionCode::IllegalArithmetic, + TrapCode::BadConversionToInteger => ExceptionCode::IllegalArithmetic, + TrapCode::UnreachableCodeReached => ExceptionCode::Unreachable, _ => { return Err(CallProtError(Box::new( "unknown clif trap code".to_string(),