URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 180 |
Rev 197 |
Line 65... |
Line 65... |
code in errno. */
|
code in errno. */
|
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
void *
|
void *
|
_sbrk (int nbytes)
|
_sbrk (int nbytes)
|
{
|
{
|
/* Symbols defined by linker map */
|
/* Symbol defined by linker map */
|
extern int end; /* start of free memory */
|
extern int end; /* start of free memory (as symbol) */
|
extern int stack; /* end of free memory */
|
|
|
/* Value set by crt0.S */
|
|
extern void *stack; /* end of free memory */
|
|
|
/* The statically held previous end of the stack, with its initialization. */
|
/* The statically held previous end of the stack, with its initialization. */
|
static void *heap_ptr = (void *)&end; /* Previous end */
|
static void *heap_ptr = (void *)&end; /* Previous end */
|
|
|
if (((void *) &stack - (heap_ptr + nbytes)) > STACK_BUFFER )
|
if ((stack - (heap_ptr + nbytes)) > STACK_BUFFER )
|
{
|
{
|
void * base = heap_ptr;
|
void * base = heap_ptr;
|
heap_ptr += nbytes;
|
heap_ptr += nbytes;
|
|
|
return base;
|
return base;
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.