Changeset 4872160 in mainline for boot/generic/src/balloc.c


Ignore:
Timestamp:
2010-05-04T10:44:55Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
568db0f
Parents:
bb252ca
Message:

new boot infrastructure

  • more code and metadata unification
  • import of up-to-date implementations from the kernel
  • the boot loaders should behave more similarly on all platforms
  • support for deflate compressed (LZ77) boot components
    • this again allows feasible boot images to be created on mips32
  • IA64 is still not booting
    • the broken forked GNU EFI library has been removed, a replacement of the functionality is on its way
File:
1 moved

Legend:

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

    rbb252ca r4872160  
    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.