1 #include <lunaix/process.h>
3 #include <asm/aa64_exception.h>
6 handle_mm_abort(struct hart_state* state);
9 aa64_syscall(struct hart_state* hstate);
12 update_thread_context(struct hart_state* state)
14 if (!current_thread) {
18 struct hart_state* parent = current_thread->hstate;
19 hart_push_state(parent, state);
21 current_thread->hstate = state;
22 current_thread->ustack_top = state->execp.sp_el0;
25 state->depth = parent->depth + 1;
30 handle_sync_exception(struct hart_state* hstate)
34 ec = esr_ec(hstate->execp.syndrome);
42 handle_mm_abort(hstate);
50 fail("unhandled exception (synced)");
56 handle_async_exception(struct hart_state* hstate)
60 err = gic_handle_irq(hstate);
65 // TODO do we have other cases of async exception?
69 handle_exception(struct hart_state* hstate)
71 update_thread_context(hstate);
73 if (hart_vector_stamp(hstate) == EXCEPTION_SYNC) {
74 handle_sync_exception(hstate);
76 handle_async_exception(hstate);