Rev 2787 | Rev 3125 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2787 | Rev 3123 | ||
---|---|---|---|
Line 40... | Line 40... | ||
40 | #include <interrupt.h> |
40 | #include <interrupt.h> |
41 | #include <arch/machine.h> |
41 | #include <arch/machine.h> |
42 | #include <arch/mm/page_fault.h> |
42 | #include <arch/mm/page_fault.h> |
43 | #include <print.h> |
43 | #include <print.h> |
44 | #include <syscall/syscall.h> |
44 | #include <syscall/syscall.h> |
- | 45 | #include <udebug/udebug.h> |
|
45 | 46 | ||
46 | /** Offset used in calculation of exception handler's relative address. |
47 | /** Offset used in calculation of exception handler's relative address. |
47 | * |
48 | * |
48 | * @see install_handler() |
49 | * @see install_handler() |
49 | */ |
50 | */ |
Line 289... | Line 290... | ||
289 | { |
290 | { |
290 | istate->r0 = syscall_handler(istate->r0, istate->r1, istate->r2, |
291 | istate->r0 = syscall_handler(istate->r0, istate->r1, istate->r2, |
291 | istate->r3, istate->r4, istate->r5, istate->r6); |
292 | istate->r3, istate->r4, istate->r5, istate->r6); |
292 | } |
293 | } |
293 | 294 | ||
- | 295 | /** Data abort exception handler. |
|
- | 296 | * |
|
- | 297 | * Determines whether the exception was caused by a breakpoint |
|
- | 298 | * instruction or a page fault. |
|
- | 299 | */ |
|
- | 300 | static void data_abort_exception(int exc_no, istate_t *istate) |
|
- | 301 | { |
|
- | 302 | uint32_t *instr_addr = (uint32_t *) istate->pc; |
|
- | 303 | uint32_t opcode = *instr_addr; |
|
- | 304 | ||
- | 305 | if ((opcode & 0xfff000f0) == 0xe1200070) { |
|
- | 306 | /* Bkpt */ |
|
- | 307 | if (istate_from_uspace(istate)) { |
|
- | 308 | udebug_breakpoint_event(0); |
|
- | 309 | } else { |
|
- | 310 | panic("Unexpected BKPT instruction at 0x%x", |
|
- | 311 | istate->pc); |
|
- | 312 | } |
|
- | 313 | } else { |
|
- | 314 | /* Page fault */ |
|
- | 315 | data_abort(exc_no, istate); |
|
- | 316 | } |
|
- | 317 | } |
|
- | 318 | ||
294 | /** Interrupt Exception handler. |
319 | /** Interrupt Exception handler. |
295 | * |
320 | * |
296 | * Determines the sources of interrupt and calls their handlers. |
321 | * Determines the sources of interrupt and calls their handlers. |
297 | */ |
322 | */ |
298 | static void irq_exception(int exc_no, istate_t *istate) |
323 | static void irq_exception(int exc_no, istate_t *istate) |
Line 353... | Line 378... | ||
353 | install_exception_handlers(); |
378 | install_exception_handlers(); |
354 | 379 | ||
355 | exc_register(EXC_IRQ, "interrupt", (iroutine) irq_exception); |
380 | exc_register(EXC_IRQ, "interrupt", (iroutine) irq_exception); |
356 | exc_register(EXC_PREFETCH_ABORT, "prefetch abort", |
381 | exc_register(EXC_PREFETCH_ABORT, "prefetch abort", |
357 | (iroutine) prefetch_abort); |
382 | (iroutine) prefetch_abort); |
358 | exc_register(EXC_DATA_ABORT, "data abort", (iroutine) data_abort); |
383 | exc_register(EXC_DATA_ABORT, "data abort", |
- | 384 | (iroutine) data_abort_exception); |
|
359 | exc_register(EXC_SWI, "software interrupt", (iroutine) swi_exception); |
385 | exc_register(EXC_SWI, "software interrupt", (iroutine) swi_exception); |
360 | } |
386 | } |
361 | 387 | ||
362 | /** Prints #istate_t structure content. |
388 | /** Prints #istate_t structure content. |
363 | * |
389 | * |