Rev 1415 | Rev 1423 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1415 | Rev 1417 | ||
---|---|---|---|
Line 456... | Line 456... | ||
456 | * space area. If the source address space area has not been shared so |
456 | * space area. If the source address space area has not been shared so |
457 | * far, a new sh_info is created and the original mapping is duplicated |
457 | * far, a new sh_info is created and the original mapping is duplicated |
458 | * in its pagemap B+tree. The new address space are simply gets the |
458 | * in its pagemap B+tree. The new address space are simply gets the |
459 | * sh_info of the source area. |
459 | * sh_info of the source area. |
460 | * |
460 | * |
461 | * @param src_as Pointer to source address space |
461 | * @param src_as Pointer to source address space. |
462 | * @param src_base Base address of the source address space area. |
462 | * @param src_base Base address of the source address space area. |
463 | * @param acc_size Expected size of the source area |
463 | * @param acc_size Expected size of the source area. |
464 | * @param dst_base Target base address |
464 | * @param dst_base Target base address. |
- | 465 | * @param dst_flags_mask Destination address space area flags mask. |
|
465 | * |
466 | * |
466 | * @return Zero on success or ENOENT if there is no such task or |
467 | * @return Zero on success or ENOENT if there is no such task or |
467 | * if there is no such address space area, |
468 | * if there is no such address space area, |
468 | * EPERM if there was a problem in accepting the area or |
469 | * EPERM if there was a problem in accepting the area or |
469 | * ENOMEM if there was a problem in allocating destination |
470 | * ENOMEM if there was a problem in allocating destination |
470 | * address space area. ENOTSUP is returned if an attempt |
471 | * address space area. ENOTSUP is returned if an attempt |
471 | * to share non-anonymous address space area is detected. |
472 | * to share non-anonymous address space area is detected. |
472 | */ |
473 | */ |
473 | int as_area_share(as_t *src_as, __address src_base, size_t acc_size, |
474 | int as_area_share(as_t *src_as, __address src_base, size_t acc_size, |
474 | __address dst_base) |
475 | __address dst_base, int dst_flags_mask) |
475 | { |
476 | { |
476 | ipl_t ipl; |
477 | ipl_t ipl; |
477 | int src_flags; |
478 | int src_flags; |
478 | size_t src_size; |
479 | size_t src_size; |
479 | as_area_t *src_area, *dst_area; |
480 | as_area_t *src_area, *dst_area; |
Line 565... | Line 566... | ||
565 | /* |
566 | /* |
566 | * Create copy of the source address space area. |
567 | * Create copy of the source address space area. |
567 | * The destination area is created with AS_AREA_ATTR_PARTIAL |
568 | * The destination area is created with AS_AREA_ATTR_PARTIAL |
568 | * attribute set which prevents race condition with |
569 | * attribute set which prevents race condition with |
569 | * preliminary as_page_fault() calls. |
570 | * preliminary as_page_fault() calls. |
- | 571 | * The flags of the source area are masked against dst_flags_mask |
|
- | 572 | * to support sharing in less privileged mode. |
|
570 | */ |
573 | */ |
571 | dst_area = as_area_create(AS, src_flags, src_size, dst_base, AS_AREA_ATTR_PARTIAL, &anon_backend, NULL); |
574 | dst_area = as_area_create(AS, src_flags & dst_flags_mask, src_size, dst_base, |
- | 575 | AS_AREA_ATTR_PARTIAL, &anon_backend, NULL); |
|
572 | if (!dst_area) { |
576 | if (!dst_area) { |
573 | /* |
577 | /* |
574 | * Destination address space area could not be created. |
578 | * Destination address space area could not be created. |
575 | */ |
579 | */ |
576 | sh_info_remove_reference(sh_info); |
580 | sh_info_remove_reference(sh_info); |