URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 39 |
Rev 56 |
Line 11... |
Line 11... |
char *
|
char *
|
sbrk (nbytes)
|
sbrk (nbytes)
|
int nbytes;
|
int nbytes;
|
{
|
{
|
static char *heap_ptr = _end;
|
static char *heap_ptr = _end;
|
|
static char *heap_start = _end;
|
char *base;
|
char *base;
|
struct s_mem {
|
struct s_mem {
|
unsigned int size;
|
unsigned int size;
|
unsigned int icsize;
|
unsigned int icsize;
|
unsigned int dcsize;
|
unsigned int dcsize;
|
Line 28... |
Line 29... |
|
|
get_mem_info(&mem);
|
get_mem_info(&mem);
|
/* NOTE: The value returned from the get_mem_info call is the amount
|
/* NOTE: The value returned from the get_mem_info call is the amount
|
of memory, and not the address of the (last byte + 1) */
|
of memory, and not the address of the (last byte + 1) */
|
|
|
if (((size_t)heap_ptr >= K1BASE) && ((size_t)heap_ptr < (K1BASE + mem.size))) {
|
if (((size_t)heap_ptr >= heap_start) && ((size_t)heap_ptr < (heap_start + mem.size))) {
|
avail = (K1BASE + mem.size) - (size_t)heap_ptr;
|
avail = (heap_start + mem.size) - (size_t)heap_ptr;
|
base = heap_ptr;
|
base = heap_ptr;
|
} /* else will fail since "nbytes" will be greater than zeroed "avail" value */
|
} /* else will fail since "nbytes" will be greater than zeroed "avail" value */
|
|
|
if ((nbytes > avail) || (heap_ptr + nbytes < _end))
|
if ((nbytes > avail) || (heap_ptr + nbytes < _end))
|
base = (char *)-1;
|
base = (char *)-1;
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.