Rev 1293 | Rev 1329 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1293 | Rev 1297 | ||
|---|---|---|---|
| Line 37... | Line 37... | ||
| 37 | #include <ipc/irq.h> |
37 | #include <ipc/irq.h> |
| 38 | #include <ipc/ipcrsc.h> |
38 | #include <ipc/ipcrsc.h> |
| 39 | #include <arch/interrupt.h> |
39 | #include <arch/interrupt.h> |
| 40 | #include <print.h> |
40 | #include <print.h> |
| 41 | #include <syscall/copy.h> |
41 | #include <syscall/copy.h> |
| - | 42 | #include <security/cap.h> |
|
| 42 | 43 | ||
| 43 | #define GET_CHECK_PHONE(phone,phoneid,err) { \ |
44 | #define GET_CHECK_PHONE(phone,phoneid,err) { \ |
| 44 | if (phoneid > IPC_MAX_PHONES) { err; } \ |
45 | if (phoneid > IPC_MAX_PHONES) { err; } \ |
| 45 | phone = &TASK->phones[phoneid]; \ |
46 | phone = &TASK->phones[phoneid]; \ |
| 46 | } |
47 | } |
| Line 488... | Line 489... | ||
| 488 | } |
489 | } |
| 489 | 490 | ||
| 490 | /** Connect irq handler to task */ |
491 | /** Connect irq handler to task */ |
| 491 | __native sys_ipc_register_irq(__native irq, irq_code_t *ucode) |
492 | __native sys_ipc_register_irq(__native irq, irq_code_t *ucode) |
| 492 | { |
493 | { |
| - | 494 | if (!(cap_get(TASK) & CAP_IRQ_REG)) |
|
| - | 495 | return EPERM; |
|
| - | 496 | ||
| 493 | if (irq >= IRQ_COUNT) |
497 | if (irq >= IRQ_COUNT) |
| 494 | return -ELIMIT; |
498 | return (__native) ELIMIT; |
| 495 | 499 | ||
| 496 | irq_ipc_bind_arch(irq); |
500 | irq_ipc_bind_arch(irq); |
| 497 | 501 | ||
| 498 | return ipc_irq_register(&TASK->answerbox, irq, ucode); |
502 | return ipc_irq_register(&TASK->answerbox, irq, ucode); |
| 499 | } |
503 | } |
| 500 | 504 | ||
| 501 | /* Disconnect irq handler from task */ |
505 | /* Disconnect irq handler from task */ |
| 502 | __native sys_ipc_unregister_irq(__native irq) |
506 | __native sys_ipc_unregister_irq(__native irq) |
| 503 | { |
507 | { |
| - | 508 | if (!(cap_get(TASK) & CAP_IRQ_REG)) |
|
| - | 509 | return EPERM; |
|
| - | 510 | ||
| 504 | if (irq >= IRQ_COUNT) |
511 | if (irq >= IRQ_COUNT) |
| 505 | return -ELIMIT; |
512 | return (__native) ELIMIT; |
| 506 | 513 | ||
| 507 | ipc_irq_unregister(&TASK->answerbox, irq); |
514 | ipc_irq_unregister(&TASK->answerbox, irq); |
| 508 | 515 | ||
| 509 | return 0; |
516 | return 0; |
| 510 | } |
517 | } |