Changeset cd3b380 in mainline for kernel/generic/src


Ignore:
Timestamp:
2013-09-11T11:56:39Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1db5669
Parents:
43dd8028
Message:

due to the removal of FRAME_KA, the return value of frame_alloc*() needs to be checked before converting the physical address to kernel address

Location:
kernel/generic/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/cpu/cpu.c

    r43dd8028 rcd3b380  
    7373                size_t i;
    7474                for (i = 0; i < config.cpu_count; i++) {
    75                         cpus[i].stack = (uint8_t *) PA2KA(frame_alloc(STACK_FRAMES,
    76                             FRAME_LOWMEM | FRAME_ATOMIC, STACK_SIZE - 1));
     75                        uintptr_t stack_phys = frame_alloc(STACK_FRAMES,
     76                            FRAME_LOWMEM | FRAME_ATOMIC, STACK_SIZE - 1);
     77                        if (!stack_phys)
     78                                panic("Cannot allocate CPU stack.");
     79                       
     80                        cpus[i].stack = (uint8_t *) PA2KA(stack_phys);
    7781                        cpus[i].id = i;
    7882                       
    7983                        irq_spinlock_initialize(&cpus[i].lock, "cpus[].lock");
    8084                       
    81                         unsigned int j;
    82                         for (j = 0; j < RQ_COUNT; j++) {
     85                        for (unsigned int j = 0; j < RQ_COUNT; j++) {
    8386                                irq_spinlock_initialize(&cpus[i].rq[j].lock, "cpus[].rq[].lock");
    8487                                list_initialize(&cpus[i].rq[j].rq);
  • kernel/generic/src/mm/frame.c

    r43dd8028 rcd3b380  
    374374                return;
    375375       
     376        frame->refcount = 1;
    376377        bitmap_set_range(&zone->bitmap, index, 1);
    377378       
  • kernel/generic/src/mm/slab.c

    r43dd8028 rcd3b380  
    182182        size_t zone = 0;
    183183       
    184         void *data = (void *)
    185             PA2KA(frame_alloc_generic(cache->frames, flags, 0, &zone));
    186         if (!data)
     184        uintptr_t data_phys =
     185            frame_alloc_generic(cache->frames, flags, 0, &zone);
     186        if (!data_phys)
    187187                return NULL;
     188       
     189        void *data = (void *) PA2KA(data_phys);
    188190       
    189191        slab_t *slab;
  • kernel/generic/src/proc/thread.c

    r43dd8028 rcd3b380  
    192192        kmflags &= ~FRAME_HIGHMEM;
    193193       
    194         thread->kstack = (uint8_t *)
    195             PA2KA(frame_alloc(STACK_FRAMES, kmflags, STACK_SIZE - 1));
    196         if (!thread->kstack) {
     194        uintptr_t stack_phys =
     195            frame_alloc(STACK_FRAMES, kmflags, STACK_SIZE - 1);
     196        if (!stack_phys) {
    197197#ifdef CONFIG_FPU
    198198                if (thread->saved_fpu_context)
     
    201201                return -1;
    202202        }
     203       
     204        thread->kstack = (uint8_t *) PA2KA(stack_phys);
    203205       
    204206#ifdef CONFIG_UDEBUG
Note: See TracChangeset for help on using the changeset viewer.