From 880ba6b206315437d000ebcac5ed918350ac32cf Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 23 Feb 2022 11:05:08 +0800 Subject: [PATCH 1/3] runtime: add nac3 exception symbols --- src/runtime/src/kernel/api.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/runtime/src/kernel/api.rs b/src/runtime/src/kernel/api.rs index a234c8b..b05467a 100644 --- a/src/runtime/src/kernel/api.rs +++ b/src/runtime/src/kernel/api.rs @@ -202,6 +202,11 @@ pub fn resolve(required: &[u8]) -> Option { // exceptions api!(_Unwind_Resume = unwind::_Unwind_Resume), + api!(__nac3_personality = eh_artiq::artiq_personality), + api!(__nac3_raise = eh_artiq::raise), + api!(__nac3_resume = eh_artiq::resume), + api!(__nac3_end_catch = eh_artiq::end_catch), + // legacy exception symbols api!(__artiq_personality = eh_artiq::artiq_personality), api!(__artiq_raise = eh_artiq::raise), api!(__artiq_resume = eh_artiq::resume), From f38117774f14758888268ba36f867567a18a127f Mon Sep 17 00:00:00 2001 From: pca006132 Date: Mon, 28 Feb 2022 21:15:07 +0800 Subject: [PATCH 2/3] runtime/eh_artiq: updated exception IDs Fixes #166 --- src/runtime/src/eh_artiq.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/runtime/src/eh_artiq.rs b/src/runtime/src/eh_artiq.rs index 281a60c..797b838 100644 --- a/src/runtime/src/eh_artiq.rs +++ b/src/runtime/src/eh_artiq.rs @@ -273,7 +273,7 @@ pub unsafe extern fn raise(exception: *const Exception) -> ! { error!("too many nested exceptions"); // TODO: better reporting? let exception = Exception { - id: get_exception_id("runtimeerror"), + id: get_exception_id("RuntimeError"), file: file!().as_c_slice(), line: line!(), column: column!(), @@ -405,13 +405,17 @@ extern fn stop_fn(_version: c_int, } } -static EXCEPTION_ID_LOOKUP: [(&str, u32); 6] = [ - ("runtimeerror", 0), +static EXCEPTION_ID_LOOKUP: [(&str, u32); 10] = [ + ("RuntimeError", 0), ("RTIOUnderflow", 1), ("RTIOOverflow", 2), ("RTIODestinationUnreachable", 3), ("DMAError", 4), ("I2CError", 5), + ("CacheError", 6), + ("SPIError", 7), + ("ZeroDivisionError", 8), + ("IndexError", 9) ]; pub fn get_exception_id(name: &str) -> u32 { From b56b50b14789ec135366caff7dd4151392cab699 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 1 Mar 2022 09:50:28 +0800 Subject: [PATCH 3/3] add comment about EXCEPTION_ID_LOOKUP sync --- src/runtime/src/eh_artiq.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/src/eh_artiq.rs b/src/runtime/src/eh_artiq.rs index 797b838..e7a8282 100644 --- a/src/runtime/src/eh_artiq.rs +++ b/src/runtime/src/eh_artiq.rs @@ -405,6 +405,7 @@ extern fn stop_fn(_version: c_int, } } +// Must be kept in sync with preallocate_runtime_exception_names() in artiq/language/embedding_map.py static EXCEPTION_ID_LOOKUP: [(&str, u32); 10] = [ ("RuntimeError", 0), ("RTIOUnderflow", 1),