Changeset b50b5af2 in mainline for boot/genarch/balloc.c


Ignore:
Timestamp:
2009-08-22T10:48:00Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
04803bf
Parents:
1ea99cc (diff), a71c158 (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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/genarch/balloc.c

    r1ea99cc rb50b5af2  
    2828
    2929#include <balloc.h>
     30#include <asm.h>
    3031#include <types.h>
    3132#include <align.h>
    3233
    3334static ballocs_t *ballocs;
     35static uintptr_t phys_base;
    3436
    35 void balloc_init(ballocs_t *b, uintptr_t base)
     37void balloc_init(ballocs_t *ball, uintptr_t base, uintptr_t kernel_base)
    3638{
    37         ballocs = b;
    38         ballocs->base = base;
     39        ballocs = ball;
     40        phys_base = base;
     41        ballocs->base = kernel_base;
    3942        ballocs->size = 0;
    4043}
     
    4245void *balloc(size_t size, size_t alignment)
    4346{
    44         uintptr_t addr;
    45 
    4647        /* Enforce minimal alignment. */
    4748        alignment = ALIGN_UP(alignment, 4);
    4849       
    49         addr = ballocs->base + ALIGN_UP(ballocs->size, alignment);
    50 
     50        uintptr_t addr = phys_base + ALIGN_UP(ballocs->size, alignment);
     51       
    5152        if (ALIGN_UP(ballocs->size, alignment) + size > BALLOC_MAX_SIZE)
    5253                return NULL;
    53                
     54       
    5455        ballocs->size = ALIGN_UP(ballocs->size, alignment) + size;
    5556       
    5657        return (void *) addr;
    5758}
     59
     60void *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.