Ignore:
File:
1 edited

Legend:

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

    r908bb96 r59fb782  
    544544    mem_backend_data_t *backend_data, uintptr_t *base, uintptr_t bound)
    545545{
    546         if ((*base != (uintptr_t) -1) && ((*base % PAGE_SIZE) != 0))
     546        if ((*base != (uintptr_t) -1) && !IS_ALIGNED(*base, PAGE_SIZE))
    547547                return NULL;
    548548       
     
    688688int as_area_resize(as_t *as, uintptr_t address, size_t size, unsigned int flags)
    689689{
     690        if (!IS_ALIGNED(address, PAGE_SIZE))
     691                return EINVAL;
     692
    690693        mutex_lock(&as->lock);
    691694       
     
    13501353 * Interrupts are assumed disabled.
    13511354 *
    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.
     1355 * @param address Faulting address.
     1356 * @param access  Access mode that caused the page fault (i.e.
     1357 *                read/write/exec).
     1358 * @param istate  Pointer to the interrupted state.
    13561359 *
    13571360 * @return AS_PF_FAULT on page fault.
     
    13611364 *
    13621365 */
    1363 int as_page_fault(uintptr_t page, pf_access_t access, istate_t *istate)
    1364 {
     1366int as_page_fault(uintptr_t address, pf_access_t access, istate_t *istate)
     1367{
     1368        uintptr_t page = ALIGN_DOWN(address, PAGE_SIZE);
    13651369        int rc = AS_PF_FAULT;
    13661370
     
    14521456                task_kill_self(true);
    14531457        } else {
    1454                 fault_if_from_uspace(istate, "Page fault: %p.", (void *) page);
    1455                 panic_memtrap(istate, access, page, NULL);
     1458                fault_if_from_uspace(istate, "Page fault: %p.", (void *) address);
     1459                panic_memtrap(istate, access, address, NULL);
    14561460        }
    14571461       
     
    16791683{
    16801684        ASSERT(mutex_locked(&area->lock));
    1681         ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE));
     1685        ASSERT(IS_ALIGNED(page, PAGE_SIZE));
    16821686        ASSERT(count);
    16831687       
     
    19631967{
    19641968        ASSERT(mutex_locked(&area->lock));
    1965         ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE));
     1969        ASSERT(IS_ALIGNED(page, PAGE_SIZE));
    19661970        ASSERT(count);
    19671971       
     
    21402144{
    21412145        uintptr_t virt = base;
    2142         as_area_t *area = as_area_create(AS, flags | AS_AREA_CACHEABLE, size,
     2146        as_area_t *area = as_area_create(AS, flags, size,
    21432147            AS_AREA_ATTR_NONE, &anon_backend, NULL, &virt, bound);
    21442148        if (area == NULL)
Note: See TracChangeset for help on using the changeset viewer.