Changeset 69146b93 in mainline for kernel/generic/src/mm/as.c


Ignore:
Timestamp:
2012-11-26T19:02:45Z (12 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
04552324
Parents:
5d230a30 (diff), 7462674 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged mainline,1723.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/as.c

    r5d230a30 r69146b93  
    7979#include <syscall/copy.h>
    8080#include <arch/interrupt.h>
     81#include <interrupt.h>
    8182
    8283/**
     
    426427        /*
    427428         * So far, the area does not conflict with other areas.
    428          * Check if it doesn't conflict with kernel address space.
     429         * Check if it is contained in the user address space.
    429430         */
    430431        if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
    431                 return !overlaps(addr, P2SZ(count), KERNEL_ADDRESS_SPACE_START,
    432                     KERNEL_ADDRESS_SPACE_END - KERNEL_ADDRESS_SPACE_START);
     432                return iswithin(USER_ADDRESS_SPACE_START,
     433                    (USER_ADDRESS_SPACE_END - USER_ADDRESS_SPACE_START) + 1,
     434                    addr, P2SZ(count));
    433435        }
    434436       
     
    696698                return ENOENT;
    697699        }
    698        
    699         if (area->backend == &phys_backend) {
    700                 /*
    701                  * Remapping of address space areas associated
    702                  * with memory mapped devices is not supported.
     700
     701        if (!area->backend->is_resizable(area)) {
     702                /*
     703                 * The backend does not support resizing for this area.
    703704                 */
    704705                mutex_unlock(&area->lock);
     
    10571058        }
    10581059       
    1059         if ((!src_area->backend) || (!src_area->backend->share)) {
    1060                 /*
    1061                  * There is no backend or the backend does not
    1062                  * know how to share the area.
     1060        if (!src_area->backend->is_shareable(src_area)) {
     1061                /*
     1062                 * The backend does not permit sharing of this area.
    10631063                 */
    10641064                mutex_unlock(&src_area->lock);
     
    13631363int as_page_fault(uintptr_t page, pf_access_t access, istate_t *istate)
    13641364{
     1365        int rc = AS_PF_FAULT;
     1366
    13651367        if (!THREAD)
    1366                 return AS_PF_FAULT;
     1368                goto page_fault;
    13671369       
    13681370        if (!AS)
    1369                 return AS_PF_FAULT;
     1371                goto page_fault;
    13701372       
    13711373        mutex_lock(&AS->lock);
     
    14231425         * Resort to the backend page fault handler.
    14241426         */
    1425         if (area->backend->page_fault(area, page, access) != AS_PF_OK) {
     1427        rc = area->backend->page_fault(area, page, access);
     1428        if (rc != AS_PF_OK) {
    14261429                page_table_unlock(AS, false);
    14271430                mutex_unlock(&area->lock);
     
    14441447                istate_set_retaddr(istate,
    14451448                    (uintptr_t) &memcpy_to_uspace_failover_address);
     1449        } else if (rc == AS_PF_SILENT) {
     1450                printf("Killing task %" PRIu64 " due to a "
     1451                    "failed late reservation request.\n", TASK->taskid);
     1452                task_kill_self(true);
    14461453        } else {
    1447                 return AS_PF_FAULT;
     1454                fault_if_from_uspace(istate, "Page fault: %p.", (void *) page);
     1455                panic_memtrap(istate, access, page, NULL);
    14481456        }
    14491457       
     
    21322140{
    21332141        uintptr_t virt = base;
    2134         as_area_t *area = as_area_create(AS, flags | AS_AREA_CACHEABLE, size,
     2142        as_area_t *area = as_area_create(AS, flags, size,
    21352143            AS_AREA_ATTR_NONE, &anon_backend, NULL, &virt, bound);
    21362144        if (area == NULL)
Note: See TracChangeset for help on using the changeset viewer.