Changeset 8cbf1c3 in mainline for kernel/generic/src/mm/frame.c


Ignore:
Timestamp:
2013-09-09T23:13:10Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e2a0d76
Parents:
c67dbd6
Message:

prepare the public API of the frame allocator for the new backend
remove FRAME_KA (can be easily implemented explicitly)

File:
1 edited

Legend:

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

    rc67dbd6 r8cbf1c3  
    873873
    874874        return ADDR2PFN((uintptr_t) frame_alloc(order - FRAME_WIDTH,
    875             FRAME_LOWMEM | FRAME_ATOMIC));
     875            FRAME_LOWMEM | FRAME_ATOMIC, 0));
    876876}
    877877
     
    10241024 *
    10251025 */
    1026 void *frame_alloc_generic(uint8_t order, frame_flags_t flags, size_t *pzone)
     1026uintptr_t frame_alloc_generic(uint8_t order, frame_flags_t flags,
     1027    uintptr_t constraint, size_t *pzone)
    10271028{
    10281029        size_t size = ((size_t) 1) << order;
     
    10711072                        if (!(flags & FRAME_NO_RESERVE))
    10721073                                reserve_free(size);
    1073                         return NULL;
     1074                        return 0;
    10741075                }
    10751076               
     
    11261127                *pzone = znum;
    11271128       
    1128         if (flags & FRAME_KA)
    1129                 return (void *) PA2KA(PFN2ADDR(pfn));
    1130        
    1131         return (void *) PFN2ADDR(pfn);
    1132 }
    1133 
    1134 void *frame_alloc(uint8_t order, frame_flags_t flags)
    1135 {
    1136         return frame_alloc_generic(order, flags, NULL);
    1137 }
    1138 
    1139 void *frame_alloc_noreserve(uint8_t order, frame_flags_t flags)
    1140 {
    1141         return frame_alloc_generic(order, flags | FRAME_NO_RESERVE, NULL);
     1129        return PFN2ADDR(pfn);
     1130}
     1131
     1132uintptr_t frame_alloc(uint8_t order, frame_flags_t flags, uintptr_t constraint)
     1133{
     1134        return frame_alloc_generic(order, flags, constraint, NULL);
     1135}
     1136
     1137uintptr_t frame_alloc_noreserve(uint8_t order, frame_flags_t flags,
     1138    uintptr_t constraint)
     1139{
     1140        return frame_alloc_generic(order, flags | FRAME_NO_RESERVE, constraint,
     1141            NULL);
    11421142}
    11431143
Note: See TracChangeset for help on using the changeset viewer.