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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [h8300hms/] [sbrk.c] - Blame information for rev 309

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

Line No. Rev Author Line
1 207 jeremybenn
#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.