Skip to content

Commit

Permalink
Fix clif trap code conversions.
Browse files Browse the repository at this point in the history
  • Loading branch information
losfair committed Feb 10, 2020
1 parent b40edd4 commit cc4b512
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/clif-backend/src/signal/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,16 @@ pub fn call_protected<T>(
{
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(),
Expand Down

0 comments on commit cc4b512

Please sign in to comment.