Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset b2fa2d86 in mainline


Ignore:
Timestamp:
2013-03-26T15:06:35Z (9 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
ea15a89a
Parents:
8a26f82 (diff), 5c4356b (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:

Merge mainline changes

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • boot/generic/include/memstr.h

    r8a26f82 rb2fa2d86  
    3636
    3737extern void *memcpy(void *, const void *, size_t);
     38extern void *memset(void *, int, size_t);
    3839extern void *memmove(void *, const void *, size_t);
    3940
  • boot/generic/src/memstr.c

    r8a26f82 rb2fa2d86  
    3535 * memory areas cannot overlap.
    3636 *
    37  * @param src           Source address to copy from.
    38  * @param dst           Destination address to copy to.
    39  * @param cnt           Number of bytes to copy.
     37 * @param src Source address to copy from.
     38 * @param dst Destination address to copy to.
     39 * @param cnt Number of bytes to copy.
    4040 *
    41  * @return              Destination address.
     41 * @return Destination address.
     42 *
    4243 */
    4344void *memcpy(void *dst, const void *src, size_t cnt)
    4445{
    45         size_t i;
     46        return __builtin_memcpy(dst, src, cnt);
     47}
    4648
    47         for (i = 0; i < cnt; i++)
    48                 ((uint8_t *) dst)[i] = ((uint8_t *) src)[i];
    49 
    50         return dst;
     49/** Fill block of memory.
     50 *
     51 * Fill cnt bytes at dst address with the value val.
     52 *
     53 * @param dst Destination address to fill.
     54 * @param val Value to fill.
     55 * @param cnt Number of bytes to fill.
     56 *
     57 * @return Destination address.
     58 *
     59 */
     60void *memset(void *dst, int val, size_t cnt)
     61{
     62        return __builtin_memset(dst, val, cnt);
    5163}
    5264
  • kernel/arch/amd64/src/mm/page.c

    r8a26f82 rb2fa2d86  
    7878void page_fault(unsigned int n, istate_t *istate)
    7979{
    80         uintptr_t page = read_cr2();
     80        uintptr_t badvaddr = read_cr2();
    8181       
    8282        if (istate->error_word & PFERR_CODE_RSVD)
     
    9292                access = PF_ACCESS_READ;
    9393       
    94         as_page_fault(page, access, istate);
     94        (void) as_page_fault(badvaddr, access, istate);
    9595}
    9696
  • kernel/arch/arm32/src/fpu_context.c

    r8a26f82 rb2fa2d86  
    119119 * rely on user decision to use CONFIG_FPU.
    120120 */
    121 #ifdef PROCESSOR_ARC_armv7_a
     121#ifdef PROCESSOR_ARCH_armv7_a
    122122        const uint32_t cpacr = CPACR_read();
    123123        /* FPU needs access to coprocessor 10 and 11.
    124          * Moreover they need to have same access enabledd */
     124         * Moreover they need to have same access enabled */
    125125        if (((cpacr & CPACR_CP_MASK(10)) != CPACR_CP_FULL_ACCESS(10)) &&
    126126           ((cpacr & CPACR_CP_MASK(11)) != CPACR_CP_FULL_ACCESS(11))) {
  • kernel/arch/ia32/src/mm/page.c

    r8a26f82 rb2fa2d86  
    8484void page_fault(unsigned int n __attribute__((unused)), istate_t *istate)
    8585{
    86         uintptr_t page;
     86        uintptr_t badvaddr;
    8787        pf_access_t access;
    8888       
    89         page = read_cr2();
     89        badvaddr = read_cr2();
    9090               
    9191        if (istate->error_word & PFERR_CODE_RSVD)
     
    9797                access = PF_ACCESS_READ;
    9898       
    99         if (as_page_fault(page, access, istate) == AS_PF_FAULT) {
    100                 fault_if_from_uspace(istate, "Page fault: %#x.", page);
    101                 panic_memtrap(istate, access, page, NULL);
    102         }
     99        (void) as_page_fault(badvaddr, access, istate);
    103100}
    104101
  • kernel/arch/mips32/src/mm/tlb.c

    r8a26f82 rb2fa2d86  
    9494        entry_lo_t lo;
    9595        uintptr_t badvaddr;
    96         uintptr_t page;
    9796        pte_t *pte;
    9897       
    9998        badvaddr = cp0_badvaddr_read();
    100         page = ALIGN_DOWN(badvaddr, PAGE_SIZE);
    101 
    102         pte = page_mapping_find(AS, page, true);
     99
     100        pte = page_mapping_find(AS, badvaddr, true);
    103101        if (pte && pte->p) {
    104102                /*
     
    125123        }
    126124
    127         (void) as_page_fault(page, PF_ACCESS_READ, istate);
     125        (void) as_page_fault(badvaddr, PF_ACCESS_READ, istate);
    128126}
    129127
     
    137135        tlb_index_t index;
    138136        uintptr_t badvaddr;
    139         uintptr_t page;
    140137        pte_t *pte;
    141138
     
    161158
    162159        badvaddr = cp0_badvaddr_read();
    163         page = ALIGN_DOWN(badvaddr, PAGE_SIZE);
    164 
    165         pte = page_mapping_find(AS, page, true);
     160
     161        pte = page_mapping_find(AS, badvaddr, true);
    166162        if (pte && pte->p) {
    167163                /*
     
    189185        }
    190186
    191         (void) as_page_fault(page, PF_ACCESS_READ, istate);
     187        (void) as_page_fault(badvaddr, PF_ACCESS_READ, istate);
    192188}
    193189
     
    201197        tlb_index_t index;
    202198        uintptr_t badvaddr;
    203         uintptr_t page;
    204199        pte_t *pte;
    205200
    206201        badvaddr = cp0_badvaddr_read();
    207         page = ALIGN_DOWN(badvaddr, PAGE_SIZE);
    208202
    209203        /*
     
    227221        }
    228222
    229         pte = page_mapping_find(AS, page, true);
     223        pte = page_mapping_find(AS, badvaddr, true);
    230224        if (pte && pte->p && pte->w) {
    231225                /*
     
    254248        }
    255249
    256         (void) as_page_fault(page, PF_ACCESS_WRITE, istate);
     250        (void) as_page_fault(badvaddr, PF_ACCESS_WRITE, istate);
    257251}
    258252
  • kernel/arch/sparc64/src/mm/sun4u/tlb.c

    r8a26f82 rb2fa2d86  
    196196void fast_instruction_access_mmu_miss(sysarg_t unused, istate_t *istate)
    197197{
    198         uintptr_t page_16k = ALIGN_DOWN(istate->tpc, PAGE_SIZE);
    199198        size_t index = (istate->tpc >> MMU_PAGE_WIDTH) % MMU_PAGES_PER_PAGE;
    200199        pte_t *t;
    201200
    202         t = page_mapping_find(AS, page_16k, true);
     201        t = page_mapping_find(AS, istate->tpc, true);
    203202        if (t && PTE_EXECUTABLE(t)) {
    204203                /*
     
    216215                 * handler.
    217216                 */
    218                 as_page_fault(page_16k, PF_ACCESS_EXEC, istate);
     217                as_page_fault(istate->tpc, PF_ACCESS_EXEC, istate);
    219218        }
    220219}
  • kernel/generic/src/mm/as.c

    r8a26f82 rb2fa2d86  
    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

    r8a26f82 rb2fa2d86  
    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

    r8a26f82 rb2fa2d86  
    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

    r8a26f82 rb2fa2d86  
    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

    r8a26f82 rb2fa2d86  
    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

    r8a26f82 rb2fa2d86  
    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)
  • tools/toolchain.sh

    r8a26f82 rb2fa2d86  
    5555BINUTILS_VERSION="2.23.1"
    5656BINUTILS_RELEASE=""
    57 GCC_VERSION="4.7.2"
    58 GDB_VERSION="7.5"
     57GCC_VERSION="4.8.0"
     58GDB_VERSION="7.5.1"
    5959
    6060BASEDIR="`pwd`"
     
    275275       
    276276        download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "33adb18c3048d057ac58d07a3f1adb38"
    277         download_fetch "${GCC_SOURCE}" "${GCC}" "cc308a0891e778cfda7a151ab8a6e762"
    278         download_fetch "${GDB_SOURCE}" "${GDB}" "24a6779a9fe0260667710de1b082ef61"
     277        download_fetch "${GCC_SOURCE}" "${GCC}" "e6040024eb9e761c3bea348d1fa5abb0"
     278        download_fetch "${GDB_SOURCE}" "${GDB}" "3f48f468b24447cf24820054ff6e85b1"
    279279}
    280280
  • uspace/srv/fs/exfat/exfat_fat.c

    r8a26f82 rb2fa2d86  
    401401{
    402402        service_id_t service_id = nodep->idx->service_id;
    403         exfat_cluster_t lastc;
     403        exfat_cluster_t lastc = 0;
    404404        int rc;
    405405
  • uspace/srv/fs/fat/fat_fat.c

    r8a26f82 rb2fa2d86  
    128128{
    129129        fat_cluster_t firstc = nodep->firstc;
    130         fat_cluster_t currc;
     130        fat_cluster_t currc = 0;
    131131        aoff64_t relbn = bn;
    132132        int rc;
     
    194194        uint32_t clusters;
    195195        uint32_t max_clusters;
    196         fat_cluster_t c;
     196        fat_cluster_t c = 0;
    197197        int rc;
    198198
     
    679679        fat_cluster_t *lifo;    /* stack for storing free cluster numbers */
    680680        unsigned found = 0;     /* top of the free cluster number stack */
    681         fat_cluster_t clst, value, clst_last1 = FAT_CLST_LAST1(bs);
     681        fat_cluster_t clst;
     682        fat_cluster_t value = 0;
     683        fat_cluster_t clst_last1 = FAT_CLST_LAST1(bs);
    682684        int rc = EOK;
    683685
     
    783785{
    784786        service_id_t service_id = nodep->idx->service_id;
    785         fat_cluster_t lastc;
     787        fat_cluster_t lastc = 0;
    786788        uint8_t fatno;
    787789        int rc;
     
    907909int fat_sanity_check(fat_bs_t *bs, service_id_t service_id)
    908910{
    909         fat_cluster_t e0, e1;
     911        fat_cluster_t e0 = 0;
     912        fat_cluster_t e1 = 0;
    910913        unsigned fat_no;
    911914        int rc;
  • uspace/srv/fs/mfs/mfs_ops.c

    r8a26f82 rb2fa2d86  
    773773{
    774774        int rc;
    775         fs_node_t *fn;
     775        fs_node_t *fn = NULL;
    776776
    777777        rc = mfs_node_get(&fn, service_id, index);
     
    11081108mfs_sync(service_id_t service_id, fs_index_t index)
    11091109{
    1110         fs_node_t *fn;
     1110        fs_node_t *fn = NULL;
    11111111        int rc = mfs_node_get(&fn, service_id, index);
    11121112        if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.