Changeset c6a7b3a in mainline for kernel/generic/src


Ignore:
Timestamp:
2013-03-28T20:39:16Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2d1fdcad
Parents:
cc3c27ad (diff), 5d9fce4 (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:

mainline changes

Location:
kernel/generic/src
Files:
6 edited

Legend:

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

    rcc3c27ad rc6a7b3a  
    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       
  • kernel/generic/src/mm/backend_anon.c

    rcc3c27ad rc6a7b3a  
    173173 *
    174174 * @param area Pointer to the address space area.
    175  * @param addr Faulting virtual address.
     175 * @param upage Faulting virtual page.
    176176 * @param access Access mode that caused the fault (i.e. read/write/exec).
    177177 *
     
    179179 *     serviced).
    180180 */
    181 int anon_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
    182 {
    183         uintptr_t upage = ALIGN_DOWN(addr, PAGE_SIZE);
     181int anon_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
     182{
    184183        uintptr_t kpage;
    185184        uintptr_t frame;
     
    187186        ASSERT(page_table_locked(AS));
    188187        ASSERT(mutex_locked(&area->lock));
     188        ASSERT(IS_ALIGNED(upage, PAGE_SIZE));
    189189
    190190        if (!as_area_check_access(area, access))
  • kernel/generic/src/mm/backend_elf.c

    rcc3c27ad rc6a7b3a  
    235235 *
    236236 * @param area          Pointer to the address space area.
    237  * @param addr          Faulting virtual address.
     237 * @param upage         Faulting virtual page.
    238238 * @param access        Access mode that caused the fault (i.e.
    239239 *                      read/write/exec).
     
    242242 *                      on success (i.e. serviced).
    243243 */
    244 int elf_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
     244int elf_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
    245245{
    246246        elf_header_t *elf = area->backend_data.elf;
     
    250250        uintptr_t frame;
    251251        uintptr_t kpage;
    252         uintptr_t upage;
    253252        uintptr_t start_anon;
    254253        size_t i;
     
    257256        ASSERT(page_table_locked(AS));
    258257        ASSERT(mutex_locked(&area->lock));
     258        ASSERT(IS_ALIGNED(upage, PAGE_SIZE));
    259259
    260260        if (!as_area_check_access(area, access))
    261261                return AS_PF_FAULT;
    262262       
    263         if (addr < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
     263        if (upage < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
    264264                return AS_PF_FAULT;
    265265       
    266         if (addr >= entry->p_vaddr + entry->p_memsz)
     266        if (upage >= entry->p_vaddr + entry->p_memsz)
    267267                return AS_PF_FAULT;
    268268       
    269         i = (addr - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;
     269        i = (upage - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;
    270270        base = (uintptr_t)
    271271            (((void *) elf) + ALIGN_DOWN(entry->p_offset, PAGE_SIZE));
    272 
    273         /* Virtual address of faulting page */
    274         upage = ALIGN_DOWN(addr, PAGE_SIZE);
    275272
    276273        /* Virtual address of the end of initialized part of segment */
  • kernel/generic/src/mm/backend_phys.c

    rcc3c27ad rc6a7b3a  
    111111 *
    112112 * @param area Pointer to the address space area.
    113  * @param addr Faulting virtual address.
     113 * @param upage Faulting virtual page.
    114114 * @param access Access mode that caused the fault (i.e. read/write/exec).
    115115 *
     
    117117 * serviced).
    118118 */
    119 int phys_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
     119int phys_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
    120120{
    121121        uintptr_t base = area->backend_data.base;
     
    123123        ASSERT(page_table_locked(AS));
    124124        ASSERT(mutex_locked(&area->lock));
     125        ASSERT(IS_ALIGNED(upage, PAGE_SIZE));
    125126
    126127        if (!as_area_check_access(area, access))
    127128                return AS_PF_FAULT;
    128129
    129         ASSERT(addr - area->base < area->backend_data.frames * FRAME_SIZE);
    130         page_mapping_insert(AS, addr, base + (addr - area->base),
     130        ASSERT(upage - area->base < area->backend_data.frames * FRAME_SIZE);
     131        page_mapping_insert(AS, upage, base + (upage - area->base),
    131132            as_area_get_flags(area));
    132133       
    133         if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1))
     134        if (!used_space_insert(area, upage, 1))
    134135                panic("Cannot insert used space.");
    135136
  • kernel/generic/src/mm/page.c

    rcc3c27ad rc6a7b3a  
    104104        ASSERT(page_mapping_operations->mapping_insert);
    105105
    106         page_mapping_operations->mapping_insert(as, page, frame, flags);
     106        page_mapping_operations->mapping_insert(as, ALIGN_DOWN(page, PAGE_SIZE),
     107            ALIGN_DOWN(frame, FRAME_SIZE), flags);
    107108       
    108109        /* Repel prefetched accesses to the old mapping. */
     
    127128        ASSERT(page_mapping_operations->mapping_remove);
    128129       
    129         page_mapping_operations->mapping_remove(as, page);
     130        page_mapping_operations->mapping_remove(as,
     131            ALIGN_DOWN(page, PAGE_SIZE));
    130132       
    131133        /* Repel prefetched accesses to the old mapping. */
     
    150152        ASSERT(page_mapping_operations->mapping_find);
    151153       
    152         return page_mapping_operations->mapping_find(as, page, nolock);
     154        return page_mapping_operations->mapping_find(as,
     155            ALIGN_DOWN(page, PAGE_SIZE), nolock);
    153156}
    154157
  • kernel/generic/src/sysinfo/sysinfo.c

    rcc3c27ad rc6a7b3a  
    753753        sysinfo_return_t ret;
    754754        ret.tag = SYSINFO_VAL_UNDEFINED;
     755        ret.data.data = NULL;
     756        ret.data.size = 0;
    755757       
    756758        if (size > SYSINFO_MAX_PATH)
Note: See TracChangeset for help on using the changeset viewer.