Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 25a76ab8 in mainline for boot/generic/src/balloc.c


Ignore:
Timestamp:
2010-05-08T07:53:23Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
051bc69a
Parents:
6c39a907 (diff), 1317380 (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 moved

Legend:

Unmodified
Added
Removed
  • boot/generic/src/balloc.c

    r6c39a907 r25a76ab8  
    2828
    2929#include <balloc.h>
    30 #include <asm.h>
    31 #include <types.h>
     30#include <typedefs.h>
    3231#include <align.h>
    3332
    3433static ballocs_t *ballocs;
    3534static uintptr_t phys_base;
     35static size_t max_size;
    3636
    37 void balloc_init(ballocs_t *ball, uintptr_t base, uintptr_t kernel_base)
     37void balloc_init(ballocs_t *ball, void *base, uintptr_t kernel_base,
     38    size_t size)
    3839{
    3940        ballocs = ball;
    40         phys_base = base;
     41        phys_base = (uintptr_t) base;
     42        max_size = size;
    4143        ballocs->base = kernel_base;
    4244        ballocs->size = 0;
     
    4547void *balloc(size_t size, size_t alignment)
    4648{
     49        if (alignment == 0)
     50                return NULL;
     51       
    4752        /* Enforce minimal alignment. */
    4853        alignment = ALIGN_UP(alignment, 4);
     
    5055        uintptr_t addr = phys_base + ALIGN_UP(ballocs->size, alignment);
    5156       
    52         if (ALIGN_UP(ballocs->size, alignment) + size > BALLOC_MAX_SIZE)
     57        if (ALIGN_UP(ballocs->size, alignment) + size >= max_size)
    5358                return NULL;
    5459       
Note: See TracChangeset for help on using the changeset viewer.