Rev 1248 | Rev 1281 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1248 | Rev 1258 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | #include <memstr.h> |
34 | #include <memstr.h> |
35 | #include <debug.h> |
35 | #include <debug.h> |
36 | #include <ipc/ipc.h> |
36 | #include <ipc/ipc.h> |
37 | #include <ipc/sysipc.h> |
37 | #include <ipc/sysipc.h> |
38 | #include <ipc/ipcrsc.h> |
38 | #include <ipc/ipcrsc.h> |
39 | - | ||
- | 39 | #include <arch/interrupt.h> |
|
40 | 40 | ||
41 | #include <print.h> |
41 | #include <print.h> |
42 | #include <arch.h> |
42 | #include <arch.h> |
43 | #include <proc/thread.h> |
43 | #include <proc/thread.h> |
44 | 44 | ||
Line 272... | Line 272... | ||
272 | if (check_call_limit()) |
272 | if (check_call_limit()) |
273 | return IPC_CALLRET_TEMPORARY; |
273 | return IPC_CALLRET_TEMPORARY; |
274 | 274 | ||
275 | GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL); |
275 | GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL); |
276 | 276 | ||
277 | call = ipc_call_alloc(); |
277 | call = ipc_call_alloc(0); |
278 | IPC_SET_METHOD(call->data, method); |
278 | IPC_SET_METHOD(call->data, method); |
279 | IPC_SET_ARG1(call->data, arg1); |
279 | IPC_SET_ARG1(call->data, arg1); |
280 | IPC_SET_ARG2(call->data, arg2); |
280 | IPC_SET_ARG2(call->data, arg2); |
281 | 281 | ||
282 | if (!(res=request_preprocess(call))) |
282 | if (!(res=request_preprocess(call))) |
Line 300... | Line 300... | ||
300 | if (check_call_limit()) |
300 | if (check_call_limit()) |
301 | return IPC_CALLRET_TEMPORARY; |
301 | return IPC_CALLRET_TEMPORARY; |
302 | 302 | ||
303 | GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL); |
303 | GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL); |
304 | 304 | ||
305 | call = ipc_call_alloc(); |
305 | call = ipc_call_alloc(0); |
306 | copy_from_uspace(&call->data.args, &data->args, sizeof(call->data.args)); |
306 | copy_from_uspace(&call->data.args, &data->args, sizeof(call->data.args)); |
307 | if (!(res=request_preprocess(call))) |
307 | if (!(res=request_preprocess(call))) |
308 | ipc_call(phone, call); |
308 | ipc_call(phone, call); |
309 | else |
309 | else |
310 | ipc_backsend_err(phone, call, res); |
310 | ipc_backsend_err(phone, call, res); |
Line 439... | Line 439... | ||
439 | restart: |
439 | restart: |
440 | call = ipc_wait_for_call(&TASK->answerbox, flags); |
440 | call = ipc_wait_for_call(&TASK->answerbox, flags); |
441 | if (!call) |
441 | if (!call) |
442 | return 0; |
442 | return 0; |
443 | 443 | ||
- | 444 | if (call->flags & IPC_CALL_NOTIF) { |
|
- | 445 | ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC)); |
|
- | 446 | STRUCT_TO_USPACE(&calldata->args, &call->data.args); |
|
- | 447 | ipc_call_free(call); |
|
- | 448 | ||
- | 449 | return ((__native)call) | IPC_CALLID_NOTIFICATION; |
|
- | 450 | } |
|
- | 451 | ||
444 | if (call->flags & IPC_CALL_ANSWERED) { |
452 | if (call->flags & IPC_CALL_ANSWERED) { |
445 | process_answer(call); |
453 | process_answer(call); |
446 | 454 | ||
447 | ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC)); |
455 | ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC)); |
448 | 456 | ||
Line 465... | Line 473... | ||
465 | /* Include phone address('id') of the caller in the request, |
473 | /* Include phone address('id') of the caller in the request, |
466 | * copy whole call->data, not only call->data.args */ |
474 | * copy whole call->data, not only call->data.args */ |
467 | STRUCT_TO_USPACE(calldata, &call->data); |
475 | STRUCT_TO_USPACE(calldata, &call->data); |
468 | return (__native)call; |
476 | return (__native)call; |
469 | } |
477 | } |
- | 478 | ||
- | 479 | /** Connect irq handler to task */ |
|
- | 480 | __native sys_ipc_register_irq(__native irq) |
|
- | 481 | { |
|
- | 482 | if (irq >= IRQ_COUNT) |
|
- | 483 | return -ELIMIT; |
|
- | 484 | ||
- | 485 | irq_ipc_bind_arch(irq); |
|
- | 486 | return ipc_irq_register(&TASK->answerbox, irq); |
|
- | 487 | } |
|
- | 488 | ||
- | 489 | /* Disconnect irq handler from task */ |
|
- | 490 | __native sys_ipc_unregister_irq(__native irq) |
|
- | 491 | { |
|
- | 492 | if (irq >= IRQ_COUNT) |
|
- | 493 | return -ELIMIT; |
|
- | 494 | ||
- | 495 | ipc_irq_unregister(&TASK->answerbox, irq); |
|
- | 496 | ||
- | 497 | return 0; |
|
- | 498 | } |