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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [sys/] [h8300hms/] [sbrk.c] - Blame information for rev 1010

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

Line No. Rev Author Line
1 1010 ivang
#include <_ansi.h>
2
#include <sys/types.h>
3
#include <sys/stat.h>
4
 
5
register char *stack_ptr asm ("sp");
6
 
7
caddr_t
8
  _sbrk(incr)
9
     int incr;
10
{
11
  extern char end;              /* Defined by the linker */
12
  static char *heap_end;
13
  char *prev_heap_end;
14
 
15
  if (heap_end == 0)
16
    {
17
      heap_end = &end;
18
    }
19
  prev_heap_end = heap_end;
20
  if (heap_end + incr > stack_ptr)
21
    {
22
      _write (1, "Heap and stack collision\n", 25);
23
      abort ();
24
    }
25
  heap_end += incr;
26
  return (caddr_t)prev_heap_end;
27
}
28
 

powered by: WebSVN 2.1.0

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