2003-04-24 20:36:08 +08:00
|
|
|
/* Version of sbrk for no operating system. */
|
2000-03-18 06:48:54 +08:00
|
|
|
|
2004-05-27 04:38:51 +08:00
|
|
|
#include "config.h"
|
2004-05-27 04:32:58 +08:00
|
|
|
#include <_syslist.h>
|
|
|
|
|
2003-04-24 20:36:08 +08:00
|
|
|
void *
|
|
|
|
_sbrk (incr)
|
|
|
|
int incr;
|
2014-03-05 01:39:26 +08:00
|
|
|
{
|
2003-04-24 20:36:08 +08:00
|
|
|
extern char end; /* Set by linker. */
|
2014-03-05 01:39:26 +08:00
|
|
|
static char * heap_end;
|
|
|
|
char * prev_heap_end;
|
2003-04-24 20:36:08 +08:00
|
|
|
|
|
|
|
if (heap_end == 0)
|
2014-03-05 01:39:26 +08:00
|
|
|
heap_end = & end;
|
2000-03-18 06:48:54 +08:00
|
|
|
|
2014-03-05 01:39:26 +08:00
|
|
|
prev_heap_end = heap_end;
|
|
|
|
heap_end += incr;
|
2003-04-24 20:36:08 +08:00
|
|
|
|
2014-03-05 01:39:26 +08:00
|
|
|
return (void *) prev_heap_end;
|
|
|
|
}
|