Rev 1236 | Rev 1239 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1236 | Rev 1238 | ||
---|---|---|---|
Line 289... | Line 289... | ||
289 | * for sharing group of pages. The source address |
289 | * for sharing group of pages. The source address |
290 | * space area and any associated mapping is preserved. |
290 | * space area and any associated mapping is preserved. |
291 | * |
291 | * |
292 | * @param id Task ID of the accepting task. |
292 | * @param id Task ID of the accepting task. |
293 | * @param base Base address of the source address space area. |
293 | * @param base Base address of the source address space area. |
294 | * @param size Size of the source address space area. |
- | |
295 | * @param flags Flags of the source address space area. |
- | |
296 | * |
294 | * |
297 | * @return 0 on success or ENOENT if there is no such task or |
295 | * @return 0 on success or ENOENT if there is no such task or |
298 | * if there is no such address space area, |
296 | * if there is no such address space area, |
299 | * EPERM if there was a problem in accepting the area or |
297 | * EPERM if there was a problem in accepting the area or |
300 | * ENOMEM if there was a problem in allocating destination |
298 | * ENOMEM if there was a problem in allocating destination |
301 | * address space area. |
299 | * address space area. |
302 | */ |
300 | */ |
303 | int as_area_send(task_id_t id, __address base, size_t size, int flags) |
301 | int as_area_send(task_id_t id, __address base) |
304 | { |
302 | { |
305 | ipl_t ipl; |
303 | ipl_t ipl; |
306 | task_t *t; |
304 | task_t *t; |
307 | count_t i; |
305 | count_t i; |
308 | as_t *as; |
306 | as_t *as; |
309 | __address dst_base; |
307 | __address dst_base; |
- | 308 | int flags; |
|
- | 309 | size_t size; |
|
- | 310 | as_area_t *area; |
|
310 | 311 | ||
311 | ipl = interrupts_disable(); |
312 | ipl = interrupts_disable(); |
312 | spinlock_lock(&tasks_lock); |
313 | spinlock_lock(&tasks_lock); |
313 | 314 | ||
314 | t = task_find_by_id(id); |
315 | t = task_find_by_id(id); |
Line 331... | Line 332... | ||
331 | */ |
332 | */ |
332 | spinlock_unlock(&t->lock); |
333 | spinlock_unlock(&t->lock); |
333 | interrupts_restore(ipl); |
334 | interrupts_restore(ipl); |
334 | return EPERM; |
335 | return EPERM; |
335 | } |
336 | } |
- | 337 | ||
- | 338 | spinlock_lock(&AS->lock); |
|
- | 339 | area = find_area_and_lock(AS, base); |
|
- | 340 | if (!area) { |
|
- | 341 | /* |
|
- | 342 | * Could not find the source address space area. |
|
- | 343 | */ |
|
- | 344 | spinlock_unlock(&t->lock); |
|
- | 345 | spinlock_unlock(&AS->lock); |
|
- | 346 | interrupts_restore(ipl); |
|
- | 347 | return ENOENT; |
|
- | 348 | } |
|
- | 349 | size = area->pages * PAGE_SIZE; |
|
- | 350 | flags = area->flags; |
|
- | 351 | spinlock_unlock(&area->lock); |
|
- | 352 | spinlock_unlock(&AS->lock); |
|
336 | 353 | ||
337 | if ((t->accept_arg.task_id != TASK->taskid) || (t->accept_arg.size != size) || |
354 | if ((t->accept_arg.task_id != TASK->taskid) || (t->accept_arg.size != size) || |
338 | (t->accept_arg.flags != flags)) { |
355 | (t->accept_arg.flags != flags)) { |
339 | /* |
356 | /* |
340 | * Discrepancy in either task ID, size or flags. |
357 | * Discrepancy in either task ID, size or flags. |
Line 877... | Line 894... | ||
877 | * Sending to itself is not allowed. |
894 | * Sending to itself is not allowed. |
878 | */ |
895 | */ |
879 | return (__native) EPERM; |
896 | return (__native) EPERM; |
880 | } |
897 | } |
881 | 898 | ||
882 | return (__native) as_area_send(arg.task_id, (__address) arg.base, arg.size, arg.flags); |
899 | return (__native) as_area_send(arg.task_id, (__address) arg.base); |
883 | } |
900 | } |