Rev 955 | Rev 965 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 955 | Rev 959 | ||
---|---|---|---|
Line 53... | Line 53... | ||
53 | putchar(((char *) buf)[i]); |
53 | putchar(((char *) buf)[i]); |
54 | 54 | ||
55 | return count; |
55 | return count; |
56 | } |
56 | } |
57 | 57 | ||
58 | /** Send a call over syscall |
58 | /** Send a call over IPC, wait for reply, return to user |
59 | * |
59 | * |
60 | * @return Call identification, returns -1 on fatal error, |
60 | * @return Call identification, returns -1 on fatal error, |
61 | -2 on 'Too many async request, handle answers first |
61 | -2 on 'Too many async request, handle answers first |
62 | */ |
62 | */ |
63 | static __native sys_ipc_call(__native phoneid, __native arg1, __native arg2) |
63 | static __native sys_ipc_call_sync(__native phoneid, __native arg1, |
- | 64 | __native arg2, __native *respdata) |
|
- | 65 | { |
|
- | 66 | call_t *call; |
|
- | 67 | phone_t *phone; |
|
- | 68 | /* Special answerbox for synchronous messages */ |
|
- | 69 | ||
- | 70 | if (phoneid >= IPC_MAX_PHONES) |
|
- | 71 | return -ENOENT; |
|
- | 72 | ||
- | 73 | phone = &TASK->phones[phoneid]; |
|
- | 74 | if (!phone->callee) |
|
- | 75 | return -ENOENT; |
|
- | 76 | ||
- | 77 | call = ipc_call_alloc(); |
|
- | 78 | call->data[0] = arg1; |
|
- | 79 | call->data[1] = arg2; |
|
- | 80 | ||
- | 81 | ipc_call_sync(phone, call); |
|
- | 82 | ||
- | 83 | copy_to_uspace(respdata, &call->data, sizeof(__native) * IPC_CALL_LEN); |
|
- | 84 | ||
- | 85 | return 0; |
|
- | 86 | } |
|
- | 87 | ||
- | 88 | /** Send an asynchronous call over ipc |
|
- | 89 | * |
|
- | 90 | * @return Call identification, returns -1 on fatal error, |
|
- | 91 | -2 on 'Too many async request, handle answers first |
|
- | 92 | */ |
|
- | 93 | static __native sys_ipc_call_async(__native phoneid, __native arg1, |
|
- | 94 | __native arg2) |
|
64 | { |
95 | { |
65 | call_t *call; |
96 | call_t *call; |
66 | phone_t *phone; |
97 | phone_t *phone; |
67 | 98 | ||
68 | if (phoneid >= IPC_MAX_PHONES) |
99 | if (phoneid >= IPC_MAX_PHONES) |
Line 122... | Line 153... | ||
122 | 153 | ||
123 | 154 | ||
124 | syshandler_t syscall_table[SYSCALL_END] = { |
155 | syshandler_t syscall_table[SYSCALL_END] = { |
125 | sys_ctl, |
156 | sys_ctl, |
126 | sys_io, |
157 | sys_io, |
127 | sys_ipc_call, |
158 | sys_ipc_call_sync, |
- | 159 | sys_ipc_call_async, |
|
128 | sys_ipc_answer, |
160 | sys_ipc_answer, |
129 | sys_ipc_wait_for_call |
161 | sys_ipc_wait_for_call |
130 | }; |
162 | }; |