fixed more binutils issues (newer gcc/libc)
[zpugcc/jano.git] / toolchain / gcc / libgloss / mn10200 / sbrk.c
blob376fd3285a12bc08c75d6507b7421ccca6961c86
1 #include <_ansi.h>
2 #include <sys/types.h>
3 #include <sys/stat.h>
4 #include "trap.h"
7 caddr_t
8 _sbrk (size_t incr)
10 extern char end; /* Defined by the linker */
11 static char *heap_end;
12 char *prev_heap_end;
13 #if 0
14 char *sp = (char *)stack_ptr;
15 #else
16 char *sp = (char *)&sp;
17 #endif
19 if (heap_end == 0)
21 heap_end = &end;
23 prev_heap_end = heap_end;
24 heap_end += incr;
25 if (heap_end > sp)
27 _write (1, "Heap and stack collision\n", 25);
28 abort ();
30 return (caddr_t) prev_heap_end;