OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [libgloss/] [mn10200/] [sbrk.c] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 56 joel
#include <_ansi.h>
2
#include <sys/types.h>
3
#include <sys/stat.h>
4
#include "trap.h"
5
 
6
 
7
caddr_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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.