source: trunk/libs/newlib/src/libgloss/mn10300/sbrk.c @ 621

Last change on this file since 621 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 529 bytes
RevLine 
[444]1#include <_ansi.h>
2#include <sys/types.h>
3#include <sys/stat.h>
4#include "trap.h"
5
6
7caddr_t
8_sbrk (size_t incr)
9{
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
18
19  if (heap_end == 0)
20    {
21      heap_end = &end;
22    }
23  prev_heap_end = heap_end;
24  heap_end += incr;
25  if (heap_end > sp)
26    {
27      _write (1, "Heap and stack collision\n", 25);
28      abort ();
29    }
30  return (caddr_t) prev_heap_end;
31}
Note: See TracBrowser for help on using the repository browser.