+static inline void
+handle_sync_exception(struct hart_state* hstate)
+{
+ unsigned int ec;
+
+ ec = esr_ec(hstate->execp.syndrome);
+
+ switch (ec)
+ {
+ case EC_I_ABORT:
+ case EC_D_ABORT:
+ case EC_I_ABORT_EL:
+ case EC_D_ABORT_EL:
+ handle_mm_abort(hstate);
+ break;
+
+ case EC_SVC:
+ aa64_syscall(hstate);
+ break;
+
+ default:
+ fail("unhandled exception (synced)");
+ break;
+ }
+}
+
+static inline void
+handle_async_exception(struct hart_state* hstate)
+{
+ int err = 0;
+
+ err = gic_handle_irq(hstate);
+ if (!err) {
+ return;
+ }
+
+ // TODO do we have other cases of async exception?
+}