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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-newlib/] [newlib-1.17.0/] [libgloss/] [scarts_16/] [sbrk.c] - Blame information for rev 14

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

Line No. Rev Author Line
1 9 jlechner
#include <sys/types.h>
2
#include <errno.h>
3
#include "modules.h"
4
 
5
/* _end is defined by the linker script. */
6
extern int _end;
7
 
8
caddr_t
9
sbrk (int incr)
10
{
11
  static caddr_t heap_end;
12
  caddr_t prev_heap_end;
13
 
14
  if (heap_end == 0)
15
    heap_end = (caddr_t) (&_end);
16
 
17
  prev_heap_end = heap_end;
18
  if (heap_end + incr > FPZ)
19
  {
20
    errno = ENOMEM;
21
    return (caddr_t) -1;
22
  }
23
 
24
  heap_end += incr;
25
  return prev_heap_end;
26
}

powered by: WebSVN 2.1.0

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