Changes in kernel/generic/src/mm/as.c [59fb782:94795812] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/as.c
r59fb782 r94795812 79 79 #include <syscall/copy.h> 80 80 #include <arch/interrupt.h> 81 #include <interrupt.h>82 81 83 82 /** … … 427 426 /* 428 427 * So far, the area does not conflict with other areas. 429 * Check if it is contained in the useraddress space.428 * Check if it doesn't conflict with kernel address space. 430 429 */ 431 430 if (!KERNEL_ADDRESS_SPACE_SHADOWED) { 432 return iswithin(USER_ADDRESS_SPACE_START, 433 (USER_ADDRESS_SPACE_END - USER_ADDRESS_SPACE_START) + 1, 434 addr, P2SZ(count)); 431 return !overlaps(addr, P2SZ(count), KERNEL_ADDRESS_SPACE_START, 432 KERNEL_ADDRESS_SPACE_END - KERNEL_ADDRESS_SPACE_START); 435 433 } 436 434 … … 544 542 mem_backend_data_t *backend_data, uintptr_t *base, uintptr_t bound) 545 543 { 546 if ((*base != (uintptr_t) -1) && !IS_ALIGNED(*base, PAGE_SIZE))544 if ((*base != (uintptr_t) -1) && ((*base % PAGE_SIZE) != 0)) 547 545 return NULL; 548 546 … … 688 686 int as_area_resize(as_t *as, uintptr_t address, size_t size, unsigned int flags) 689 687 { 690 if (!IS_ALIGNED(address, PAGE_SIZE))691 return EINVAL;692 693 688 mutex_lock(&as->lock); 694 689 … … 701 696 return ENOENT; 702 697 } 703 704 if (!area->backend->is_resizable(area)) { 705 /* 706 * The backend does not support resizing for this area. 698 699 if (area->backend == &phys_backend) { 700 /* 701 * Remapping of address space areas associated 702 * with memory mapped devices is not supported. 707 703 */ 708 704 mutex_unlock(&area->lock); … … 1061 1057 } 1062 1058 1063 if (!src_area->backend->is_shareable(src_area)) { 1064 /* 1065 * The backend does not permit sharing of this area. 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. 1066 1063 */ 1067 1064 mutex_unlock(&src_area->lock); … … 1353 1350 * Interrupts are assumed disabled. 1354 1351 * 1355 * @param address Faulting address.1356 * @param access 1357 * 1358 * @param istate 1352 * @param page Faulting page. 1353 * @param access Access mode that caused the page fault (i.e. 1354 * read/write/exec). 1355 * @param istate Pointer to the interrupted state. 1359 1356 * 1360 1357 * @return AS_PF_FAULT on page fault. … … 1364 1361 * 1365 1362 */ 1366 int as_page_fault(uintptr_t address, pf_access_t access, istate_t *istate) 1367 { 1368 uintptr_t page = ALIGN_DOWN(address, PAGE_SIZE); 1369 int rc = AS_PF_FAULT; 1370 1363 int as_page_fault(uintptr_t page, pf_access_t access, istate_t *istate) 1364 { 1371 1365 if (!THREAD) 1372 goto page_fault;1366 return AS_PF_FAULT; 1373 1367 1374 1368 if (!AS) 1375 goto page_fault;1369 return AS_PF_FAULT; 1376 1370 1377 1371 mutex_lock(&AS->lock); … … 1429 1423 * Resort to the backend page fault handler. 1430 1424 */ 1431 rc = area->backend->page_fault(area, page, access); 1432 if (rc != AS_PF_OK) { 1425 if (area->backend->page_fault(area, page, access) != AS_PF_OK) { 1433 1426 page_table_unlock(AS, false); 1434 1427 mutex_unlock(&area->lock); … … 1451 1444 istate_set_retaddr(istate, 1452 1445 (uintptr_t) &memcpy_to_uspace_failover_address); 1453 } else if (rc == AS_PF_SILENT) {1454 printf("Killing task %" PRIu64 " due to a "1455 "failed late reservation request.\n", TASK->taskid);1456 task_kill_self(true);1457 1446 } else { 1458 fault_if_from_uspace(istate, "Page fault: %p.", (void *) address); 1459 panic_memtrap(istate, access, address, NULL); 1447 return AS_PF_FAULT; 1460 1448 } 1461 1449 … … 1683 1671 { 1684 1672 ASSERT(mutex_locked(&area->lock)); 1685 ASSERT( IS_ALIGNED(page, PAGE_SIZE));1673 ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE)); 1686 1674 ASSERT(count); 1687 1675 … … 1967 1955 { 1968 1956 ASSERT(mutex_locked(&area->lock)); 1969 ASSERT( IS_ALIGNED(page, PAGE_SIZE));1957 ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE)); 1970 1958 ASSERT(count); 1971 1959 … … 2144 2132 { 2145 2133 uintptr_t virt = base; 2146 as_area_t *area = as_area_create(AS, flags , size,2134 as_area_t *area = as_area_create(AS, flags | AS_AREA_CACHEABLE, size, 2147 2135 AS_AREA_ATTR_NONE, &anon_backend, NULL, &virt, bound); 2148 2136 if (area == NULL)
Note:
See TracChangeset
for help on using the changeset viewer.