Changeset 2e9eae2 in mainline for generic/src


Ignore:
Timestamp:
2006-06-23T16:03:53Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
757551a3
Parents:
a832dd7
Message:

Changed interface of frame_alloc/free to use address of frame instead of the pfn.
This makes it impossible to use >4GB of memory on 32-bit machines, but who cares…

Location:
generic/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • generic/src/console/klog.c

    ra832dd7 r2e9eae2  
    5959        void *faddr;
    6060
    61         faddr = (void *)PFN2ADDR(frame_alloc(KLOG_ORDER, FRAME_ATOMIC));
     61        faddr = frame_alloc(KLOG_ORDER, FRAME_ATOMIC);
    6262        if (!faddr)
    6363                panic("Cannot allocate page for klog");
  • generic/src/cpu/cpu.c

    ra832dd7 r2e9eae2  
    7272
    7373                for (i=0; i < config.cpu_count; i++) {
    74                         cpus[i].stack = (__u8 *) PA2KA(PFN2ADDR(frame_alloc(STACK_FRAMES, FRAME_KA | FRAME_PANIC)));
     74                        cpus[i].stack = (__u8 *) frame_alloc(STACK_FRAMES, FRAME_KA | FRAME_PANIC);
    7575                       
    7676                        cpus[i].id = i;
  • generic/src/mm/as.c

    ra832dd7 r2e9eae2  
    14971497                        node = list_get_instance(cur, btree_node_t, leaf_link);
    14981498                        for (i = 0; i < node->keys; i++)
    1499                                 frame_free(ADDR2PFN((__address) node->value[i]));
     1499                                frame_free((__address) node->value[i]);
    15001500                }
    15011501               
  • generic/src/mm/backend_anon.c

    ra832dd7 r2e9eae2  
    106106                        }
    107107                        if (allocate) {
    108                                 frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));
     108                                frame = (__address) frame_alloc(ONE_FRAME, 0);
    109109                                memsetb(PA2KA(frame), FRAME_SIZE, 0);
    110110                               
     
    133133                 *   the different causes
    134134                 */
    135                 frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));
     135                frame = (__address)frame_alloc(ONE_FRAME, 0);
    136136                memsetb(PA2KA(frame), FRAME_SIZE, 0);
    137137        }
     
    159159void anon_frame_free(as_area_t *area, __address page, __address frame)
    160160{
    161         frame_free(ADDR2PFN(frame));
     161        frame_free(frame);
    162162}
    163163
  • generic/src/mm/backend_elf.c

    ra832dd7 r2e9eae2  
    135135                 */
    136136                if (entry->p_flags & PF_W) {
    137                         frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));
     137                        frame = (__address)frame_alloc(ONE_FRAME, 0);
    138138                        memcpy((void *) PA2KA(frame), (void *) (base + i*FRAME_SIZE), FRAME_SIZE);
    139139                       
     
    154154                 * and cleared.
    155155                 */
    156                 frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));
     156                frame = (__address)frame_alloc(ONE_FRAME, 0);
    157157                memsetb(PA2KA(frame), FRAME_SIZE, 0);
    158158
     
    171171                 */
    172172                size = entry->p_filesz - (i<<PAGE_WIDTH);
    173                 frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));
     173                frame = (__address)frame_alloc(ONE_FRAME, 0);
    174174                memsetb(PA2KA(frame) + size, FRAME_SIZE - size, 0);
    175175                memcpy((void *) PA2KA(frame), (void *) (base + i*FRAME_SIZE), size);
     
    219219                         * Free the frame with the copy of writable segment data.
    220220                         */
    221                         frame_free(ADDR2PFN(frame));
     221                        frame_free(frame);
    222222                }
    223223        } else {
     
    227227                 * In any case, a frame needs to be freed.
    228228                 */
    229                 frame_free(ADDR2PFN(frame));
     229                frame_free(frame);
    230230        }
    231231}
  • generic/src/mm/frame.c

    ra832dd7 r2e9eae2  
    929929 * @param pzone  Preferred zone
    930930 *
    931  * @return Allocated frame.
    932  *
    933  */
    934 pfn_t frame_alloc_generic(__u8 order, int flags, int *status, int *pzone)
     931 * @return Physical address of the allocated frame.
     932 *
     933 */
     934void * frame_alloc_generic(__u8 order, int flags, int *status, int *pzone)
    935935{
    936936        ipl_t ipl;
     
    972972                        if (status)
    973973                                *status = FRAME_NO_MEMORY;
    974                         return NULL;
     974                        return 0;
    975975                }
    976976               
     
    987987        if (status)
    988988                *status = FRAME_OK;
    989         return v;
     989
     990        if (flags & FRAME_KA)
     991                return (void *)PA2KA(PFN2ADDR(v));
     992        return (void *)PFN2ADDR(v);
    990993}
    991994
     
    996999 * If it drops to zero, move the frame structure to free list.
    9971000 *
    998  * @param pfn Frame number of the frame to be freed.
    999  */
    1000 void frame_free(pfn_t pfn)
     1001 * @param Frame Physical Address of of the frame to be freed.
     1002 */
     1003void frame_free(__address frame)
    10011004{
    10021005        ipl_t ipl;
    10031006        zone_t *zone;
     1007        pfn_t pfn = ADDR2PFN(frame);
    10041008
    10051009        ipl = interrupts_disable();
  • generic/src/mm/slab.c

    ra832dd7 r2e9eae2  
    163163        int i;
    164164        int status;
    165         pfn_t pfn;
    166165        int zone=0;
    167166       
    168         pfn = frame_alloc_rc_zone(cache->order, FRAME_KA | flags, &status, &zone);
    169         data = (void *) PA2KA(PFN2ADDR(pfn));
     167        data = frame_alloc_rc_zone(cache->order, FRAME_KA | flags, &status, &zone);
    170168        if (status != FRAME_OK) {
    171169                return NULL;
     
    174172                slab = slab_alloc(slab_extern_cache, flags);
    175173                if (!slab) {
    176                         frame_free(ADDR2PFN(KA2PA(data)));
     174                        frame_free(KA2PA(data));
    177175                        return NULL;
    178176                }
     
    184182        /* Fill in slab structures */
    185183        for (i=0; i < (1 << cache->order); i++)
    186                 frame_set_parent(pfn+i, slab, zone);
     184                frame_set_parent(ADDR2PFN(KA2PA(data))+i, slab, zone);
    187185
    188186        slab->start = data;
     
    205203static count_t slab_space_free(slab_cache_t *cache, slab_t *slab)
    206204{
    207         frame_free(ADDR2PFN(KA2PA(slab->start)));
     205        frame_free(KA2PA(slab->start));
    208206        if (! (cache->flags & SLAB_CACHE_SLINSIDE))
    209207                slab_free(slab_extern_cache, slab);
  • generic/src/proc/thread.c

    ra832dd7 r2e9eae2  
    125125{
    126126        thread_t *t = (thread_t *)obj;
    127         pfn_t pfn;
    128127        int status;
    129128
     
    143142#endif 
    144143
    145         pfn = frame_alloc_rc(STACK_FRAMES, FRAME_KA | kmflags,&status);
     144        t->kstack = frame_alloc_rc(STACK_FRAMES, FRAME_KA | kmflags,&status);
    146145        if (status) {
    147146#ifdef ARCH_HAS_FPU
     
    151150                return -1;
    152151        }
    153         t->kstack = (__u8 *)PA2KA(PFN2ADDR(pfn));
    154152
    155153        return 0;
     
    161159        thread_t *t = (thread_t *)obj;
    162160
    163         frame_free(ADDR2PFN(KA2PA(t->kstack)));
     161        frame_free(KA2PA(t->kstack));
    164162#ifdef ARCH_HAS_FPU
    165163        if (t->saved_fpu_context)
  • generic/src/time/clock.c

    ra832dd7 r2e9eae2  
    8080        void *faddr;
    8181
    82         faddr = (void *)PFN2ADDR(frame_alloc(0, FRAME_ATOMIC));
     82        faddr = frame_alloc(0, FRAME_ATOMIC);
    8383        if (!faddr)
    8484                panic("Cannot allocate page for clock");
Note: See TracChangeset for help on using the changeset viewer.