diff --git a/src/runtime/src/eh_artiq.rs b/src/runtime/src/eh_artiq.rs index 281a60c..e7a8282 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,18 @@ extern fn stop_fn(_version: c_int, } } -static EXCEPTION_ID_LOOKUP: [(&str, u32); 6] = [ - ("runtimeerror", 0), +// 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), ("RTIOOverflow", 2), ("RTIODestinationUnreachable", 3), ("DMAError", 4), ("I2CError", 5), + ("CacheError", 6), + ("SPIError", 7), + ("ZeroDivisionError", 8), + ("IndexError", 9) ]; pub fn get_exception_id(name: &str) -> u32 { diff --git a/src/runtime/src/kernel/api.rs b/src/runtime/src/kernel/api.rs index 122c7bb..1c55d3e 100644 --- a/src/runtime/src/kernel/api.rs +++ b/src/runtime/src/kernel/api.rs @@ -203,6 +203,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),