Changes in boot/genarch/balloc.c [e731b0d:95b47c82] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/genarch/balloc.c

    re731b0d r95b47c82  
    2828
    2929#include <balloc.h>
    30 #include <asm.h>
    3130#include <types.h>
    3231#include <align.h>
    3332
    3433static ballocs_t *ballocs;
    35 static uintptr_t phys_base;
    3634
    37 void balloc_init(ballocs_t *ball, uintptr_t base, uintptr_t kernel_base)
     35void balloc_init(ballocs_t *b, uintptr_t base)
    3836{
    39         ballocs = ball;
    40         phys_base = base;
    41         ballocs->base = kernel_base;
     37        ballocs = b;
     38        ballocs->base = base;
    4239        ballocs->size = 0;
    4340}
     
    4542void *balloc(size_t size, size_t alignment)
    4643{
     44        uintptr_t addr;
     45
    4746        /* Enforce minimal alignment. */
    4847        alignment = ALIGN_UP(alignment, 4);
    4948       
    50         uintptr_t addr = phys_base + ALIGN_UP(ballocs->size, alignment);
    51        
     49        addr = ballocs->base + ALIGN_UP(ballocs->size, alignment);
     50
    5251        if (ALIGN_UP(ballocs->size, alignment) + size > BALLOC_MAX_SIZE)
    5352                return NULL;
    54        
     53               
    5554        ballocs->size = ALIGN_UP(ballocs->size, alignment) + size;
    5655       
    5756        return (void *) addr;
    5857}
    59 
    60 void *balloc_rebase(void *ptr)
    61 {
    62         return (void *) ((uintptr_t) ptr - phys_base + ballocs->base);
    63 }
Note: See TracChangeset for help on using the changeset viewer.