Rev 998 | Rev 1024 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 998 | Rev 1005 | ||
---|---|---|---|
Line 95... | Line 95... | ||
95 | 95 | ||
96 | return 0; |
96 | return 0; |
97 | } |
97 | } |
98 | 98 | ||
99 | /** Synchronous IPC call allowing to send whole message */ |
99 | /** Synchronous IPC call allowing to send whole message */ |
100 | static __native sys_ipc_call_sync(__native phoneid, __native *data) |
100 | static __native sys_ipc_call_sync(__native phoneid, __native *question, |
- | 101 | __native *reply) |
|
101 | { |
102 | { |
102 | call_t call; |
103 | call_t call; |
103 | phone_t *phone; |
104 | phone_t *phone; |
104 | /* Special answerbox for synchronous messages */ |
105 | /* Special answerbox for synchronous messages */ |
105 | 106 | ||
106 | phone = get_phone(phoneid); |
107 | phone = get_phone(phoneid); |
107 | if (!phone) |
108 | if (!phone) |
108 | return IPC_CALLRET_FATAL; |
109 | return IPC_CALLRET_FATAL; |
109 | 110 | ||
110 | ipc_call_init(&call); |
111 | ipc_call_init(&call); |
111 | copy_from_uspace(&call.data, data, sizeof(call.data)); |
112 | copy_from_uspace(&call.data, question, sizeof(call.data)); |
112 | 113 | ||
113 | ipc_call_sync(phone, &call); |
114 | ipc_call_sync(phone, &call); |
114 | 115 | ||
115 | copy_to_uspace(data, &call.data, sizeof(call.data)); |
116 | copy_to_uspace(reply, &call.data, sizeof(call.data)); |
116 | 117 | ||
117 | return 0; |
118 | return 0; |
118 | } |
119 | } |
119 | 120 | ||
120 | /** Check that the task did not exceed allowed limit |
121 | /** Check that the task did not exceed allowed limit |
Line 182... | Line 183... | ||
182 | return (__native) call; |
183 | return (__native) call; |
183 | } |
184 | } |
184 | 185 | ||
185 | 186 | ||
186 | /** Send IPC answer */ |
187 | /** Send IPC answer */ |
187 | static __native sys_ipc_answer(__native callid, __native retval, __native arg1, |
188 | static __native sys_ipc_answer_fast(__native callid, __native retval, |
188 | __native arg2) |
189 | __native arg1, __native arg2) |
189 | { |
190 | { |
190 | call_t *call; |
191 | call_t *call; |
191 | 192 | ||
192 | /* Check that the user is not sending us answer callid */ |
193 | /* Check that the user is not sending us answer callid */ |
193 | ASSERT(! (callid & 1)); |
194 | ASSERT(! (callid & 1)); |
Line 200... | Line 201... | ||
200 | 201 | ||
201 | ipc_answer(&TASK->answerbox, call); |
202 | ipc_answer(&TASK->answerbox, call); |
202 | return 0; |
203 | return 0; |
203 | } |
204 | } |
204 | 205 | ||
- | 206 | /** Send IPC answer */ |
|
- | 207 | static __native sys_ipc_answer(__native callid, __native *data) |
|
- | 208 | { |
|
- | 209 | call_t *call; |
|
- | 210 | ||
- | 211 | /* Check that the user is not sending us answer callid */ |
|
- | 212 | ASSERT(! (callid & 1)); |
|
- | 213 | /* TODO: Check that the callid is in the dispatch table */ |
|
- | 214 | call = (call_t *) callid; |
|
- | 215 | copy_from_uspace(&call->data, data, sizeof(call->data)); |
|
- | 216 | ipc_answer(&TASK->answerbox, call); |
|
- | 217 | ||
- | 218 | return 0; |
|
- | 219 | } |
|
- | 220 | ||
205 | /** Wait for incoming ipc call or answer |
221 | /** Wait for incoming ipc call or answer |
206 | * |
222 | * |
207 | * @param result |
223 | * @param result |
208 | * @param flags |
224 | * @param flags |
209 | * @return Callid, if callid & 1, then the call is answer |
225 | * @return Callid, if callid & 1, then the call is answer |
210 | */ |
226 | */ |
211 | static __native sys_ipc_wait_for_call(__native *calldata, __native flags) |
227 | static __native sys_ipc_wait_for_call(__native *calldata, task_id_t *taskid, |
- | 228 | __native flags) |
|
212 | { |
229 | { |
213 | call_t *call; |
230 | call_t *call; |
214 | 231 | ||
215 | call = ipc_wait_for_call(&TASK->answerbox, flags); |
232 | call = ipc_wait_for_call(&TASK->answerbox, flags); |
216 | 233 | ||
Line 220... | Line 237... | ||
220 | ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC)); |
237 | ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC)); |
221 | ipc_call_free(call); |
238 | ipc_call_free(call); |
222 | atomic_dec(&TASK->active_calls); |
239 | atomic_dec(&TASK->active_calls); |
223 | return ((__native)call) | IPC_CALLID_ANSWERED; |
240 | return ((__native)call) | IPC_CALLID_ANSWERED; |
224 | } |
241 | } |
- | 242 | copy_to_uspace(taskid, (void *)&TASK->taskid, sizeof(TASK->taskid)); |
|
225 | return (__native)call; |
243 | return (__native)call; |
226 | } |
244 | } |
227 | 245 | ||
228 | static __native sys_mremap(void *address, size_t size, unsigned long flags) |
246 | static __native sys_mremap(void *address, size_t size, unsigned long flags) |
229 | { |
247 | { |
Line 236... | Line 254... | ||
236 | sys_mremap, |
254 | sys_mremap, |
237 | sys_ipc_call_sync_fast, |
255 | sys_ipc_call_sync_fast, |
238 | sys_ipc_call_sync, |
256 | sys_ipc_call_sync, |
239 | sys_ipc_call_async_fast, |
257 | sys_ipc_call_async_fast, |
240 | sys_ipc_call_async, |
258 | sys_ipc_call_async, |
- | 259 | sys_ipc_answer_fast, |
|
241 | sys_ipc_answer, |
260 | sys_ipc_answer, |
242 | sys_ipc_wait_for_call |
261 | sys_ipc_wait_for_call |
243 | }; |
262 | }; |