Files
lk/kernel/vm/bootalloc.c
Travis Geiselbrecht 85a50ea3f4 [kernel][license] try out using a smaller version of the license header
Replace the body of the MIT license with a reference to the LICENSE file
and a URL with the MIT license. Replaces 20 something lines with 3.

No functional change.
2019-06-19 23:28:14 -07:00

37 lines
807 B
C

/*
* Copyright (c) 2014 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#include <kernel/vm.h>
#include "vm_priv.h"
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
#include <lk/trace.h>
#define LOCAL_TRACE 0
/* cheezy allocator that chews up space just after the end of the kernel mapping */
/* track how much memory we've used */
extern int _end;
uintptr_t boot_alloc_start = (uintptr_t) &_end;
uintptr_t boot_alloc_end = (uintptr_t) &_end;
void *boot_alloc_mem(size_t len) {
uintptr_t ptr;
ptr = ALIGN(boot_alloc_end, 8);
boot_alloc_end = (ptr + ALIGN(len, 8));
LTRACEF("len %zu, ptr %p\n", len, (void *)ptr);
return (void *)ptr;
}